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

Side by Side Diff: gm/filterindiabox.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/filterfastbounds.cpp ('k') | gm/giantbitmap.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 "SkBitmapProcState.h" 11 #include "SkBitmapProcState.h"
12 #include "SkBitmapScaler.h" 12 #include "SkBitmapScaler.h"
13 #include "SkGradientShader.h" 13 #include "SkGradientShader.h"
14 #include "SkImageDecoder.h" 14 #include "SkImageDecoder.h"
15 #include "SkImageEncoder.h" 15 #include "SkImageEncoder.h"
16 #include "SkStream.h" 16 #include "SkStream.h"
17 #include "SkTypeface.h" 17 #include "SkTypeface.h"
18 18
19 static SkSize computeSize(const SkBitmap& bm, const SkMatrix& mat) { 19 static SkSize computeSize(const SkBitmap& bm, const SkMatrix& mat) {
20 SkRect bounds = SkRect::MakeWH(SkIntToScalar(bm.width()), 20 SkRect bounds = SkRect::MakeWH(SkIntToScalar(bm.width()),
21 SkIntToScalar(bm.height())); 21 SkIntToScalar(bm.height()));
22 mat.mapRect(&bounds); 22 mat.mapRect(&bounds);
23 return SkSize::Make(bounds.width(), bounds.height()); 23 return SkSize::Make(bounds.width(), bounds.height());
24 } 24 }
25 25
26 static void draw_cell(SkCanvas* canvas, const SkBitmap& bm, const SkMatrix& mat, SkScalar dx, 26 static void draw_cell(SkCanvas* canvas, const SkBitmap& bm, const SkMatrix& mat, SkScalar dx,
27 SkPaint::FilterLevel lvl) { 27 SkFilterQuality lvl) {
28 SkPaint paint; 28 SkPaint paint;
29 paint.setFilterLevel(lvl); 29 paint.setFilterQuality(lvl);
30 30
31 SkAutoCanvasRestore acr(canvas, true); 31 SkAutoCanvasRestore acr(canvas, true);
32 32
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 FilterIndiaBoxGM : public skiagm::GM { 45 class FilterIndiaBoxGM : public skiagm::GM {
46 void onOnceBeforeDraw() SK_OVERRIDE { 46 void onOnceBeforeDraw() SK_OVERRIDE {
47 this->makeBitmap(); 47 this->makeBitmap();
48 48
49 SkScalar cx = SkScalarHalf(fBM.width()); 49 SkScalar cx = SkScalarHalf(fBM.width());
50 SkScalar cy = SkScalarHalf(fBM.height()); 50 SkScalar cy = SkScalarHalf(fBM.height());
51 51
52 float vertScale = 30.0f/55.0f; 52 float vertScale = 30.0f/55.0f;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 fSize = fBM.height(); 116 fSize = fBM.height();
117 } 117 }
118 private: 118 private:
119 typedef skiagm::GM INHERITED; 119 typedef skiagm::GM INHERITED;
120 }; 120 };
121 121
122 ////////////////////////////////////////////////////////////////////////////// 122 //////////////////////////////////////////////////////////////////////////////
123 123
124 124
125 DEF_GM( return new FilterIndiaBoxGM("box.gif"); ) 125 DEF_GM( return new FilterIndiaBoxGM("box.gif"); )
OLDNEW
« no previous file with comments | « gm/filterfastbounds.cpp ('k') | gm/giantbitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698