| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 #include "gm.h" | 8 #include "gm.h" |
| 9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
| 10 #include "SkRandom.h" | 10 #include "SkRandom.h" |
| 11 #include "SkShader.h" | 11 #include "SkShader.h" |
| 12 #include "SkXfermode.h" | 12 #include "SkXfermode.h" |
| 13 | 13 |
| 14 namespace skiagm { | 14 namespace skiagm { |
| 15 | 15 |
| 16 /** | 16 /** |
| 17 * Renders overlapping shapes with random SkXfermode::Modes against a checkerboa
rd. | 17 * Renders overlapping shapes with random SkXfermode::Modes against a checkerboa
rd. |
| 18 */ | 18 */ |
| 19 class MixedXfermodesGM : public GM { | 19 class MixedXfermodesGM : public GM { |
| 20 public: | 20 public: |
| 21 MixedXfermodesGM() { | 21 MixedXfermodesGM() { |
| 22 } | 22 } |
| 23 | 23 |
| 24 protected: | 24 protected: |
| 25 virtual SkString onShortName() SK_OVERRIDE { | 25 virtual SkString onShortName() SK_OVERRIDE { |
| 26 return SkString("mixed_xfermodes"); | 26 return SkString("mixed_xfermodes"); |
| 27 } | 27 } |
| 28 | 28 |
| 29 virtual SkISize onISize() SK_OVERRIDE { | 29 virtual SkISize onISize() SK_OVERRIDE { |
| 30 return make_isize(790, 640); | 30 return SkISize::Make(790, 640); |
| 31 } | 31 } |
| 32 | 32 |
| 33 void drawShape(SkCanvas* canvas, | 33 void drawShape(SkCanvas* canvas, |
| 34 const SkPaint& paint, | 34 const SkPaint& paint, |
| 35 SkRandom* random) { | 35 SkRandom* random) { |
| 36 static const SkRect kRect = SkRect::MakeXYWH(SkIntToScalar(-50), SkIntTo
Scalar(-50), | 36 static const SkRect kRect = SkRect::MakeXYWH(SkIntToScalar(-50), SkIntTo
Scalar(-50), |
| 37 SkIntToScalar(75), SkIntToS
calar(105)); | 37 SkIntToScalar(75), SkIntToS
calar(105)); |
| 38 int shape = random->nextULessThan(5); | 38 int shape = random->nextULessThan(5); |
| 39 switch (shape) { | 39 switch (shape) { |
| 40 case 0: | 40 case 0: |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 SkPath fConvexPath; | 136 SkPath fConvexPath; |
| 137 typedef GM INHERITED; | 137 typedef GM INHERITED; |
| 138 }; | 138 }; |
| 139 | 139 |
| 140 ////////////////////////////////////////////////////////////////////////////// | 140 ////////////////////////////////////////////////////////////////////////////// |
| 141 | 141 |
| 142 static GM* MyFactory(void*) { return new MixedXfermodesGM; } | 142 static GM* MyFactory(void*) { return new MixedXfermodesGM; } |
| 143 static GMRegistry reg(MyFactory); | 143 static GMRegistry reg(MyFactory); |
| 144 | 144 |
| 145 } | 145 } |
| OLD | NEW |