OLD | NEW |
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 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 * After you've rendered the GM into the SkBitmap, you must call | 468 * After you've rendered the GM into the SkBitmap, you must call |
469 * complete_bitmap()! | 469 * complete_bitmap()! |
470 * | 470 * |
471 * @todo thudson 22 April 2011 - could refactor this to take in | 471 * @todo thudson 22 April 2011 - could refactor this to take in |
472 * a factory to generate the context, always call readPixels() | 472 * a factory to generate the context, always call readPixels() |
473 * (logically a noop for rasters, if wasted time), and thus collapse the | 473 * (logically a noop for rasters, if wasted time), and thus collapse the |
474 * GPU special case and also let this be used for SkPicture testing. | 474 * GPU special case and also let this be used for SkPicture testing. |
475 */ | 475 */ |
476 static void setup_bitmap(const ConfigData& gRec, SkISize& size, | 476 static void setup_bitmap(const ConfigData& gRec, SkISize& size, |
477 SkBitmap* bitmap) { | 477 SkBitmap* bitmap) { |
478 bitmap->setConfig(gRec.fConfig, size.width(), size.height()); | 478 bitmap->allocConfigPixels(gRec.fConfig, size.width(), size.height()); |
479 bitmap->allocPixels(); | |
480 bitmap->eraseColor(SK_ColorTRANSPARENT); | 479 bitmap->eraseColor(SK_ColorTRANSPARENT); |
481 } | 480 } |
482 | 481 |
483 /** | 482 /** |
484 * Any finalization steps we need to perform on the SkBitmap after | 483 * Any finalization steps we need to perform on the SkBitmap after |
485 * we have rendered the GM into it. | 484 * we have rendered the GM into it. |
486 * | 485 * |
487 * It's too bad that we are throwing away alpha channel data | 486 * It's too bad that we are throwing away alpha channel data |
488 * we could otherwise be examining, but this had always been happening | 487 * we could otherwise be examining, but this had always been happening |
489 * before... it was buried within the compare() method at | 488 * before... it was buried within the compare() method at |
(...skipping 1922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2412 if (FLAGS_forceBWtext) { | 2411 if (FLAGS_forceBWtext) { |
2413 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); | 2412 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); |
2414 } | 2413 } |
2415 } | 2414 } |
2416 | 2415 |
2417 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 2416 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
2418 int main(int argc, char * const argv[]) { | 2417 int main(int argc, char * const argv[]) { |
2419 return tool_main(argc, (char**) argv); | 2418 return tool_main(argc, (char**) argv); |
2420 } | 2419 } |
2421 #endif | 2420 #endif |
OLD | NEW |