OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "sk_tool_utils.h" | 8 #include "sk_tool_utils.h" |
9 #include "SkSurface.h" | 9 #include "SkSurface.h" |
10 #include "Resources.h" | 10 #include "Resources.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
150 canvas->drawText(text, strlen(text), 0.0f, 12.0f, p); | 150 canvas->drawText(text, strlen(text), 0.0f, 12.0f, p); |
151 } | 151 } |
152 | 152 |
153 DEF_SIMPLE_GM(all_bitmap_configs, canvas, SCALE, 6 * SCALE) { | 153 DEF_SIMPLE_GM(all_bitmap_configs, canvas, SCALE, 6 * SCALE) { |
154 SkAutoCanvasRestore autoCanvasRestore(canvas, true); | 154 SkAutoCanvasRestore autoCanvasRestore(canvas, true); |
155 SkPaint p; | 155 SkPaint p; |
156 p.setColor(SK_ColorBLACK); | 156 p.setColor(SK_ColorBLACK); |
157 p.setAntiAlias(true); | 157 p.setAntiAlias(true); |
158 sk_tool_utils::set_portable_typeface(&p, nullptr); | 158 sk_tool_utils::set_portable_typeface(&p, nullptr); |
159 | 159 |
160 sk_tool_utils::draw_checkerboard(canvas, SK_ColorLTGRAY, SK_ColorWHITE, 8); | 160 // sk_tool_utils::draw_checkerboard(canvas, SK_ColorLTGRAY, SK_ColorWHITE, 8) ; |
Brian Osman
2016/06/10 13:37:14
Are the changes in this file meant to be submitted
reed1
2016/06/10 14:26:04
reverted
| |
161 | 161 |
162 SkBitmap bitmap; | 162 SkBitmap bitmap; |
163 if (GetResourceAsBitmap("color_wheel.png", &bitmap)) { | 163 if (GetResourceAsBitmap("color_wheel.png", &bitmap)) { |
164 bitmap.setImmutable(); | 164 bitmap.setImmutable(); |
165 draw(canvas, p, bitmap, kN32_SkColorType, "Native 32"); | 165 // draw(canvas, p, bitmap, kN32_SkColorType, "Native 32"); |
166 | 166 |
167 if (false) { | |
167 canvas->translate(0.0f, SkIntToScalar(SCALE)); | 168 canvas->translate(0.0f, SkIntToScalar(SCALE)); |
168 SkBitmap copy565 = copy_bitmap(bitmap, kRGB_565_SkColorType); | 169 SkBitmap copy565 = copy_bitmap(bitmap, kRGB_565_SkColorType); |
169 p.setColor(SK_ColorRED); | 170 p.setColor(SK_ColorRED); |
170 draw(canvas, p, copy565, kRGB_565_SkColorType, "RGB 565"); | 171 draw(canvas, p, copy565, kRGB_565_SkColorType, "RGB 565"); |
171 p.setColor(SK_ColorBLACK); | 172 p.setColor(SK_ColorBLACK); |
173 } | |
172 | 174 |
173 canvas->translate(0.0f, SkIntToScalar(SCALE)); | 175 canvas->translate(0.0f, SkIntToScalar(SCALE)); |
174 SkBitmap copy4444 = copy_bitmap(bitmap, kARGB_4444_SkColorType); | 176 SkBitmap copy4444 = copy_bitmap(bitmap, kARGB_4444_SkColorType); |
175 draw(canvas, p, copy4444, kARGB_4444_SkColorType, "ARGB 4444"); | 177 draw(canvas, p, copy4444, kARGB_4444_SkColorType, "ARGB 4444"); |
176 } else { | 178 } else { |
177 canvas->translate(0.0f, SkIntToScalar(2 * SCALE)); | 179 canvas->translate(0.0f, SkIntToScalar(2 * SCALE)); |
178 } | 180 } |
179 | 181 |
180 canvas->translate(0.0f, SkIntToScalar(SCALE)); | 182 canvas->translate(0.0f, SkIntToScalar(SCALE)); |
183 if (false) { | |
181 SkBitmap bitmapIndexed = indexed_bitmap(); | 184 SkBitmap bitmapIndexed = indexed_bitmap(); |
182 draw(canvas, p, bitmapIndexed, kIndex_8_SkColorType, "Index 8"); | 185 draw(canvas, p, bitmapIndexed, kIndex_8_SkColorType, "Index 8"); |
183 | 186 |
184 canvas->translate(0.0f, SkIntToScalar(SCALE)); | 187 canvas->translate(0.0f, SkIntToScalar(SCALE)); |
185 SkBitmap bitmapA8 = make_bitmap(kAlpha_8_SkColorType); | 188 SkBitmap bitmapA8 = make_bitmap(kAlpha_8_SkColorType); |
186 draw(canvas, p, bitmapA8, kAlpha_8_SkColorType, "Alpha 8"); | 189 draw(canvas, p, bitmapA8, kAlpha_8_SkColorType, "Alpha 8"); |
187 | 190 |
188 p.setColor(SK_ColorRED); | 191 p.setColor(SK_ColorRED); |
189 canvas->translate(0.0f, SkIntToScalar(SCALE)); | 192 canvas->translate(0.0f, SkIntToScalar(SCALE)); |
190 SkBitmap bitmapG8 = make_bitmap(kGray_8_SkColorType); | 193 SkBitmap bitmapG8 = make_bitmap(kGray_8_SkColorType); |
191 draw(canvas, p, bitmapG8, kGray_8_SkColorType, "Gray 8"); | 194 draw(canvas, p, bitmapG8, kGray_8_SkColorType, "Gray 8"); |
195 } | |
192 } | 196 } |
193 | 197 |
194 sk_sp<SkImage> make_not_native32_color_wheel() { | 198 sk_sp<SkImage> make_not_native32_color_wheel() { |
195 SkBitmap n32bitmap, notN32bitmap; | 199 SkBitmap n32bitmap, notN32bitmap; |
196 n32bitmap.allocN32Pixels(SCALE, SCALE); | 200 n32bitmap.allocN32Pixels(SCALE, SCALE); |
197 n32bitmap.eraseColor(SK_ColorTRANSPARENT); | 201 n32bitmap.eraseColor(SK_ColorTRANSPARENT); |
198 SkCanvas n32canvas(n32bitmap); | 202 SkCanvas n32canvas(n32bitmap); |
199 color_wheel_native(&n32canvas); | 203 color_wheel_native(&n32canvas); |
200 n32canvas.flush(); | 204 n32canvas.flush(); |
201 #if SK_PMCOLOR_BYTE_ORDER(B,G,R,A) | 205 #if SK_PMCOLOR_BYTE_ORDER(B,G,R,A) |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
275 canvas->drawBitmap(bm, 0.0f, 0.0f); | 279 canvas->drawBitmap(bm, 0.0f, 0.0f); |
276 canvas->translate(SCALE + 10, 0.0f); | 280 canvas->translate(SCALE + 10, 0.0f); |
277 } | 281 } |
278 canvas->restore(); | 282 canvas->restore(); |
279 canvas->translate(0.0f, SCALE + 10); | 283 canvas->translate(0.0f, SCALE + 10); |
280 } | 284 } |
281 canvas->restore(); | 285 canvas->restore(); |
282 canvas->translate(2 * (SCALE + 10), 0.0f); | 286 canvas->translate(2 * (SCALE + 10), 0.0f); |
283 } | 287 } |
284 } | 288 } |
OLD | NEW |