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 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 static ErrorCombination generate_image(GM* gm, const ConfigData& gRec, | 523 static ErrorCombination generate_image(GM* gm, const ConfigData& gRec, |
524 GrSurface* gpuTarget, | 524 GrSurface* gpuTarget, |
525 SkBitmap* bitmap, | 525 SkBitmap* bitmap, |
526 bool deferred) { | 526 bool deferred) { |
527 SkISize size (gm->getISize()); | 527 SkISize size (gm->getISize()); |
528 setup_bitmap(gRec, size, bitmap); | 528 setup_bitmap(gRec, size, bitmap); |
529 | 529 |
530 SkAutoTUnref<SkCanvas> canvas; | 530 SkAutoTUnref<SkCanvas> canvas; |
531 | 531 |
532 if (gRec.fBackend == kRaster_Backend) { | 532 if (gRec.fBackend == kRaster_Backend) { |
533 SkAutoTUnref<SkDevice> device(SkNEW_ARGS(SkDevice, (*bitmap))); | 533 SkAutoTUnref<SkBaseDevice> device(SkNEW_ARGS(SkBitmapDevice, (*bitma
p))); |
534 if (deferred) { | 534 if (deferred) { |
535 canvas.reset(SkDeferredCanvas::Create(device)); | 535 canvas.reset(SkDeferredCanvas::Create(device)); |
536 } else { | 536 } else { |
537 canvas.reset(SkNEW_ARGS(SkCanvas, (device))); | 537 canvas.reset(SkNEW_ARGS(SkCanvas, (device))); |
538 } | 538 } |
539 invokeGM(gm, canvas, false, deferred); | 539 invokeGM(gm, canvas, false, deferred); |
540 canvas->flush(); | 540 canvas->flush(); |
541 } | 541 } |
542 #if SK_SUPPORT_GPU | 542 #if SK_SUPPORT_GPU |
543 else { // GPU | 543 else { // GPU |
544 SkAutoTUnref<SkDevice> device(SkGpuDevice::Create(gpuTarget)); | 544 SkAutoTUnref<SkBaseDevice> device(SkGpuDevice::Create(gpuTarget)); |
545 if (deferred) { | 545 if (deferred) { |
546 canvas.reset(SkDeferredCanvas::Create(device)); | 546 canvas.reset(SkDeferredCanvas::Create(device)); |
547 } else { | 547 } else { |
548 canvas.reset(SkNEW_ARGS(SkCanvas, (device))); | 548 canvas.reset(SkNEW_ARGS(SkCanvas, (device))); |
549 } | 549 } |
550 invokeGM(gm, canvas, false, deferred); | 550 invokeGM(gm, canvas, false, deferred); |
551 // the device is as large as the current rendertarget, so | 551 // the device is as large as the current rendertarget, so |
552 // we explicitly only readback the amount we expect (in | 552 // we explicitly only readback the amount we expect (in |
553 // size) overwrite our previous allocation | 553 // size) overwrite our previous allocation |
554 bitmap->setConfig(SkBitmap::kARGB_8888_Config, size.fWidth, | 554 bitmap->setConfig(SkBitmap::kARGB_8888_Config, size.fWidth, |
(...skipping 1743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2298 if (FLAGS_forceBWtext) { | 2298 if (FLAGS_forceBWtext) { |
2299 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); | 2299 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); |
2300 } | 2300 } |
2301 } | 2301 } |
2302 | 2302 |
2303 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 2303 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
2304 int main(int argc, char * const argv[]) { | 2304 int main(int argc, char * const argv[]) { |
2305 return tool_main(argc, (char**) argv); | 2305 return tool_main(argc, (char**) argv); |
2306 } | 2306 } |
2307 #endif | 2307 #endif |
OLD | NEW |