| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 #include "SkRandom.h" | 9 #include "SkRandom.h" |
| 10 #include "SkRRect.h" | 10 #include "SkRRect.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 if (!antialias) { | 53 if (!antialias) { |
| 54 fName.append("_bw"); | 54 fName.append("_bw"); |
| 55 } | 55 } |
| 56 } | 56 } |
| 57 | 57 |
| 58 SkString onShortName() override final { return fName; } | 58 SkString onShortName() override final { return fName; } |
| 59 SkISize onISize() override { return SkISize::Make(500, 500); } | 59 SkISize onISize() override { return SkISize::Make(500, 500); } |
| 60 | 60 |
| 61 void onOnceBeforeDraw() override { | 61 void onOnceBeforeDraw() override { |
| 62 fPaint.setXfermodeMode(SkXfermode::kDarken_Mode); | |
| 63 fPaint.setAntiAlias(fAntialias); | 62 fPaint.setAntiAlias(fAntialias); |
| 64 } | 63 } |
| 65 | 64 |
| 66 void onDraw(SkCanvas* canvas) override { | 65 void onDraw(SkCanvas* canvas) override { |
| 67 canvas->clear(SK_ColorWHITE); | 66 canvas->clear(SK_ColorWHITE); |
| 68 | 67 |
| 69 canvas->save(); | 68 canvas->save(); |
| 70 canvas->translate(canvas->imageInfo().width() / 2.f, canvas->imageInfo()
.height() / 2.f); | 69 canvas->translate(canvas->imageInfo().width() / 2.f, canvas->imageInfo()
.height() / 2.f); |
| 71 this->drawShapes(canvas); | 70 this->drawShapes(canvas); |
| 72 canvas->restore(); | 71 canvas->restore(); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 }; | 153 }; |
| 155 | 154 |
| 156 ////////////////////////////////////////////////////////////////////////////// | 155 ////////////////////////////////////////////////////////////////////////////// |
| 157 | 156 |
| 158 DEF_GM( return new SimpleShapesGM(true); ) | 157 DEF_GM( return new SimpleShapesGM(true); ) |
| 159 DEF_GM( return new SimpleShapesGM(false); ) | 158 DEF_GM( return new SimpleShapesGM(false); ) |
| 160 DEF_GM( return new InnerShapesGM(true); ) | 159 DEF_GM( return new InnerShapesGM(true); ) |
| 161 DEF_GM( return new InnerShapesGM(false); ) | 160 DEF_GM( return new InnerShapesGM(false); ) |
| 162 | 161 |
| 163 } | 162 } |
| OLD | NEW |