Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Side by Side Diff: gm/xfermodes3.cpp

Issue 163603003: add peekPixels to SkCanvas and SkSurface (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « gm/xfermodeimagefilter.cpp ('k') | gyp/gmslides.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « gm/xfermodeimagefilter.cpp ('k') | gyp/gmslides.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698