OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "gm.h" | 8 #include "gm.h" |
9 | 9 |
10 namespace skiagm { | 10 namespace skiagm { |
11 | 11 |
12 // This GM exercises the use case found in crbug.com/423834. | 12 // This GM exercises the use case found in crbug.com/423834. |
13 // The following pattern: | 13 // The following pattern: |
14 // save(); | 14 // save(); |
15 // clipRect(rect, noAA); | 15 // clipRect(rect, noAA); |
16 // drawRect(bigRect, noAA); | 16 // drawRect(bigRect, noAA); |
17 // restore(); | 17 // restore(); |
18 // | 18 // |
19 // drawRect(rect, noAA); | 19 // drawRect(rect, noAA); |
20 // can leave 1 pixel wide remnants of the first rect. | 20 // can leave 1 pixel wide remnants of the first rect. |
21 class ClipDrawDrawGM : public GM { | 21 class ClipDrawDrawGM : public GM { |
22 public: | 22 public: |
23 ClipDrawDrawGM() { this->setBGColor(0xFFCCCCCC); } | 23 ClipDrawDrawGM() { this->setBGColor(sk_tool_utils::color_to_565(0xFFCCCCCC))
; } |
24 | 24 |
25 protected: | 25 protected: |
26 SkString onShortName() override { return SkString("clipdrawdraw"); } | 26 SkString onShortName() override { return SkString("clipdrawdraw"); } |
27 | 27 |
28 SkISize onISize() override { return SkISize::Make(512, 512); } | 28 SkISize onISize() override { return SkISize::Make(512, 512); } |
29 | 29 |
30 static void Draw(SkCanvas* canvas, const SkRect& rect) { | 30 static void Draw(SkCanvas* canvas, const SkRect& rect) { |
31 SkPaint p; | 31 SkPaint p; |
32 p.setAntiAlias(false); | 32 p.setAntiAlias(false); |
33 | 33 |
(...skipping 26 matching lines...) Expand all Loading... |
60 | 60 |
61 private: | 61 private: |
62 typedef GM INHERITED; | 62 typedef GM INHERITED; |
63 }; | 63 }; |
64 | 64 |
65 ////////////////////////////////////////////////////////////////////////////// | 65 ////////////////////////////////////////////////////////////////////////////// |
66 | 66 |
67 DEF_GM(return SkNEW(ClipDrawDrawGM);) | 67 DEF_GM(return SkNEW(ClipDrawDrawGM);) |
68 | 68 |
69 } | 69 } |
OLD | NEW |