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 "SkGradientShader.h" | 10 #include "SkGradientShader.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 int x, int y, int w, int h, | 145 int x, int y, int w, int h, |
146 const SkPaint& modePaint, SkCanvas* layerCanvas) { | 146 const SkPaint& modePaint, SkCanvas* layerCanvas) { |
147 canvas->save(); | 147 canvas->save(); |
148 | 148 |
149 canvas->translate(SkIntToScalar(x), SkIntToScalar(y)); | 149 canvas->translate(SkIntToScalar(x), SkIntToScalar(y)); |
150 | 150 |
151 SkRect r = SkRect::MakeWH(SkIntToScalar(w), SkIntToScalar(h)); | 151 SkRect r = SkRect::MakeWH(SkIntToScalar(w), SkIntToScalar(h)); |
152 | 152 |
153 SkCanvas* modeCanvas; | 153 SkCanvas* modeCanvas; |
154 if (NULL == layerCanvas) { | 154 if (NULL == layerCanvas) { |
155 canvas->saveLayer(&r, NULL, SkCanvas::kARGB_ClipLayer_SaveFlag); | 155 canvas->saveLayer(&r, NULL); |
156 modeCanvas = canvas; | 156 modeCanvas = canvas; |
157 } else { | 157 } else { |
158 modeCanvas = layerCanvas; | 158 modeCanvas = layerCanvas; |
159 } | 159 } |
160 | 160 |
161 SkPaint bgPaint; | 161 SkPaint bgPaint; |
162 bgPaint.setAntiAlias(false); | 162 bgPaint.setAntiAlias(false); |
163 bgPaint.setShader(fBGShader); | 163 bgPaint.setShader(fBGShader); |
164 modeCanvas->drawRect(r, bgPaint); | 164 modeCanvas->drawRect(r, bgPaint); |
165 modeCanvas->drawRect(r, modePaint); | 165 modeCanvas->drawRect(r, modePaint); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 SkAutoTUnref<SkShader> fBmpShader; | 237 SkAutoTUnref<SkShader> fBmpShader; |
238 | 238 |
239 typedef GM INHERITED; | 239 typedef GM INHERITED; |
240 }; | 240 }; |
241 | 241 |
242 ////////////////////////////////////////////////////////////////////////////// | 242 ////////////////////////////////////////////////////////////////////////////// |
243 | 243 |
244 DEF_GM(return new Xfermodes3GM;) | 244 DEF_GM(return new Xfermodes3GM;) |
245 | 245 |
246 } | 246 } |
OLD | NEW |