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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 paint.setFlags( paint.getFlags() | SkPaint::kHighQualityFilterBitmap
_Flag ); | 68 paint.setFlags( paint.getFlags() | SkPaint::kHighQualityFilterBitmap
_Flag ); |
69 | 69 |
70 canvas->save(); | 70 canvas->save(); |
71 canvas->translate( (SkScalar) curX, 0.f ); | 71 canvas->translate( (SkScalar) curX, 0.f ); |
72 canvas->drawBitmapMatrix( fBM, matrix, &paint ); | 72 canvas->drawBitmapMatrix( fBM, matrix, &paint ); |
73 canvas->restore(); | 73 canvas->restore(); |
74 | 74 |
75 curWidth = (int) (fBM.width() * curScale + 2); | 75 curWidth = (int) (fBM.width() * curScale + 2); |
76 curX += curWidth; | 76 curX += curWidth; |
77 curScale *= 0.75f; | 77 curScale *= 0.75f; |
78 } while (curX < 4*fBM.width()); | 78 } while (curWidth >= 2 && curX < 4*fBM.width()); |
79 } | 79 } |
80 | 80 |
81 private: | 81 private: |
82 typedef skiagm::GM INHERITED; | 82 typedef skiagm::GM INHERITED; |
83 }; | 83 }; |
84 | 84 |
85 class DownsampleBitmapTextGM: public DownsampleBitmapGM { | 85 class DownsampleBitmapTextGM: public DownsampleBitmapGM { |
86 public: | 86 public: |
87 DownsampleBitmapTextGM(float textSize) | 87 DownsampleBitmapTextGM(float textSize) |
88 : fTextSize(textSize) | 88 : fTextSize(textSize) |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 } | 192 } |
193 private: | 193 private: |
194 typedef DownsampleBitmapGM INHERITED; | 194 typedef DownsampleBitmapGM INHERITED; |
195 }; | 195 }; |
196 | 196 |
197 ////////////////////////////////////////////////////////////////////////////// | 197 ////////////////////////////////////////////////////////////////////////////// |
198 | 198 |
199 DEF_GM( return new DownsampleBitmapTextGM(72); ) | 199 DEF_GM( return new DownsampleBitmapTextGM(72); ) |
200 DEF_GM( return new DownsampleBitmapCheckerboardGM(512,256); ) | 200 DEF_GM( return new DownsampleBitmapCheckerboardGM(512,256); ) |
201 DEF_GM( return new DownsampleBitmapImageGM("mandrill_512.png"); ) | 201 DEF_GM( return new DownsampleBitmapImageGM("mandrill_512.png"); ) |
OLD | NEW |