Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: gm/drawregionrotate.cpp

Issue 2277053002: Add drawRegion() API to SkCanvas (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Convert region to a path in complex case Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright 2016 Google Inc.
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.h"
9 #include "SkCanvas.h"
10
11 class DrawRegionRotateGM : public skiagm::GM {
12 public:
13 DrawRegionRotateGM() {}
14
15 protected:
16 SkString onShortName() override {
17 return SkString("drawregionrotate");
18 }
19
20 SkISize onISize() override {
21 return SkISize::Make(300, 300);
22 }
23
24 void onOnceBeforeDraw() override {
25 fRegion.op( 50, 50, 100, 100, SkRegion::kUnion_Op);
26 fRegion.op( 50, 100, 100, 150, SkRegion::kUnion_Op);
27 fRegion.op(100, 50, 150, 100, SkRegion::kUnion_Op);
28 fRegion.op(100, 100, 150, 150, SkRegion::kUnion_Op);
29 }
30
31 void onDraw(SkCanvas* canvas) override {
msarett 2016/08/25 13:02:32 I wanted to write a gm that shows interior cracks
msarett 2016/08/25 15:07:35 Problem was that SkRegion was smartly combining al
32 SkPaint paint;
33 paint.setStyle(SkPaint::kFill_Style);
34 paint.setColor(0x70000000);
35 paint.setAntiAlias(true);
36
37 canvas->translate(100, 0);
38 canvas->rotate(45);
39 canvas->drawRegion(fRegion, paint);
40 }
41
42 SkRegion fRegion;
43
44 private:
45 typedef skiagm::GM INHERITED;
46 };
47 DEF_GM( return new DrawRegionRotateGM; )
OLDNEW
« no previous file with comments | « gm/drawregion.cpp ('k') | include/core/SkCanvas.h » ('j') | src/core/SkDevice.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698