OLD | NEW |
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 Loading... |
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 Loading... |
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"); ) |
OLD | NEW |