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

Side by Side Diff: gm/filterbitmap.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 | « gm/drawbitmaprect.cpp ('k') | gm/filterfastbounds.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 "gm.h" 8 #include "gm.h"
9 9
10 #include "Resources.h" 10 #include "Resources.h"
11 #include "SkGradientShader.h" 11 #include "SkGradientShader.h"
12 #include "SkImageDecoder.h" 12 #include "SkImageDecoder.h"
13 #include "SkStream.h" 13 #include "SkStream.h"
14 #include "SkTypeface.h" 14 #include "SkTypeface.h"
15 15
16 static void setTypeface(SkPaint* paint, const char name[], SkTypeface::Style sty le) { 16 static void setTypeface(SkPaint* paint, const char name[], SkTypeface::Style sty le) {
17 sk_tool_utils::set_portable_typeface(paint, name, style); 17 sk_tool_utils::set_portable_typeface(paint, name, style);
18 } 18 }
19 19
20 static SkSize computeSize(const SkBitmap& bm, const SkMatrix& mat) { 20 static SkSize computeSize(const SkBitmap& bm, const SkMatrix& mat) {
21 SkRect bounds = SkRect::MakeWH(SkIntToScalar(bm.width()), 21 SkRect bounds = SkRect::MakeWH(SkIntToScalar(bm.width()),
22 SkIntToScalar(bm.height())); 22 SkIntToScalar(bm.height()));
23 mat.mapRect(&bounds); 23 mat.mapRect(&bounds);
24 return SkSize::Make(bounds.width(), bounds.height()); 24 return SkSize::Make(bounds.width(), bounds.height());
25 } 25 }
26 26
27 static void draw_cell(SkCanvas* canvas, const SkBitmap& bm, const SkMatrix& mat, SkScalar dx, 27 static void draw_cell(SkCanvas* canvas, const SkBitmap& bm, const SkMatrix& mat, SkScalar dx,
28 SkPaint::FilterLevel lvl) { 28 SkFilterQuality lvl) {
29 SkPaint paint; 29 SkPaint paint;
30 paint.setFilterLevel(lvl); 30 paint.setFilterQuality(lvl);
31 31
32 SkAutoCanvasRestore acr(canvas, true); 32 SkAutoCanvasRestore acr(canvas, true);
33 canvas->translate(dx, 0); 33 canvas->translate(dx, 0);
34 canvas->concat(mat); 34 canvas->concat(mat);
35 canvas->drawBitmap(bm, 0, 0, &paint); 35 canvas->drawBitmap(bm, 0, 0, &paint);
36 } 36 }
37 37
38 static void draw_row(SkCanvas* canvas, const SkBitmap& bm, const SkMatrix& mat, SkScalar dx) { 38 static void draw_row(SkCanvas* canvas, const SkBitmap& bm, const SkMatrix& mat, SkScalar dx) {
39 draw_cell(canvas, bm, mat, 0 * dx, SkPaint::kNone_FilterLevel); 39 draw_cell(canvas, bm, mat, 0 * dx, kNone_SkFilterQuality);
40 draw_cell(canvas, bm, mat, 1 * dx, SkPaint::kLow_FilterLevel); 40 draw_cell(canvas, bm, mat, 1 * dx, kLow_SkFilterQuality);
41 draw_cell(canvas, bm, mat, 2 * dx, SkPaint::kMedium_FilterLevel); 41 draw_cell(canvas, bm, mat, 2 * dx, kMedium_SkFilterQuality);
42 draw_cell(canvas, bm, mat, 3 * dx, SkPaint::kHigh_FilterLevel); 42 draw_cell(canvas, bm, mat, 3 * dx, kHigh_SkFilterQuality);
43 } 43 }
44 44
45 class FilterBitmapGM : public skiagm::GM { 45 class FilterBitmapGM : public skiagm::GM {
46 void onOnceBeforeDraw() SK_OVERRIDE { 46 void onOnceBeforeDraw() SK_OVERRIDE {
47 47
48 this->makeBitmap(); 48 this->makeBitmap();
49 49
50 SkScalar cx = SkScalarHalf(fBM.width()); 50 SkScalar cx = SkScalarHalf(fBM.width());
51 SkScalar cy = SkScalarHalf(fBM.height()); 51 SkScalar cy = SkScalarHalf(fBM.height());
52 SkScalar scale = this->getScale(); 52 SkScalar scale = this->getScale();
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 DEF_GM( return new FilterBitmapCheckerboardGM(32,8); ) 219 DEF_GM( return new FilterBitmapCheckerboardGM(32,8); )
220 DEF_GM( return new FilterBitmapCheckerboardGM(32,2); ) 220 DEF_GM( return new FilterBitmapCheckerboardGM(32,2); )
221 DEF_GM( return new FilterBitmapCheckerboardGM(192,192); ) 221 DEF_GM( return new FilterBitmapCheckerboardGM(192,192); )
222 DEF_GM( return new FilterBitmapImageGM("mandrill_16.png"); ) 222 DEF_GM( return new FilterBitmapImageGM("mandrill_16.png"); )
223 DEF_GM( return new FilterBitmapImageGM("mandrill_32.png"); ) 223 DEF_GM( return new FilterBitmapImageGM("mandrill_32.png"); )
224 DEF_GM( return new FilterBitmapImageGM("mandrill_64.png"); ) 224 DEF_GM( return new FilterBitmapImageGM("mandrill_64.png"); )
225 DEF_GM( return new FilterBitmapImageGM("mandrill_128.png"); ) 225 DEF_GM( return new FilterBitmapImageGM("mandrill_128.png"); )
226 DEF_GM( return new FilterBitmapImageGM("mandrill_256.png"); ) 226 DEF_GM( return new FilterBitmapImageGM("mandrill_256.png"); )
227 DEF_GM( return new FilterBitmapImageGM("mandrill_512.png"); ) 227 DEF_GM( return new FilterBitmapImageGM("mandrill_512.png"); )
228 DEF_GM( return new FilterBitmapImageGM("color_wheel.png"); ) 228 DEF_GM( return new FilterBitmapImageGM("color_wheel.png"); )
OLDNEW
« no previous file with comments | « gm/drawbitmaprect.cpp ('k') | gm/filterfastbounds.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698