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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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); |
166 modeCanvas = NULL; | 166 modeCanvas = NULL; |
167 | 167 |
168 if (NULL == layerCanvas) { | 168 if (NULL == layerCanvas) { |
169 canvas->restore(); | 169 canvas->restore(); |
170 } else { | 170 } else { |
171 SkBitmap bitmap = layerCanvas->getDevice()->accessBitmap(false); | 171 SkAutoROCanvasPixels ropixels(layerCanvas); |
172 canvas->drawBitmap(bitmap, 0, 0); | 172 SkBitmap bitmap; |
| 173 if (ropixels.asROBitmap(&bitmap)) { |
| 174 canvas->drawBitmap(bitmap, 0, 0); |
| 175 } |
173 } | 176 } |
174 | 177 |
175 r.inset(-SK_ScalarHalf, -SK_ScalarHalf); | 178 r.inset(-SK_ScalarHalf, -SK_ScalarHalf); |
176 SkPaint borderPaint; | 179 SkPaint borderPaint; |
177 borderPaint.setStyle(SkPaint::kStroke_Style); | 180 borderPaint.setStyle(SkPaint::kStroke_Style); |
178 canvas->drawRect(r, borderPaint); | 181 canvas->drawRect(r, borderPaint); |
179 | 182 |
180 canvas->restore(); | 183 canvas->restore(); |
181 } | 184 } |
182 | 185 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 SkAutoTUnref<SkShader> fBmpShader; | 237 SkAutoTUnref<SkShader> fBmpShader; |
235 | 238 |
236 typedef GM INHERITED; | 239 typedef GM INHERITED; |
237 }; | 240 }; |
238 | 241 |
239 ////////////////////////////////////////////////////////////////////////////// | 242 ////////////////////////////////////////////////////////////////////////////// |
240 | 243 |
241 DEF_GM(return new Xfermodes3GM;) | 244 DEF_GM(return new Xfermodes3GM;) |
242 | 245 |
243 } | 246 } |
OLD | NEW |