OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 #include "gm.h" | 7 #include "gm.h" |
8 #include "SkBitmap.h" | 8 #include "SkBitmap.h" |
9 #include "SkPath.h" | 9 #include "SkPath.h" |
10 #include "SkRandom.h" | 10 #include "SkRandom.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 for (int width = 0; width <= 1; width++) { | 152 for (int width = 0; width <= 1; width++) { |
153 for (int alpha = 0; alpha <= 2; alpha++) { | 153 for (int alpha = 0; alpha <= 2; alpha++) { |
154 for (int r = 0; r <= 5; r++) { | 154 for (int r = 0; r <= 5; r++) { |
155 SkColor color = GetColor(&random, alpha, style + wid
th + alpha + r); | 155 SkColor color = GetColor(&random, alpha, style + wid
th + alpha + r); |
156 | 156 |
157 SkPaint p; | 157 SkPaint p; |
158 p.setAntiAlias(true); | 158 p.setAntiAlias(true); |
159 p.setColor(color); | 159 p.setColor(color); |
160 // In order to get some batching on the GPU backend
we do 2 src over for | 160 // In order to get some batching on the GPU backend
we do 2 src over for |
161 // each xfer mode which requires a dst read | 161 // each xfer mode which requires a dst read |
162 p.setXfermodeMode(r % 3 == 0 ? SkXfermode::kLighten_
Mode : | 162 p.setBlendMode(r % 3 == 0 ? SkBlendMode::kLighten : |
163 SkXfermode::kSrcOver_
Mode); | 163 SkBlendMode::kSrcOver); |
164 SetStyle(&p, style, width); | 164 SetStyle(&p, style, width); |
165 canvas->save(); | 165 canvas->save(); |
166 canvas->translate(x, y); | 166 canvas->translate(x, y); |
167 canvas->rotate((SkScalar)(r < 3 ? 10 : 0)); | 167 canvas->rotate((SkScalar)(r < 3 ? 10 : 0)); |
168 this->drawShape(canvas, &p, shapeType); | 168 this->drawShape(canvas, &p, shapeType); |
169 canvas->restore(); | 169 canvas->restore(); |
170 x += 8; | 170 x += 8; |
171 } | 171 } |
172 } | 172 } |
173 } | 173 } |
(...skipping 13 matching lines...) Expand all Loading... |
187 static constexpr int kHeight = 400; | 187 static constexpr int kHeight = 400; |
188 typedef GM INHERITED; | 188 typedef GM INHERITED; |
189 }; | 189 }; |
190 | 190 |
191 ////////////////////////////////////////////////////////////////////////////// | 191 ////////////////////////////////////////////////////////////////////////////// |
192 | 192 |
193 static GM* MyFactory(void*) { return new DstReadShuffle; } | 193 static GM* MyFactory(void*) { return new DstReadShuffle; } |
194 static GMRegistry reg(MyFactory); | 194 static GMRegistry reg(MyFactory); |
195 | 195 |
196 } | 196 } |
OLD | NEW |