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