| OLD | NEW |
| 1 | |
| 2 /* | 1 /* |
| 3 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
| 4 * | 3 * |
| 5 * 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 |
| 6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 7 */ | 6 */ |
| 8 #include "gm.h" | 7 #include "gm.h" |
| 9 #include "SkCanvas.h" | 8 #include "SkCanvas.h" |
| 10 #include "SkPath.h" | 9 #include "SkPath.h" |
| 11 | 10 |
| 12 namespace skiagm { | 11 namespace skiagm { |
| 13 | 12 |
| 14 static const SkColor gPathColor = SK_ColorYELLOW; | 13 static const SkColor gPathColor = SK_ColorYELLOW; |
| 15 | 14 |
| 16 class ComplexClip3GM : public GM { | 15 class ComplexClip3GM : public GM { |
| 17 public: | 16 public: |
| 18 ComplexClip3GM(bool doSimpleClipFirst) | 17 ComplexClip3GM(bool doSimpleClipFirst) |
| 19 : fDoSimpleClipFirst(doSimpleClipFirst) { | 18 : fDoSimpleClipFirst(doSimpleClipFirst) { |
| 20 this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); | 19 this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); |
| 21 } | 20 } |
| 22 | 21 |
| 23 protected: | 22 protected: |
| 24 | 23 |
| 25 SkString onShortName() { | 24 SkString onShortName() { |
| 26 SkString str; | 25 SkString str; |
| 27 str.printf("complexclip3_%s", fDoSimpleClipFirst ? "simple" : "complex")
; | 26 str.printf("complexclip3_%s", fDoSimpleClipFirst ? "simple" : "complex")
; |
| 28 return str; | 27 return str; |
| 29 } | 28 } |
| 30 | 29 |
| 31 SkISize onISize() { return SkISize::Make(1000, 950); } | 30 SkISize onISize() { return SkISize::Make(1000, 950); } |
| 32 | 31 |
| 33 virtual void onDraw(SkCanvas* canvas) { | 32 virtual void onDraw(SkCanvas* canvas) { |
| 34 SkPath clipSimple; | 33 SkPath clipSimple; |
| 35 clipSimple.addCircle(SkIntToScalar(70), SkIntToScalar(50), SkIntToScalar
(20)); | 34 clipSimple.addCircle(SkIntToScalar(70), SkIntToScalar(50), SkIntToScalar
(20)); |
| 36 | 35 |
| 37 SkRect r1 = { 10, 20, 70, 80 }; | 36 SkRect r1 = { 10, 20, 70, 80 }; |
| 38 SkPath clipComplex; | 37 SkPath clipComplex; |
| 39 clipComplex.moveTo(SkIntToScalar(40), SkIntToScalar(50)); | 38 clipComplex.moveTo(SkIntToScalar(40), SkIntToScalar(50)); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 typedef GM INHERITED; | 123 typedef GM INHERITED; |
| 125 }; | 124 }; |
| 126 | 125 |
| 127 ////////////////////////////////////////////////////////////////////////////// | 126 ////////////////////////////////////////////////////////////////////////////// |
| 128 | 127 |
| 129 // Simple clip first | 128 // Simple clip first |
| 130 DEF_GM( return new ComplexClip3GM(true); ) | 129 DEF_GM( return new ComplexClip3GM(true); ) |
| 131 // Complex clip first | 130 // Complex clip first |
| 132 DEF_GM( return new ComplexClip3GM(false); ) | 131 DEF_GM( return new ComplexClip3GM(false); ) |
| 133 } | 132 } |
| OLD | NEW |