skia2/gm/crbug_1073670.cpp
Herb Derby 438775b19e Reland "fix crbug 1073670"
This is a reland of 553deb66e4

Original change's description:
> fix crbug 1073670
>
> When drawing a path with effects, the deviceMatrix must not be modified.
>
> * added GM for regression checking
>
> Bug: chromium:1073670
>
> Change-Id: Id75d6f00aa50d891ec807f10be72c0068ec80356
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/285387
> Commit-Queue: Herb Derby <herb@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

Bug: chromium:1073670
Change-Id: I518497997f09e37d13fc05499b68135ebd4e0a96
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/285497
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2020-04-24 20:52:21 +00:00

28 lines
743 B
C++

/*
* Copyright 2020 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "gm/gm.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkFont.h"
#include "include/core/SkPaint.h"
#include "include/core/SkPath.h"
#include "include/effects/SkGradientShader.h"
DEF_SIMPLE_GM(crbug_1073670, canvas, 250, 250) {
SkPoint pts[] = {{0, 0}, {0, 250}};
SkColor colors[] = {0xFFFF0000, 0xFF0000FF};
auto sh = SkGradientShader::MakeLinear(pts, colors, nullptr, 2, SkTileMode::kClamp);
SkPaint p;
p.setShader(sh);
SkFont f;
f.setSize(325);
f.setEdging(SkFont::Edging::kAntiAlias);
canvas->drawString("Gradient", 10, 250, f, p);
}