Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
crbug_1041204.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2020 Google LLC
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#include "gm/gm.h"
12
13DEF_SIMPLE_GM(crbug_10141204, canvas, 512, 512) {
14 // While the coordinates are giant and the transform is not axis-aligned, this should
15 // fill the screen left side with solid blue. This has an extra zoom factor compared to the
16 // canvas JS in order to more visibly highlight the numerical issues that caused the bug.
17 // (The original transform would have completely filled the screen with solid blue, so the bug
18 // manifested as an improper discard on occasion. With the new scale factor, the bug manifests
19 // as either an improper fullscreen clear or an improper discard, instead).
20 SkScalar extraZoom = exp(-2.3f);
21 canvas->scale(extraZoom, extraZoom);
22 canvas->scale(2.f, 2.f);
23 canvas->concat(SkMatrix::MakeAll(
24 -0.0005550860255665798f, -0.0030798374421905717f, -0.014111959825129805f,
25 -0.07569627776417084f, 232.00000000000017f, 39.999999999999936f,
26 0.f, 0.f, 1.f));
27 canvas->translate(-3040103.0493857153f, 337502.1103282161f);
28 canvas->scale(9783.93962050256f, -9783.93962050256f);
29
31 paint.setColor(SK_ColorBLUE);
32 paint.setAntiAlias(true);
33 canvas->drawRect(SkRect::MakeWH(512, 512), paint);
34}
constexpr SkColor SK_ColorBLUE
Definition SkColor.h:135
static SkMatrix MakeAll(SkScalar scaleX, SkScalar skewX, SkScalar transX, SkScalar skewY, SkScalar scaleY, SkScalar transY, SkScalar pers0, SkScalar pers1, SkScalar pers2)
Definition SkMatrix.h:179
const Paint & paint
float SkScalar
Definition extension.cpp:12
#define DEF_SIMPLE_GM(NAME, CANVAS, W, H)
Definition gm.h:50
static constexpr SkRect MakeWH(float w, float h)
Definition SkRect.h:609