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

Side by Side Diff: gm/gmmain.cpp

Issue 171723007: add new copyTo version to SkBitmap, which takes SkColorType (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « gm/copyTo4444.cpp ('k') | include/core/SkBitmap.h » ('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 2011 Google Inc. 2 * Copyright 2011 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 /* 8 /*
9 * Code for the "gm" (Golden Master) rendering comparison tool. 9 * Code for the "gm" (Golden Master) rendering comparison tool.
10 * 10 *
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 *bitmap.getAddr32(x, y) |= (SK_A32_MASK << SK_A32_SHIFT); 286 *bitmap.getAddr32(x, y) |= (SK_A32_MASK << SK_A32_SHIFT);
287 } 287 }
288 } 288 }
289 } 289 }
290 290
291 static ErrorCombination write_bitmap(const SkString& path, const SkBitmap& b itmap) { 291 static ErrorCombination write_bitmap(const SkString& path, const SkBitmap& b itmap) {
292 // TODO(epoger): Now that we have removed force_all_opaque() 292 // TODO(epoger): Now that we have removed force_all_opaque()
293 // from this method, we should be able to get rid of the 293 // from this method, we should be able to get rid of the
294 // transformation to 8888 format also. 294 // transformation to 8888 format also.
295 SkBitmap copy; 295 SkBitmap copy;
296 bitmap.copyTo(&copy, SkBitmap::kARGB_8888_Config); 296 bitmap.copyTo(&copy, kPMColor_SkColorType);
297 if (!SkImageEncoder::EncodeFile(path.c_str(), copy, 297 if (!SkImageEncoder::EncodeFile(path.c_str(), copy,
298 SkImageEncoder::kPNG_Type, 298 SkImageEncoder::kPNG_Type,
299 100)) { 299 100)) {
300 gm_fprintf(stderr, "FAILED to write bitmap: %s\n", path.c_str()); 300 gm_fprintf(stderr, "FAILED to write bitmap: %s\n", path.c_str());
301 return ErrorCombination(kWritingReferenceImage_ErrorType); 301 return ErrorCombination(kWritingReferenceImage_ErrorType);
302 } 302 }
303 return kEmpty_ErrorCombination; 303 return kEmpty_ErrorCombination;
304 } 304 }
305 305
306 /** 306 /**
(...skipping 2113 matching lines...) Expand 10 before | Expand all | Expand 10 after
2420 if (FLAGS_forceBWtext) { 2420 if (FLAGS_forceBWtext) {
2421 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); 2421 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref();
2422 } 2422 }
2423 } 2423 }
2424 2424
2425 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) 2425 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL)
2426 int main(int argc, char * const argv[]) { 2426 int main(int argc, char * const argv[]) {
2427 return tool_main(argc, (char**) argv); 2427 return tool_main(argc, (char**) argv);
2428 } 2428 }
2429 #endif 2429 #endif
OLDNEW
« no previous file with comments | « gm/copyTo4444.cpp ('k') | include/core/SkBitmap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698