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

Side by Side Diff: gm/gmmain.cpp

Issue 22385011: Removing deprecated constructors and setDevice from SkDeferredCanvas (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 4 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 | « bench/benchmain.cpp ('k') | include/utils/SkDeferredCanvas.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 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 SkBitmap* bitmap, 512 SkBitmap* bitmap,
513 bool deferred) { 513 bool deferred) {
514 SkISize size (gm->getISize()); 514 SkISize size (gm->getISize());
515 setup_bitmap(gRec, size, bitmap); 515 setup_bitmap(gRec, size, bitmap);
516 516
517 SkAutoTUnref<SkCanvas> canvas; 517 SkAutoTUnref<SkCanvas> canvas;
518 518
519 if (gRec.fBackend == kRaster_Backend) { 519 if (gRec.fBackend == kRaster_Backend) {
520 SkAutoTUnref<SkDevice> device(SkNEW_ARGS(SkDevice, (*bitmap))); 520 SkAutoTUnref<SkDevice> device(SkNEW_ARGS(SkDevice, (*bitmap)));
521 if (deferred) { 521 if (deferred) {
522 #if SK_DEFERRED_CANVAS_USES_FACTORIES
523 canvas.reset(SkDeferredCanvas::Create(device)); 522 canvas.reset(SkDeferredCanvas::Create(device));
524 #else
525 canvas.reset(SkNEW_ARGS(SkDeferredCanvas, (device)));
526 #endif
527 } else { 523 } else {
528 canvas.reset(SkNEW_ARGS(SkCanvas, (device))); 524 canvas.reset(SkNEW_ARGS(SkCanvas, (device)));
529 } 525 }
530 invokeGM(gm, canvas, false, deferred); 526 invokeGM(gm, canvas, false, deferred);
531 canvas->flush(); 527 canvas->flush();
532 } 528 }
533 #if SK_SUPPORT_GPU 529 #if SK_SUPPORT_GPU
534 else { // GPU 530 else { // GPU
535 SkAutoTUnref<SkDevice> device(SkGpuDevice::Create(gpuTarget)); 531 SkAutoTUnref<SkDevice> device(SkGpuDevice::Create(gpuTarget));
536 if (deferred) { 532 if (deferred) {
537 #if SK_DEFERRED_CANVAS_USES_FACTORIES
538 canvas.reset(SkDeferredCanvas::Create(device)); 533 canvas.reset(SkDeferredCanvas::Create(device));
539 #else
540 canvas.reset(SkNEW_ARGS(SkDeferredCanvas, (device)));
541 #endif
542 } else { 534 } else {
543 canvas.reset(SkNEW_ARGS(SkCanvas, (device))); 535 canvas.reset(SkNEW_ARGS(SkCanvas, (device)));
544 } 536 }
545 invokeGM(gm, canvas, false, deferred); 537 invokeGM(gm, canvas, false, deferred);
546 // the device is as large as the current rendertarget, so 538 // the device is as large as the current rendertarget, so
547 // we explicitly only readback the amount we expect (in 539 // we explicitly only readback the amount we expect (in
548 // size) overwrite our previous allocation 540 // size) overwrite our previous allocation
549 bitmap->setConfig(SkBitmap::kARGB_8888_Config, size.fWidth, 541 bitmap->setConfig(SkBitmap::kARGB_8888_Config, size.fWidth,
550 size.fHeight); 542 size.fHeight);
551 canvas->readPixels(bitmap, 0, 0); 543 canvas->readPixels(bitmap, 0, 0);
(...skipping 1583 matching lines...) Expand 10 before | Expand all | Expand 10 after
2135 if (FLAGS_forceBWtext) { 2127 if (FLAGS_forceBWtext) {
2136 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); 2128 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref();
2137 } 2129 }
2138 } 2130 }
2139 2131
2140 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) 2132 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL)
2141 int main(int argc, char * const argv[]) { 2133 int main(int argc, char * const argv[]) {
2142 return tool_main(argc, (char**) argv); 2134 return tool_main(argc, (char**) argv);
2143 } 2135 }
2144 #endif 2136 #endif
OLDNEW
« no previous file with comments | « bench/benchmain.cpp ('k') | include/utils/SkDeferredCanvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698