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

Side by Side Diff: src/effects/SkLayerDrawLooper.cpp

Issue 241453003: Reduce internal explicit SaveFlags usage. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Re-added needed save flag in SkPictureStateTree::Iterator::draw() Created 6 years, 8 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 | « src/core/SkPictureStateTree.cpp ('k') | tests/DeferredCanvasTest.cpp » ('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 2011 Google Inc. 3 * Copyright 2011 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 "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkColor.h" 9 #include "SkColor.h"
10 #include "SkReadBuffer.h" 10 #include "SkReadBuffer.h"
(...skipping 19 matching lines...) Expand all
30 SkLayerDrawLooper::~SkLayerDrawLooper() { 30 SkLayerDrawLooper::~SkLayerDrawLooper() {
31 Rec* rec = fRecs; 31 Rec* rec = fRecs;
32 while (rec) { 32 while (rec) {
33 Rec* next = rec->fNext; 33 Rec* next = rec->fNext;
34 SkDELETE(rec); 34 SkDELETE(rec);
35 rec = next; 35 rec = next;
36 } 36 }
37 } 37 }
38 38
39 SkLayerDrawLooper::Context* SkLayerDrawLooper::createContext(SkCanvas* canvas, v oid* storage) const { 39 SkLayerDrawLooper::Context* SkLayerDrawLooper::createContext(SkCanvas* canvas, v oid* storage) const {
40 canvas->save(SkCanvas::kMatrix_SaveFlag); 40 canvas->save();
41 return SkNEW_PLACEMENT_ARGS(storage, LayerDrawLooperContext, (this)); 41 return SkNEW_PLACEMENT_ARGS(storage, LayerDrawLooperContext, (this));
42 } 42 }
43 43
44 static SkColor xferColor(SkColor src, SkColor dst, SkXfermode::Mode mode) { 44 static SkColor xferColor(SkColor src, SkColor dst, SkXfermode::Mode mode) {
45 switch (mode) { 45 switch (mode) {
46 case SkXfermode::kSrc_Mode: 46 case SkXfermode::kSrc_Mode:
47 return src; 47 return src;
48 case SkXfermode::kDst_Mode: 48 case SkXfermode::kDst_Mode:
49 return dst; 49 return dst;
50 default: { 50 default: {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 133
134 bool SkLayerDrawLooper::LayerDrawLooperContext::next(SkCanvas* canvas, 134 bool SkLayerDrawLooper::LayerDrawLooperContext::next(SkCanvas* canvas,
135 SkPaint* paint) { 135 SkPaint* paint) {
136 canvas->restore(); 136 canvas->restore();
137 if (NULL == fCurrRec) { 137 if (NULL == fCurrRec) {
138 return false; 138 return false;
139 } 139 }
140 140
141 ApplyInfo(paint, fCurrRec->fPaint, fCurrRec->fInfo); 141 ApplyInfo(paint, fCurrRec->fPaint, fCurrRec->fInfo);
142 142
143 canvas->save(SkCanvas::kMatrix_SaveFlag); 143 canvas->save();
144 if (fCurrRec->fInfo.fPostTranslate) { 144 if (fCurrRec->fInfo.fPostTranslate) {
145 postTranslate(canvas, fCurrRec->fInfo.fOffset.fX, 145 postTranslate(canvas, fCurrRec->fInfo.fOffset.fX,
146 fCurrRec->fInfo.fOffset.fY); 146 fCurrRec->fInfo.fOffset.fY);
147 } else { 147 } else {
148 canvas->translate(fCurrRec->fInfo.fOffset.fX, 148 canvas->translate(fCurrRec->fInfo.fOffset.fX,
149 fCurrRec->fInfo.fOffset.fY); 149 fCurrRec->fInfo.fOffset.fY);
150 } 150 }
151 fCurrRec = fCurrRec->fNext; 151 fCurrRec = fCurrRec->fNext;
152 152
153 return true; 153 return true;
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 SkLayerDrawLooper* looper = SkNEW(SkLayerDrawLooper); 334 SkLayerDrawLooper* looper = SkNEW(SkLayerDrawLooper);
335 looper->fCount = fCount; 335 looper->fCount = fCount;
336 looper->fRecs = fRecs; 336 looper->fRecs = fRecs;
337 337
338 fCount = 0; 338 fCount = 0;
339 fRecs = NULL; 339 fRecs = NULL;
340 fTopRec = NULL; 340 fTopRec = NULL;
341 341
342 return looper; 342 return looper;
343 } 343 }
OLDNEW
« no previous file with comments | « src/core/SkPictureStateTree.cpp ('k') | tests/DeferredCanvasTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698