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

Side by Side Diff: samplecode/SampleFilter2.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/SampleFilter.cpp ('k') | samplecode/SampleFilterFuzz.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 "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 canvas->translate(SkIntToScalar(10), SkIntToScalar(50)); 67 canvas->translate(SkIntToScalar(10), SkIntToScalar(50));
68 68
69 const SkScalar W = SkIntToScalar(fBitmaps[0].width() + 1); 69 const SkScalar W = SkIntToScalar(fBitmaps[0].width() + 1);
70 const SkScalar H = SkIntToScalar(fBitmaps[0].height() + 1); 70 const SkScalar H = SkIntToScalar(fBitmaps[0].height() + 1);
71 SkPaint paint; 71 SkPaint paint;
72 72
73 const SkScalar scale = 0.897917f; 73 const SkScalar scale = 0.897917f;
74 canvas->scale(SK_Scalar1, scale); 74 canvas->scale(SK_Scalar1, scale);
75 75
76 for (int k = 0; k < 2; k++) { 76 for (int k = 0; k < 2; k++) {
77 paint.setFilterLevel(k == 1 ? SkPaint::kLow_FilterLevel : SkPaint::k None_FilterLevel); 77 paint.setFilterQuality(k == 1 ? kLow_SkFilterQuality : kNone_SkFilte rQuality);
78 for (int j = 0; j < 2; j++) { 78 for (int j = 0; j < 2; j++) {
79 paint.setDither(j == 1); 79 paint.setDither(j == 1);
80 for (int i = 0; i < fBitmapCount; i++) { 80 for (int i = 0; i < fBitmapCount; i++) {
81 SkScalar x = (k * fBitmapCount + j) * W; 81 SkScalar x = (k * fBitmapCount + j) * W;
82 SkScalar y = i * H; 82 SkScalar y = i * H;
83 x = SkScalarRoundToScalar(x); 83 x = SkScalarRoundToScalar(x);
84 y = SkScalarRoundToScalar(y); 84 y = SkScalarRoundToScalar(y);
85 canvas->drawBitmap(fBitmaps[i], x, y, &paint); 85 canvas->drawBitmap(fBitmaps[i], x, y, &paint);
86 if (i == 0) { 86 if (i == 0) {
87 SkPaint p; 87 SkPaint p;
88 p.setAntiAlias(true); 88 p.setAntiAlias(true);
89 p.setTextAlign(SkPaint::kCenter_Align); 89 p.setTextAlign(SkPaint::kCenter_Align);
90 p.setTextSize(SkIntToScalar(18)); 90 p.setTextSize(SkIntToScalar(18));
91 SkString s("dither="); 91 SkString s("dither=");
92 s.appendS32(paint.isDither()); 92 s.appendS32(paint.isDither());
93 s.append(" filter="); 93 s.append(" filter=");
94 s.appendS32(paint.getFilterLevel() != SkPaint::kNone_Fil terLevel); 94 s.appendS32(paint.getFilterQuality() != kNone_SkFilterQu ality);
95 canvas->drawText(s.c_str(), s.size(), x + W/2, 95 canvas->drawText(s.c_str(), s.size(), x + W/2,
96 y - p.getTextSize(), p); 96 y - p.getTextSize(), p);
97 } 97 }
98 if (k+j == 2) { 98 if (k+j == 2) {
99 SkPaint p; 99 SkPaint p;
100 p.setAntiAlias(true); 100 p.setAntiAlias(true);
101 p.setTextSize(SkIntToScalar(18)); 101 p.setTextSize(SkIntToScalar(18));
102 SkString s; 102 SkString s;
103 s.append(" depth="); 103 s.append(" depth=");
104 s.appendS32(fBitmaps[i].colorType() == kRGB_565_SkColorT ype ? 16 : 32); 104 s.appendS32(fBitmaps[i].colorType() == kRGB_565_SkColorT ype ? 16 : 32);
105 canvas->drawText(s.c_str(), s.size(), x + W + SkIntToSca lar(4), 105 canvas->drawText(s.c_str(), s.size(), x + W + SkIntToSca lar(4),
106 y + H/2, p); 106 y + H/2, p);
107 } 107 }
108 } 108 }
109 } 109 }
110 } 110 }
111 } 111 }
112 112
113 private: 113 private:
114 typedef SampleView INHERITED; 114 typedef SampleView INHERITED;
115 }; 115 };
116 116
117 ////////////////////////////////////////////////////////////////////////////// 117 //////////////////////////////////////////////////////////////////////////////
118 118
119 static SkView* MyFactory() { return new Filter2View; } 119 static SkView* MyFactory() { return new Filter2View; }
120 static SkViewRegister reg(MyFactory); 120 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleFilter.cpp ('k') | samplecode/SampleFilterFuzz.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698