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

Side by Side Diff: samplecode/SampleFilterQuality.cpp

Issue 1014533004: SkPaint::FilterLevel -> SkFilterQuality (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 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
« no previous file with comments | « samplecode/SampleFilterFuzz.cpp ('k') | samplecode/SampleIdentityScale.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 2015 Google Inc. 2 * Copyright 2015 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 9
10 #include "Resources.h" 10 #include "Resources.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 case '2': fAngle.inc( ANGLE_DELTA); this->inval(NULL); return tr ue; 168 case '2': fAngle.inc( ANGLE_DELTA); this->inval(NULL); return tr ue;
169 case '3': fScale.inc(-SCALE_DELTA); this->inval(NULL); return tr ue; 169 case '3': fScale.inc(-SCALE_DELTA); this->inval(NULL); return tr ue;
170 case '4': fScale.inc( SCALE_DELTA); this->inval(NULL); return tr ue; 170 case '4': fScale.inc( SCALE_DELTA); this->inval(NULL); return tr ue;
171 case '5': fShowFatBits = !fShowFatBits; this->inval(NULL); retur n true; 171 case '5': fShowFatBits = !fShowFatBits; this->inval(NULL); retur n true;
172 default: break; 172 default: break;
173 } 173 }
174 } 174 }
175 return this->INHERITED::onQuery(evt); 175 return this->INHERITED::onQuery(evt);
176 } 176 }
177 177
178 void drawTheImage(SkCanvas* canvas, const SkISize& size, SkPaint::FilterLeve l filter, 178 void drawTheImage(SkCanvas* canvas, const SkISize& size, SkFilterQuality fil ter,
179 SkScalar dx, SkScalar dy) { 179 SkScalar dx, SkScalar dy) {
180 SkPaint paint; 180 SkPaint paint;
181 paint.setAntiAlias(true); 181 paint.setAntiAlias(true);
182 paint.setFilterLevel(filter); 182 paint.setFilterQuality(filter);
183 183
184 SkAutoCanvasRestore acr(canvas, true); 184 SkAutoCanvasRestore acr(canvas, true);
185 185
186 canvas->translate(dx, dy); 186 canvas->translate(dx, dy);
187 187
188 canvas->translate(SkScalarHalf(size.width()), SkScalarHalf(size.height() )); 188 canvas->translate(SkScalarHalf(size.width()), SkScalarHalf(size.height() ));
189 canvas->scale(fScale, fScale); 189 canvas->scale(fScale, fScale);
190 canvas->rotate(fAngle); 190 canvas->rotate(fAngle);
191 canvas->drawImage(fImage, -SkScalarHalf(fImage->width()), -SkScalarHalf( fImage->height()), 191 canvas->drawImage(fImage, -SkScalarHalf(fImage->width()), -SkScalarHalf( fImage->height()),
192 &paint); 192 &paint);
193 193
194 if (false) { 194 if (false) {
195 acr.restore(); 195 acr.restore();
196 draw_box_frame(canvas, size.width(), size.height()); 196 draw_box_frame(canvas, size.width(), size.height());
197 } 197 }
198 } 198 }
199 199
200 void drawHere(SkCanvas* canvas, SkPaint::FilterLevel filter, SkScalar dx, Sk Scalar dy) { 200 void drawHere(SkCanvas* canvas, SkFilterQuality filter, SkScalar dx, SkScala r dy) {
201 SkCanvas* origCanvas = canvas; 201 SkCanvas* origCanvas = canvas;
202 SkAutoCanvasRestore acr(canvas, true); 202 SkAutoCanvasRestore acr(canvas, true);
203 203
204 SkISize size = SkISize::Make(fImage->width(), fImage->height()); 204 SkISize size = SkISize::Make(fImage->width(), fImage->height());
205 205
206 SkAutoTUnref<SkSurface> surface; 206 SkAutoTUnref<SkSurface> surface;
207 if (fShowFatBits) { 207 if (fShowFatBits) {
208 // scale up so we don't clip rotations 208 // scale up so we don't clip rotations
209 SkImageInfo info = SkImageInfo::MakeN32(fImage->width() * 2, fImage- >height() * 2, 209 SkImageInfo info = SkImageInfo::MakeN32(fImage->width() * 2, fImage- >height() * 2,
210 kOpaque_SkAlphaType); 210 kOpaque_SkAlphaType);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 fTrans.timeToValues(fCurrTime, trans); 246 fTrans.timeToValues(fCurrTime, trans);
247 247
248 for (int y = 0; y < 2; ++y) { 248 for (int y = 0; y < 2; ++y) {
249 for (int x = 0; x < 2; ++x) { 249 for (int x = 0; x < 2; ++x) {
250 int index = y * 2 + x; 250 int index = y * 2 + x;
251 SkAutoCanvasRestore acr(canvas, true); 251 SkAutoCanvasRestore acr(canvas, true);
252 canvas->translate(fCell.width() * x, fCell.height() * y); 252 canvas->translate(fCell.width() * x, fCell.height() * y);
253 SkRect r = SkRect::MakeWH(fCell.width(), fCell.height()); 253 SkRect r = SkRect::MakeWH(fCell.width(), fCell.height());
254 r.inset(4, 4); 254 r.inset(4, 4);
255 canvas->clipRect(r); 255 canvas->clipRect(r);
256 this->drawHere(canvas, SkPaint::FilterLevel(index), trans[0], tr ans[1]); 256 this->drawHere(canvas, SkFilterQuality(index), trans[0], trans[1 ]);
257 } 257 }
258 } 258 }
259 259
260 this->drawBorders(canvas); 260 this->drawBorders(canvas);
261 261
262 const SkScalar textX = fCell.width() * 2 + 30; 262 const SkScalar textX = fCell.width() * 2 + 30;
263 263
264 SkPaint paint; 264 SkPaint paint;
265 paint.setAntiAlias(true); 265 paint.setAntiAlias(true);
266 paint.setTextSize(36); 266 paint.setTextSize(36);
(...skipping 20 matching lines...) Expand all
287 } 287 }
288 288
289 private: 289 private:
290 typedef SampleView INHERITED; 290 typedef SampleView INHERITED;
291 }; 291 };
292 292
293 ////////////////////////////////////////////////////////////////////////////// 293 //////////////////////////////////////////////////////////////////////////////
294 294
295 static SkView* MyFactory() { return new FilterQualityView; } 295 static SkView* MyFactory() { return new FilterQualityView; }
296 static SkViewRegister reg(MyFactory); 296 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleFilterFuzz.cpp ('k') | samplecode/SampleIdentityScale.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698