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

Side by Side Diff: gm/downsamplebitmap.cpp

Issue 19825002: stop using bitmap-filter flags outside of paint itself, as a step towards really changing them into… (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 5 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 | « bench/BitmapScaleBench.cpp ('k') | gm/filterbitmap.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 2013 Google Inc. 2 * Copyright 2013 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 #include "SkGradientShader.h" 9 #include "SkGradientShader.h"
10 10
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 int curX = 0; 58 int curX = 0;
59 int curWidth; 59 int curWidth;
60 float curScale = 1; 60 float curScale = 1;
61 do { 61 do {
62 62
63 SkMatrix matrix; 63 SkMatrix matrix;
64 matrix.setScale( curScale, curScale ); 64 matrix.setScale( curScale, curScale );
65 65
66 SkPaint paint; 66 SkPaint paint;
67 paint.setFilterBitmap(true); 67 paint.setFilterLevel(SkPaint::kHigh_FilterLevel);
68 paint.setFlags( paint.getFlags() | SkPaint::kHighQualityFilterBitmap _Flag );
69 68
70 canvas->save(); 69 canvas->save();
71 canvas->translate( (SkScalar) curX, 0.f ); 70 canvas->translate( (SkScalar) curX, 0.f );
72 canvas->drawBitmapMatrix( fBM, matrix, &paint ); 71 canvas->drawBitmapMatrix( fBM, matrix, &paint );
73 canvas->restore(); 72 canvas->restore();
74 73
75 curWidth = (int) (fBM.width() * curScale + 2); 74 curWidth = (int) (fBM.width() * curScale + 2);
76 curX += curWidth; 75 curX += curWidth;
77 curScale *= 0.75f; 76 curScale *= 0.75f;
78 } while (curWidth >= 2 && curX < 4*fBM.width()); 77 } while (curWidth >= 2 && curX < 4*fBM.width());
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 } 191 }
193 private: 192 private:
194 typedef DownsampleBitmapGM INHERITED; 193 typedef DownsampleBitmapGM INHERITED;
195 }; 194 };
196 195
197 ////////////////////////////////////////////////////////////////////////////// 196 //////////////////////////////////////////////////////////////////////////////
198 197
199 DEF_GM( return new DownsampleBitmapTextGM(72); ) 198 DEF_GM( return new DownsampleBitmapTextGM(72); )
200 DEF_GM( return new DownsampleBitmapCheckerboardGM(512,256); ) 199 DEF_GM( return new DownsampleBitmapCheckerboardGM(512,256); )
201 DEF_GM( return new DownsampleBitmapImageGM("mandrill_512.png"); ) 200 DEF_GM( return new DownsampleBitmapImageGM("mandrill_512.png"); )
OLDNEW
« no previous file with comments | « bench/BitmapScaleBench.cpp ('k') | gm/filterbitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698