blob: 2d3acbb3a08c25f6aee38cbac081bcf6f0c8e232 [file] [log] [blame]
Michael Ludwig87211cd2020-01-22 14:39:35 -05001/*
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"
9#include "include/core/SkCanvas.h"
10#include "include/core/SkColor.h"
11#include "include/core/SkMatrix.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
30 SkPaint paint;
31 paint.setColor(SK_ColorBLUE);
32 paint.setAntiAlias(true);
33 canvas->drawRect(SkRect::MakeWH(512, 512), paint);
34}