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 "SkBlurMask.h" | 9 #include "SkBlurMask.h" |
10 #include "SkBlurMaskFilter.h" | 10 #include "SkBlurMaskFilter.h" |
11 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
12 | 12 |
13 #if SK_SUPPORT_GPU | 13 #if SK_SUPPORT_GPU |
14 #include "GrContext.h" | 14 #include "GrContext.h" |
15 #endif | 15 #endif |
16 | 16 |
17 // Create a black&white checked texture with a 1-pixel red ring | 17 // Create a black&white checked texture with 2 1-pixel rings |
18 // around the outside edge | 18 // around the outside edge. The inner ring is red and the outer ring is blue. |
19 static void make_red_ringed_bitmap(SkBitmap* result, int width, int height) { | 19 static void make_ringed_bitmap(SkBitmap* result, int width, int height) { |
20 SkASSERT(0 == width % 2 && 0 == width % 2); | 20 SkASSERT(0 == width % 2 && 0 == height % 2); |
| 21 |
| 22 static const SkPMColor kRed = SkPreMultiplyColor(SK_ColorRED); |
| 23 static const SkPMColor kBlue = SkPreMultiplyColor(SK_ColorBLUE); |
| 24 static const SkPMColor kBlack = SkPreMultiplyColor(SK_ColorBLACK); |
| 25 static const SkPMColor kWhite = SkPreMultiplyColor(SK_ColorWHITE); |
21 | 26 |
22 result->setConfig(SkBitmap::kARGB_8888_Config, width, height, 0, | 27 result->setConfig(SkBitmap::kARGB_8888_Config, width, height, 0, |
23 kOpaque_SkAlphaType); | 28 kOpaque_SkAlphaType); |
24 result->allocPixels(); | 29 result->allocPixels(); |
25 SkAutoLockPixels lock(*result); | 30 SkAutoLockPixels lock(*result); |
26 | 31 |
27 SkPMColor* scanline = result->getAddr32(0, 0); | 32 SkPMColor* scanline = result->getAddr32(0, 0); |
28 for (int x = 0; x < width; ++x) { | 33 for (int x = 0; x < width; ++x) { |
29 scanline[x] = SK_ColorRED; | 34 scanline[x] = kBlue; |
| 35 } |
| 36 scanline = result->getAddr32(0, 1); |
| 37 scanline[0] = kBlue; |
| 38 for (int x = 1; x < width - 1; ++x) { |
| 39 scanline[x] = kRed; |
| 40 } |
| 41 scanline[width-1] = kBlue; |
| 42 |
| 43 for (int y = 2; y < height/2; ++y) { |
| 44 scanline = result->getAddr32(0, y); |
| 45 scanline[0] = kBlue; |
| 46 scanline[1] = kRed; |
| 47 for (int x = 2; x < width/2; ++x) { |
| 48 scanline[x] = kBlack; |
| 49 } |
| 50 for (int x = width/2; x < width-2; ++x) { |
| 51 scanline[x] = kWhite; |
| 52 } |
| 53 scanline[width-2] = kRed; |
| 54 scanline[width-1] = kBlue; |
30 } | 55 } |
31 | 56 |
32 for (int y = 1; y < height/2; ++y) { | 57 for (int y = height/2; y < height-2; ++y) { |
33 scanline = result->getAddr32(0, y); | 58 scanline = result->getAddr32(0, y); |
34 scanline[0] = SK_ColorRED; | 59 scanline[0] = kBlue; |
35 for (int x = 1; x < width/2; ++x) { | 60 scanline[1] = kRed; |
36 scanline[x] = SK_ColorBLACK; | 61 for (int x = 2; x < width/2; ++x) { |
| 62 scanline[x] = kWhite; |
37 } | 63 } |
38 for (int x = width/2; x < width-1; ++x) { | 64 for (int x = width/2; x < width-2; ++x) { |
39 scanline[x] = SK_ColorWHITE; | 65 scanline[x] = kBlack; |
40 } | 66 } |
41 scanline[width-1] = SK_ColorRED; | 67 scanline[width-2] = kRed; |
| 68 scanline[width-1] = kBlue; |
42 } | 69 } |
43 | 70 |
44 for (int y = height/2; y < height-1; ++y) { | 71 scanline = result->getAddr32(0, height-2); |
45 scanline = result->getAddr32(0, y); | 72 scanline[0] = kBlue; |
46 scanline[0] = SK_ColorRED; | 73 for (int x = 1; x < width - 1; ++x) { |
47 for (int x = 1; x < width/2; ++x) { | 74 scanline[x] = kRed; |
48 scanline[x] = SK_ColorWHITE; | |
49 } | |
50 for (int x = width/2; x < width-1; ++x) { | |
51 scanline[x] = SK_ColorBLACK; | |
52 } | |
53 scanline[width-1] = SK_ColorRED; | |
54 } | 75 } |
| 76 scanline[width-1] = kBlue; |
55 | 77 |
56 scanline = result->getAddr32(0, height-1); | 78 scanline = result->getAddr32(0, height-1); |
57 for (int x = 0; x < width; ++x) { | 79 for (int x = 0; x < width; ++x) { |
58 scanline[x] = SK_ColorRED; | 80 scanline[x] = kBlue; |
59 } | 81 } |
60 result->setImmutable(); | 82 result->setImmutable(); |
61 } | 83 } |
62 | 84 |
63 // This GM exercises the drawBitmapRectToRect "bleed" flag | 85 // This GM exercises the drawBitmapRectToRect "bleed" flag |
64 class BleedGM : public skiagm::GM { | 86 class BleedGM : public skiagm::GM { |
65 public: | 87 public: |
66 BleedGM() {} | 88 BleedGM() {} |
67 | 89 |
68 protected: | 90 protected: |
69 virtual SkString onShortName() SK_OVERRIDE { | 91 virtual SkString onShortName() SK_OVERRIDE { |
70 return SkString("bleed"); | 92 return SkString("bleed"); |
71 } | 93 } |
72 | 94 |
73 virtual SkISize onISize() SK_OVERRIDE { | 95 virtual SkISize onISize() SK_OVERRIDE { |
74 return SkISize::Make(kWidth, kHeight); | 96 return SkISize::Make(kWidth, kHeight); |
75 } | 97 } |
76 | 98 |
77 virtual void onOnceBeforeDraw() SK_OVERRIDE { | 99 virtual void onOnceBeforeDraw() SK_OVERRIDE { |
78 make_red_ringed_bitmap(&fBitmapSmall, kSmallTextureSize, kSmallTextureSi
ze); | 100 make_ringed_bitmap(&fBitmapSmall, kSmallTextureSize, kSmallTextureSize); |
79 | 101 |
80 // To exercise the GPU's tiling path we need a texture | 102 // To exercise the GPU's tiling path we need a texture |
81 // too big for the GPU to handle in one go | 103 // too big for the GPU to handle in one go |
82 make_red_ringed_bitmap(&fBitmapBig, 2*kMaxTextureSize, 2*kMaxTextureSize
); | 104 make_ringed_bitmap(&fBitmapBig, 2*kMaxTextureSize, 2*kMaxTextureSize); |
83 } | 105 } |
84 | 106 |
85 // Draw only the center of the small bitmap | 107 // Draw only the center of the small bitmap |
86 void drawCase1(SkCanvas* canvas, int transX, int transY, | 108 void drawCase1(SkCanvas* canvas, int transX, int transY, |
87 SkCanvas::DrawBitmapRectFlags flags, bool filter) { | 109 SkCanvas::DrawBitmapRectFlags flags, SkPaint::FilterLevel fil
ter) { |
88 SkRect src = SkRect::MakeXYWH(1, 1, | 110 SkRect src = SkRect::MakeXYWH(2, 2, |
89 kSmallTextureSize-2, | 111 kSmallTextureSize-4, |
90 kSmallTextureSize-2); | 112 kSmallTextureSize-4); |
91 SkRect dst = SkRect::MakeXYWH(0, 0, SkIntToScalar(kBlockSize), SkIntToSc
alar(kBlockSize)); | 113 SkRect dst = SkRect::MakeXYWH(0, 0, SkIntToScalar(kBlockSize), SkIntToSc
alar(kBlockSize)); |
92 | 114 |
93 SkPaint paint; | 115 SkPaint paint; |
94 paint.setFilterLevel(filter ? SkPaint::kLow_FilterLevel : SkPaint::kNone
_FilterLevel); | 116 paint.setFilterLevel(filter); |
95 | 117 |
96 canvas->save(); | 118 canvas->save(); |
97 canvas->translate(SkIntToScalar(transX), SkIntToScalar(transY)); | 119 canvas->translate(SkIntToScalar(transX), SkIntToScalar(transY)); |
98 canvas->drawBitmapRectToRect(fBitmapSmall, &src, dst, &paint, flags); | 120 canvas->drawBitmapRectToRect(fBitmapSmall, &src, dst, &paint, flags); |
99 canvas->restore(); | 121 canvas->restore(); |
100 } | 122 } |
101 | 123 |
102 // Draw almost all of the large bitmap | 124 // Draw almost all of the large bitmap |
103 void drawCase2(SkCanvas* canvas, int transX, int transY, | 125 void drawCase2(SkCanvas* canvas, int transX, int transY, |
104 SkCanvas::DrawBitmapRectFlags flags, bool filter) { | 126 SkCanvas::DrawBitmapRectFlags flags, SkPaint::FilterLevel fil
ter) { |
105 SkRect src = SkRect::MakeXYWH(1, 1, | 127 SkRect src = SkRect::MakeXYWH(2, 2, |
106 SkIntToScalar(fBitmapBig.width()-2), | 128 SkIntToScalar(fBitmapBig.width()-4), |
107 SkIntToScalar(fBitmapBig.height()-2)); | 129 SkIntToScalar(fBitmapBig.height()-4)); |
108 SkRect dst = SkRect::MakeXYWH(0, 0, SkIntToScalar(kBlockSize), SkIntToSc
alar(kBlockSize)); | 130 SkRect dst = SkRect::MakeXYWH(0, 0, SkIntToScalar(kBlockSize), SkIntToSc
alar(kBlockSize)); |
109 | 131 |
110 SkPaint paint; | 132 SkPaint paint; |
111 paint.setFilterLevel(filter ? SkPaint::kLow_FilterLevel : SkPaint::kNone
_FilterLevel); | 133 paint.setFilterLevel(filter); |
112 | 134 |
113 canvas->save(); | 135 canvas->save(); |
114 canvas->translate(SkIntToScalar(transX), SkIntToScalar(transY)); | 136 canvas->translate(SkIntToScalar(transX), SkIntToScalar(transY)); |
115 canvas->drawBitmapRectToRect(fBitmapBig, &src, dst, &paint, flags); | 137 canvas->drawBitmapRectToRect(fBitmapBig, &src, dst, &paint, flags); |
116 canvas->restore(); | 138 canvas->restore(); |
117 } | 139 } |
118 | 140 |
119 // Draw ~1/4 of the large bitmap | 141 // Draw ~1/4 of the large bitmap |
120 void drawCase3(SkCanvas* canvas, int transX, int transY, | 142 void drawCase3(SkCanvas* canvas, int transX, int transY, |
121 SkCanvas::DrawBitmapRectFlags flags, bool filter) { | 143 SkCanvas::DrawBitmapRectFlags flags, SkPaint::FilterLevel fil
ter) { |
122 SkRect src = SkRect::MakeXYWH(1, 1, | 144 SkRect src = SkRect::MakeXYWH(2, 2, |
123 SkIntToScalar(fBitmapBig.width()/2-1), | 145 SkIntToScalar(fBitmapBig.width()/2-2), |
124 SkIntToScalar(fBitmapBig.height()/2-1)); | 146 SkIntToScalar(fBitmapBig.height()/2-2)); |
125 SkRect dst = SkRect::MakeXYWH(0, 0, SkIntToScalar(kBlockSize), SkIntToSc
alar(kBlockSize)); | 147 SkRect dst = SkRect::MakeXYWH(0, 0, SkIntToScalar(kBlockSize), SkIntToSc
alar(kBlockSize)); |
126 | 148 |
127 SkPaint paint; | 149 SkPaint paint; |
128 paint.setFilterLevel(filter ? SkPaint::kLow_FilterLevel : SkPaint::kNone
_FilterLevel); | 150 paint.setFilterLevel(filter); |
129 | 151 |
130 canvas->save(); | 152 canvas->save(); |
131 canvas->translate(SkIntToScalar(transX), SkIntToScalar(transY)); | 153 canvas->translate(SkIntToScalar(transX), SkIntToScalar(transY)); |
132 canvas->drawBitmapRectToRect(fBitmapBig, &src, dst, &paint, flags); | 154 canvas->drawBitmapRectToRect(fBitmapBig, &src, dst, &paint, flags); |
133 canvas->restore(); | 155 canvas->restore(); |
134 } | 156 } |
135 | 157 |
136 // Draw the center of the small bitmap with a mask filter | 158 // Draw the center of the small bitmap with a mask filter |
137 void drawCase4(SkCanvas* canvas, int transX, int transY, | 159 void drawCase4(SkCanvas* canvas, int transX, int transY, |
138 SkCanvas::DrawBitmapRectFlags flags, bool filter) { | 160 SkCanvas::DrawBitmapRectFlags flags, SkPaint::FilterLevel fil
ter) { |
139 SkRect src = SkRect::MakeXYWH(1, 1, | 161 SkRect src = SkRect::MakeXYWH(2, 2, |
140 kSmallTextureSize-2, | 162 kSmallTextureSize-4, |
141 kSmallTextureSize-2); | 163 kSmallTextureSize-4); |
142 SkRect dst = SkRect::MakeXYWH(0, 0, SkIntToScalar(kBlockSize), SkIntToSc
alar(kBlockSize)); | 164 SkRect dst = SkRect::MakeXYWH(0, 0, SkIntToScalar(kBlockSize), SkIntToSc
alar(kBlockSize)); |
143 | 165 |
144 SkPaint paint; | 166 SkPaint paint; |
145 paint.setFilterLevel(filter ? SkPaint::kLow_FilterLevel : SkPaint::kNone
_FilterLevel); | 167 paint.setFilterLevel(filter); |
146 SkMaskFilter* mf = SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_Bl
urStyle, | 168 SkMaskFilter* mf = SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_Bl
urStyle, |
147 SkBlurMask::ConvertRadiusToSigma(SkIntT
oScalar(3))); | 169 SkBlurMask::ConvertRadiusToSigma(SkIntT
oScalar(3))); |
148 paint.setMaskFilter(mf)->unref(); | 170 paint.setMaskFilter(mf)->unref(); |
149 | 171 |
150 canvas->save(); | 172 canvas->save(); |
151 canvas->translate(SkIntToScalar(transX), SkIntToScalar(transY)); | 173 canvas->translate(SkIntToScalar(transX), SkIntToScalar(transY)); |
152 canvas->drawBitmapRectToRect(fBitmapSmall, &src, dst, &paint, flags); | 174 canvas->drawBitmapRectToRect(fBitmapSmall, &src, dst, &paint, flags); |
153 canvas->restore(); | 175 canvas->restore(); |
154 } | 176 } |
155 | 177 |
156 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 178 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
157 | 179 |
158 canvas->clear(SK_ColorGRAY); | 180 canvas->clear(SK_ColorGRAY); |
159 | 181 |
| 182 // Currently there are no test cases with medium filtering since medium
uses mip-mapping and |
| 183 // these draws are always upscaling. |
| 184 |
160 // First draw a column with no bleeding, tiling, or filtering | 185 // First draw a column with no bleeding, tiling, or filtering |
161 this->drawCase1(canvas, kCol0X, kRow0Y, SkCanvas::kNone_DrawBitmapRectFl
ag, false); | 186 this->drawCase1(canvas, kCol0X, kRow0Y, SkCanvas::kNone_DrawBitmapRectFl
ag, SkPaint::kNone_FilterLevel); |
162 this->drawCase2(canvas, kCol0X, kRow1Y, SkCanvas::kNone_DrawBitmapRectFl
ag, false); | 187 this->drawCase2(canvas, kCol0X, kRow1Y, SkCanvas::kNone_DrawBitmapRectFl
ag, SkPaint::kNone_FilterLevel); |
163 this->drawCase3(canvas, kCol0X, kRow2Y, SkCanvas::kNone_DrawBitmapRectFl
ag, false); | 188 this->drawCase3(canvas, kCol0X, kRow2Y, SkCanvas::kNone_DrawBitmapRectFl
ag, SkPaint::kNone_FilterLevel); |
164 this->drawCase4(canvas, kCol0X, kRow3Y, SkCanvas::kNone_DrawBitmapRectFl
ag, false); | 189 this->drawCase4(canvas, kCol0X, kRow3Y, SkCanvas::kNone_DrawBitmapRectFl
ag, SkPaint::kNone_FilterLevel); |
165 | 190 |
166 // Then draw a column with no bleeding or tiling but with filtering | 191 // Then draw a column with no bleeding or tiling but with low filtering |
167 this->drawCase1(canvas, kCol1X, kRow0Y, SkCanvas::kNone_DrawBitmapRectFl
ag, true); | 192 this->drawCase1(canvas, kCol1X, kRow0Y, SkCanvas::kNone_DrawBitmapRectFl
ag, SkPaint::kLow_FilterLevel); |
168 this->drawCase2(canvas, kCol1X, kRow1Y, SkCanvas::kNone_DrawBitmapRectFl
ag, true); | 193 this->drawCase2(canvas, kCol1X, kRow1Y, SkCanvas::kNone_DrawBitmapRectFl
ag, SkPaint::kLow_FilterLevel); |
169 this->drawCase3(canvas, kCol1X, kRow2Y, SkCanvas::kNone_DrawBitmapRectFl
ag, true); | 194 this->drawCase3(canvas, kCol1X, kRow2Y, SkCanvas::kNone_DrawBitmapRectFl
ag, SkPaint::kLow_FilterLevel); |
170 this->drawCase4(canvas, kCol1X, kRow3Y, SkCanvas::kNone_DrawBitmapRectFl
ag, true); | 195 this->drawCase4(canvas, kCol1X, kRow3Y, SkCanvas::kNone_DrawBitmapRectFl
ag, SkPaint::kLow_FilterLevel); |
171 | 196 |
172 | 197 // Then draw a column with no bleeding or tiling but with high filtering |
| 198 this->drawCase1(canvas, kCol2X, kRow0Y, SkCanvas::kNone_DrawBitmapRectFl
ag, SkPaint::kHigh_FilterLevel); |
| 199 this->drawCase2(canvas, kCol2X, kRow1Y, SkCanvas::kNone_DrawBitmapRectFl
ag, SkPaint::kHigh_FilterLevel); |
| 200 this->drawCase3(canvas, kCol2X, kRow2Y, SkCanvas::kNone_DrawBitmapRectFl
ag, SkPaint::kHigh_FilterLevel); |
| 201 this->drawCase4(canvas, kCol2X, kRow3Y, SkCanvas::kNone_DrawBitmapRectFl
ag, SkPaint::kHigh_FilterLevel); |
| 202 |
173 #if SK_SUPPORT_GPU | 203 #if SK_SUPPORT_GPU |
174 GrContext* ctx = GM::GetGr(canvas); | 204 GrContext* ctx = GM::GetGr(canvas); |
175 int oldMaxTextureSize = 0; | 205 int oldMaxTextureSize = 0; |
176 if (NULL != ctx) { | 206 if (NULL != ctx) { |
177 // shrink the max texture size so all our textures can be reasonably
sized | 207 // shrink the max texture size so all our textures can be reasonably
sized |
178 oldMaxTextureSize = ctx->getMaxTextureSize(); | 208 oldMaxTextureSize = ctx->getMaxTextureSize(); |
179 ctx->setMaxTextureSizeOverride(kMaxTextureSize); | 209 ctx->setMaxTextureSizeOverride(kMaxTextureSize); |
180 } | 210 } |
181 #endif | 211 #endif |
182 | 212 |
183 // Then draw a column with no bleeding but with tiling and filtering | 213 // Then draw a column with no bleeding but with tiling and low filtering |
184 this->drawCase1(canvas, kCol2X, kRow0Y, SkCanvas::kNone_DrawBitmapRectFl
ag, true); | 214 this->drawCase1(canvas, kCol3X, kRow0Y, SkCanvas::kNone_DrawBitmapRectFl
ag, SkPaint::kLow_FilterLevel); |
185 this->drawCase2(canvas, kCol2X, kRow1Y, SkCanvas::kNone_DrawBitmapRectFl
ag, true); | 215 this->drawCase2(canvas, kCol3X, kRow1Y, SkCanvas::kNone_DrawBitmapRectFl
ag, SkPaint::kLow_FilterLevel); |
186 this->drawCase3(canvas, kCol2X, kRow2Y, SkCanvas::kNone_DrawBitmapRectFl
ag, true); | 216 this->drawCase3(canvas, kCol3X, kRow2Y, SkCanvas::kNone_DrawBitmapRectFl
ag, SkPaint::kLow_FilterLevel); |
187 this->drawCase4(canvas, kCol2X, kRow3Y, SkCanvas::kNone_DrawBitmapRectFl
ag, true); | 217 this->drawCase4(canvas, kCol3X, kRow3Y, SkCanvas::kNone_DrawBitmapRectFl
ag, SkPaint::kLow_FilterLevel); |
188 | 218 |
189 // Finally draw a column with all three (bleeding, tiling, and filtering
) | 219 // Then draw a column with no bleeding but with tiling and high filterin
g |
190 this->drawCase1(canvas, kCol3X, kRow0Y, SkCanvas::kBleed_DrawBitmapRectF
lag, true); | 220 this->drawCase1(canvas, kCol4X, kRow0Y, SkCanvas::kNone_DrawBitmapRectFl
ag, SkPaint::kHigh_FilterLevel); |
191 this->drawCase2(canvas, kCol3X, kRow1Y, SkCanvas::kBleed_DrawBitmapRectF
lag, true); | 221 this->drawCase2(canvas, kCol4X, kRow1Y, SkCanvas::kNone_DrawBitmapRectFl
ag, SkPaint::kHigh_FilterLevel); |
192 this->drawCase3(canvas, kCol3X, kRow2Y, SkCanvas::kBleed_DrawBitmapRectF
lag, true); | 222 this->drawCase3(canvas, kCol4X, kRow2Y, SkCanvas::kNone_DrawBitmapRectFl
ag, SkPaint::kHigh_FilterLevel); |
193 this->drawCase4(canvas, kCol3X, kRow3Y, SkCanvas::kBleed_DrawBitmapRectF
lag, true); | 223 this->drawCase4(canvas, kCol4X, kRow3Y, SkCanvas::kNone_DrawBitmapRectFl
ag, SkPaint::kHigh_FilterLevel); |
| 224 |
| 225 // Then draw a column with bleeding, tiling, and low filtering |
| 226 this->drawCase1(canvas, kCol5X, kRow0Y, SkCanvas::kBleed_DrawBitmapRectF
lag, SkPaint::kLow_FilterLevel); |
| 227 this->drawCase2(canvas, kCol5X, kRow1Y, SkCanvas::kBleed_DrawBitmapRectF
lag, SkPaint::kLow_FilterLevel); |
| 228 this->drawCase3(canvas, kCol5X, kRow2Y, SkCanvas::kBleed_DrawBitmapRectF
lag, SkPaint::kLow_FilterLevel); |
| 229 this->drawCase4(canvas, kCol5X, kRow3Y, SkCanvas::kBleed_DrawBitmapRectF
lag, SkPaint::kLow_FilterLevel); |
| 230 |
| 231 // Finally draw a column with bleeding, tiling, and high filtering |
| 232 this->drawCase1(canvas, kCol6X, kRow0Y, SkCanvas::kBleed_DrawBitmapRectF
lag, SkPaint::kHigh_FilterLevel); |
| 233 this->drawCase2(canvas, kCol6X, kRow1Y, SkCanvas::kBleed_DrawBitmapRectF
lag, SkPaint::kHigh_FilterLevel); |
| 234 this->drawCase3(canvas, kCol6X, kRow2Y, SkCanvas::kBleed_DrawBitmapRectF
lag, SkPaint::kHigh_FilterLevel); |
| 235 this->drawCase4(canvas, kCol6X, kRow3Y, SkCanvas::kBleed_DrawBitmapRectF
lag, SkPaint::kHigh_FilterLevel); |
194 | 236 |
195 #if SK_SUPPORT_GPU | 237 #if SK_SUPPORT_GPU |
196 if (NULL != ctx) { | 238 if (NULL != ctx) { |
197 ctx->setMaxTextureSizeOverride(oldMaxTextureSize); | 239 ctx->setMaxTextureSizeOverride(oldMaxTextureSize); |
198 } | 240 } |
199 #endif | 241 #endif |
200 } | 242 } |
201 | 243 |
202 private: | 244 private: |
203 static const int kBlockSize = 90; | 245 static const int kBlockSize = 70; |
204 static const int kBlockSpacing = 10; | 246 static const int kBlockSpacing = 5; |
205 | 247 |
206 static const int kCol0X = kBlockSpacing; | 248 static const int kCol0X = kBlockSpacing; |
207 static const int kCol1X = 2*kBlockSpacing + kBlockSize; | 249 static const int kCol1X = 2*kBlockSpacing + kBlockSize; |
208 static const int kCol2X = 3*kBlockSpacing + 2*kBlockSize; | 250 static const int kCol2X = 3*kBlockSpacing + 2*kBlockSize; |
209 static const int kCol3X = 4*kBlockSpacing + 3*kBlockSize; | 251 static const int kCol3X = 4*kBlockSpacing + 3*kBlockSize; |
210 static const int kWidth = 5*kBlockSpacing + 4*kBlockSize; | 252 static const int kCol4X = 5*kBlockSpacing + 4*kBlockSize; |
| 253 static const int kCol5X = 6*kBlockSpacing + 5*kBlockSize; |
| 254 static const int kCol6X = 7*kBlockSpacing + 6*kBlockSize; |
| 255 static const int kWidth = 8*kBlockSpacing + 7*kBlockSize; |
211 | 256 |
212 static const int kRow0Y = kBlockSpacing; | 257 static const int kRow0Y = kBlockSpacing; |
213 static const int kRow1Y = 2*kBlockSpacing + kBlockSize; | 258 static const int kRow1Y = 2*kBlockSpacing + kBlockSize; |
214 static const int kRow2Y = 3*kBlockSpacing + 2*kBlockSize; | 259 static const int kRow2Y = 3*kBlockSpacing + 2*kBlockSize; |
215 static const int kRow3Y = 4*kBlockSpacing + 3*kBlockSize; | 260 static const int kRow3Y = 4*kBlockSpacing + 3*kBlockSize; |
216 static const int kHeight = 5*kBlockSpacing + 4*kBlockSize; | 261 static const int kHeight = 5*kBlockSpacing + 4*kBlockSize; |
217 | 262 |
218 static const int kSmallTextureSize = 4; | 263 static const int kSmallTextureSize = 6; |
219 static const int kMaxTextureSize = 32; | 264 static const int kMaxTextureSize = 32; |
220 | 265 |
221 SkBitmap fBitmapSmall; | 266 SkBitmap fBitmapSmall; |
222 SkBitmap fBitmapBig; | 267 SkBitmap fBitmapBig; |
223 | 268 |
224 typedef GM INHERITED; | 269 typedef GM INHERITED; |
225 }; | 270 }; |
226 | 271 |
227 DEF_GM( return new BleedGM(); ) | 272 DEF_GM( return new BleedGM(); ) |
OLD | NEW |