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

Side by Side Diff: gm/optimizations.cpp

Issue 186813003: Refactor method used to disable peephole optimizations (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 9 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 | « no previous file | include/core/SkPicture.h » ('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 * 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 7
8 #include "gm.h" 8 #include "gm.h"
9 #include "SkDebugCanvas.h" 9 #include "SkDebugCanvas.h"
10 #include "SkPictureFlat.h" 10 #include "SkPictureFlat.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 (*postOptPattern)[2] = SAVE_LAYER; 75 (*postOptPattern)[2] = SAVE_LAYER;
76 (*postOptPattern)[3] = DRAW_BITMAP_RECT_TO_RECT; 76 (*postOptPattern)[3] = DRAW_BITMAP_RECT_TO_RECT;
77 (*postOptPattern)[4] = RESTORE; 77 (*postOptPattern)[4] = RESTORE;
78 (*postOptPattern)[5] = RESTORE; 78 (*postOptPattern)[5] = RESTORE;
79 (*postOptPattern)[6] = RESTORE; 79 (*postOptPattern)[6] = RESTORE;
80 } 80 }
81 81
82 SkPicture* result = new SkPicture; 82 SkPicture* result = new SkPicture;
83 83
84 // have to disable the optimizations while generating the picture 84 // have to disable the optimizations while generating the picture
85 SkCanvas* canvas = result->beginRecording(100, 100, 85 SkCanvas* canvas = result->beginRecording(100, 100);
86 SkPicture::kDisableRecordOptimizations_RecordingFlag); 86 result->internalOnly_EnableOpts(false);
87 87
88 SkPaint saveLayerPaint; 88 SkPaint saveLayerPaint;
89 saveLayerPaint.setColor(0xCC000000); 89 saveLayerPaint.setColor(0xCC000000);
90 90
91 // saveLayer's 'bounds' parameter must be NULL for this optimization 91 // saveLayer's 'bounds' parameter must be NULL for this optimization
92 if (saveLayerHasPaint) { 92 if (saveLayerHasPaint) {
93 canvas->saveLayer(NULL, &saveLayerPaint); 93 canvas->saveLayer(NULL, &saveLayerPaint);
94 } else { 94 } else {
95 canvas->saveLayer(NULL, NULL); 95 canvas->saveLayer(NULL, NULL);
96 } 96 }
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 (*postOptPattern)[5] = DRAW_BITMAP_RECT_TO_RECT; 211 (*postOptPattern)[5] = DRAW_BITMAP_RECT_TO_RECT;
212 (*postOptPattern)[6] = RESTORE; 212 (*postOptPattern)[6] = RESTORE;
213 (*postOptPattern)[7] = RESTORE; 213 (*postOptPattern)[7] = RESTORE;
214 (*postOptPattern)[8] = RESTORE; 214 (*postOptPattern)[8] = RESTORE;
215 (*postOptPattern)[9] = RESTORE; 215 (*postOptPattern)[9] = RESTORE;
216 } 216 }
217 217
218 SkPicture* result = new SkPicture; 218 SkPicture* result = new SkPicture;
219 219
220 // have to disable the optimizations while generating the picture 220 // have to disable the optimizations while generating the picture
221 SkCanvas* canvas = result->beginRecording(100, 100, 221 SkCanvas* canvas = result->beginRecording(100, 100);
222 SkPicture::kDisableRecordOptimizations_RecordingFlag); 222 result->internalOnly_EnableOpts(false);
223 223
224 SkPaint saveLayerPaint; 224 SkPaint saveLayerPaint;
225 saveLayerPaint.setColor(0xCC000000); 225 saveLayerPaint.setColor(0xCC000000);
226 226
227 // saveLayer's 'bounds' parameter must be NULL for this optimization 227 // saveLayer's 'bounds' parameter must be NULL for this optimization
228 if (saveLayerHasPaint) { 228 if (saveLayerHasPaint) {
229 canvas->saveLayer(NULL, &saveLayerPaint); 229 canvas->saveLayer(NULL, &saveLayerPaint);
230 } else { 230 } else {
231 canvas->saveLayer(NULL, NULL); 231 canvas->saveLayer(NULL, NULL);
232 } 232 }
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 } 411 }
412 412
413 SkBitmap fCheckerboard; 413 SkBitmap fCheckerboard;
414 414
415 typedef skiagm::GM INHERITED; 415 typedef skiagm::GM INHERITED;
416 }; 416 };
417 417
418 ////////////////////////////////////////////////////////////////////////////// 418 //////////////////////////////////////////////////////////////////////////////
419 419
420 DEF_GM( return new OptimizationsGM; ) 420 DEF_GM( return new OptimizationsGM; )
OLDNEW
« no previous file with comments | « no previous file | include/core/SkPicture.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698