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

Side by Side Diff: samplecode/SampleXfermodesBlur.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 | « samplecode/SampleLayers.cpp ('k') | src/animator/SkDrawSaveLayer.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 * Copyright 2011 Google Inc. 2 * Copyright 2011 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 "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkView.h" 9 #include "SkView.h"
10 #include "SkBlurMask.h" 10 #include "SkBlurMask.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 SkXfermode* mode = SkXfermode::Create(gModes[i].fMode); 173 SkXfermode* mode = SkXfermode::Create(gModes[i].fMode);
174 SkAutoUnref aur(mode); 174 SkAutoUnref aur(mode);
175 SkRect r; 175 SkRect r;
176 r.set(x, y, x+w, y+h); 176 r.set(x, y, x+w, y+h);
177 177
178 SkPaint p; 178 SkPaint p;
179 p.setStyle(SkPaint::kFill_Style); 179 p.setStyle(SkPaint::kFill_Style);
180 p.setShader(s); 180 p.setShader(s);
181 canvas->drawRect(r, p); 181 canvas->drawRect(r, p);
182 182
183 canvas->saveLayer(&r, NULL, SkCanvas::kARGB_ClipLayer_SaveFlag); 183 canvas->saveLayer(&r, NULL);
184 draw_mode(canvas, mode, twice ? 0x88 : 0xFF, r.fLeft, r.fTop); 184 draw_mode(canvas, mode, twice ? 0x88 : 0xFF, r.fLeft, r.fTop);
185 canvas->restore(); 185 canvas->restore();
186 186
187 r.inset(-SK_ScalarHalf, -SK_ScalarHalf); 187 r.inset(-SK_ScalarHalf, -SK_ScalarHalf);
188 p.setStyle(SkPaint::kStroke_Style); 188 p.setStyle(SkPaint::kStroke_Style);
189 p.setShader(NULL); 189 p.setShader(NULL);
190 canvas->drawRect(r, p); 190 canvas->drawRect(r, p);
191 191
192 canvas->drawText(gModes[i].fLabel, strlen(gModes[i].fLabel), 192 canvas->drawText(gModes[i].fLabel, strlen(gModes[i].fLabel),
193 x + w/2, y - labelP.getTextSize()/2, labelP); 193 x + w/2, y - labelP.getTextSize()/2, labelP);
194 x += w + SkIntToScalar(10); 194 x += w + SkIntToScalar(10);
195 if ((i % W) == W - 1) { 195 if ((i % W) == W - 1) {
196 x = x0; 196 x = x0;
197 y += h + SkIntToScalar(30); 197 y += h + SkIntToScalar(30);
198 } 198 }
199 } 199 }
200 x0 += SkIntToScalar(400); 200 x0 += SkIntToScalar(400);
201 } 201 }
202 s->unref(); 202 s->unref();
203 } 203 }
204 204
205 private: 205 private:
206 typedef SampleView INHERITED; 206 typedef SampleView INHERITED;
207 }; 207 };
208 208
209 ////////////////////////////////////////////////////////////////////////////// 209 //////////////////////////////////////////////////////////////////////////////
210 210
211 static SkView* MyFactory() { return new XfermodesBlurView; } 211 static SkView* MyFactory() { return new XfermodesBlurView; }
212 static SkViewRegister reg(MyFactory); 212 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleLayers.cpp ('k') | src/animator/SkDrawSaveLayer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698