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

Side by Side Diff: gm/all_bitmap_configs.cpp

Issue 2074103004: Revert of More removal of SkColorProfileType... (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « gm/SkLinearBitmapPipelineGM.cpp ('k') | gm/color4f.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 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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 default: 239 default:
240 SkFAIL("Should not get here - invalid alpha type"); 240 SkFAIL("Should not get here - invalid alpha type");
241 return 0xFF000000; 241 return 0xFF000000;
242 } 242 }
243 return alpha << 24 | component; 243 return alpha << 24 | component;
244 } 244 }
245 245
246 static void make_color_test_bitmap_variant( 246 static void make_color_test_bitmap_variant(
247 SkColorType colorType, 247 SkColorType colorType,
248 SkAlphaType alphaType, 248 SkAlphaType alphaType,
249 sk_sp<SkColorSpace> colorSpace, 249 SkColorProfileType profile,
250 SkBitmap* bm) 250 SkBitmap* bm)
251 { 251 {
252 SkASSERT(colorType == kRGBA_8888_SkColorType || colorType == kBGRA_8888_SkCo lorType); 252 SkASSERT(colorType == kRGBA_8888_SkColorType || colorType == kBGRA_8888_SkCo lorType);
253 SkASSERT(alphaType == kPremul_SkAlphaType || alphaType == kUnpremul_SkAlphaT ype); 253 SkASSERT(alphaType == kPremul_SkAlphaType || alphaType == kUnpremul_SkAlphaT ype);
254 bm->allocPixels( 254 bm->allocPixels(
255 SkImageInfo::Make(SCALE, SCALE, colorType, alphaType, colorSpace)); 255 SkImageInfo::Make(SCALE, SCALE, colorType, alphaType, profile));
256 SkPixmap pm; 256 SkPixmap pm;
257 bm->peekPixels(&pm); 257 bm->peekPixels(&pm);
258 for (int y = 0; y < bm->height(); y++) { 258 for (int y = 0; y < bm->height(); y++) {
259 for (int x = 0; x < bm->width(); x++) { 259 for (int x = 0; x < bm->width(); x++) {
260 *pm.writable_addr32(x, y) = make_pixel(x, y, alphaType); 260 *pm.writable_addr32(x, y) = make_pixel(x, y, alphaType);
261 } 261 }
262 } 262 }
263 } 263 }
264 264
265 DEF_SIMPLE_GM(all_variants_8888, canvas, 4 * SCALE + 30, 2 * SCALE + 10) { 265 DEF_SIMPLE_GM(all_variants_8888, canvas, 4 * SCALE + 30, 2 * SCALE + 10) {
266 sk_tool_utils::draw_checkerboard(canvas, SK_ColorLTGRAY, SK_ColorWHITE, 8); 266 sk_tool_utils::draw_checkerboard(canvas, SK_ColorLTGRAY, SK_ColorWHITE, 8);
267 267
268 sk_sp<SkColorSpace> colorSpaces[] { 268 for (auto profile : {kSRGB_SkColorProfileType, kLinear_SkColorProfileType}) {
269 nullptr,
270 SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named)
271 };
272 for (auto colorSpace : colorSpaces) {
273 canvas->save(); 269 canvas->save();
274 for (auto alphaType : {kPremul_SkAlphaType, kUnpremul_SkAlphaType}) { 270 for (auto alphaType : {kPremul_SkAlphaType, kUnpremul_SkAlphaType}) {
275 canvas->save(); 271 canvas->save();
276 for (auto colorType : {kRGBA_8888_SkColorType, kBGRA_8888_SkColorTyp e}) { 272 for (auto colorType : {kRGBA_8888_SkColorType, kBGRA_8888_SkColorTyp e}) {
277 SkBitmap bm; 273 SkBitmap bm;
278 make_color_test_bitmap_variant(colorType, alphaType, colorSpace, &bm); 274 make_color_test_bitmap_variant(colorType, alphaType, profile, &b m);
279 canvas->drawBitmap(bm, 0.0f, 0.0f); 275 canvas->drawBitmap(bm, 0.0f, 0.0f);
280 canvas->translate(SCALE + 10, 0.0f); 276 canvas->translate(SCALE + 10, 0.0f);
281 } 277 }
282 canvas->restore(); 278 canvas->restore();
283 canvas->translate(0.0f, SCALE + 10); 279 canvas->translate(0.0f, SCALE + 10);
284 } 280 }
285 canvas->restore(); 281 canvas->restore();
286 canvas->translate(2 * (SCALE + 10), 0.0f); 282 canvas->translate(2 * (SCALE + 10), 0.0f);
287 } 283 }
288 } 284 }
OLDNEW
« no previous file with comments | « gm/SkLinearBitmapPipelineGM.cpp ('k') | gm/color4f.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698