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

Side by Side Diff: gm/gmmain.cpp

Issue 16040002: Changing SkDeferredCanvas to use factories for creation (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 6 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 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 static ErrorCombination generate_image(GM* gm, const ConfigData& gRec, 483 static ErrorCombination generate_image(GM* gm, const ConfigData& gRec,
484 GrSurface* gpuTarget, 484 GrSurface* gpuTarget,
485 SkBitmap* bitmap, 485 SkBitmap* bitmap,
486 bool deferred) { 486 bool deferred) {
487 SkISize size (gm->getISize()); 487 SkISize size (gm->getISize());
488 setup_bitmap(gRec, size, bitmap); 488 setup_bitmap(gRec, size, bitmap);
489 489
490 SkAutoTUnref<SkCanvas> canvas; 490 SkAutoTUnref<SkCanvas> canvas;
491 491
492 if (gRec.fBackend == kRaster_Backend) { 492 if (gRec.fBackend == kRaster_Backend) {
493 SkAutoTUnref<SkDevice> device(new SkDevice(*bitmap)); 493 SkAutoTUnref<SkDevice> device(SkNEW_ARGS(SkDevice, (*bitmap)));
494 if (deferred) { 494 if (deferred) {
495 canvas.reset(new SkDeferredCanvas(device)); 495 #if SK_DEFERRED_CANVAS_USES_FACTORIES
496 canvas.reset(SkDeferredCanvas::Create(device));
497 #else
498 canvas.reset(SkNEW_ARGS(SkDeferredCanvas, (device)));
499 #endif
496 } else { 500 } else {
497 canvas.reset(new SkCanvas(device)); 501 canvas.reset(SkNEW_ARGS(SkCanvas, (device)));
498 } 502 }
499 invokeGM(gm, canvas, false, deferred); 503 invokeGM(gm, canvas, false, deferred);
500 canvas->flush(); 504 canvas->flush();
501 } 505 }
502 #if SK_SUPPORT_GPU 506 #if SK_SUPPORT_GPU
503 else { // GPU 507 else { // GPU
504 SkAutoTUnref<SkDevice> device(SkGpuDevice::Create(gpuTarget)); 508 SkAutoTUnref<SkDevice> device(SkGpuDevice::Create(gpuTarget));
505 if (deferred) { 509 if (deferred) {
506 canvas.reset(new SkDeferredCanvas(device)); 510 #if SK_DEFERRED_CANVAS_USES_FACTORIES
511 canvas.reset(SkDeferredCanvas::Create(device));
512 #else
513 canvas.reset(SkNEW_ARGS(SkDeferredCanvas, (device)));
514 #endif
507 } else { 515 } else {
508 canvas.reset(new SkCanvas(device)); 516 canvas.reset(SkNEW_ARGS(SkCanvas, (device)));
509 } 517 }
510 invokeGM(gm, canvas, false, deferred); 518 invokeGM(gm, canvas, false, deferred);
511 // the device is as large as the current rendertarget, so 519 // the device is as large as the current rendertarget, so
512 // we explicitly only readback the amount we expect (in 520 // we explicitly only readback the amount we expect (in
513 // size) overwrite our previous allocation 521 // size) overwrite our previous allocation
514 bitmap->setConfig(SkBitmap::kARGB_8888_Config, size.fWidth, 522 bitmap->setConfig(SkBitmap::kARGB_8888_Config, size.fWidth,
515 size.fHeight); 523 size.fHeight);
516 canvas->readPixels(bitmap, 0, 0); 524 canvas->readPixels(bitmap, 0, 0);
517 } 525 }
518 #endif 526 #endif
(...skipping 1559 matching lines...) Expand 10 before | Expand all | Expand 10 after
2078 if (FLAGS_forceBWtext) { 2086 if (FLAGS_forceBWtext) {
2079 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); 2087 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref();
2080 } 2088 }
2081 } 2089 }
2082 2090
2083 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) 2091 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL)
2084 int main(int argc, char * const argv[]) { 2092 int main(int argc, char * const argv[]) {
2085 return tool_main(argc, (char**) argv); 2093 return tool_main(argc, (char**) argv);
2086 } 2094 }
2087 #endif 2095 #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