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

Side by Side Diff: src/utils/SkDeferredCanvas.cpp

Issue 15594004: Fixing deferred canvases so that they do not return deferred devices on createCompatibleDevice (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 7 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 | « no previous file | tests/DeferredCanvasTest.cpp » ('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 /* 2 /*
3 * Copyright 2013 Google Inc. 3 * Copyright 2013 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkDeferredCanvas.h" 9 #include "SkDeferredCanvas.h"
10 10
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 return immediateDevice()->accessBitmap(false); 468 return immediateDevice()->accessBitmap(false);
469 } 469 }
470 470
471 SkDevice* DeferredDevice::onCreateCompatibleDevice( 471 SkDevice* DeferredDevice::onCreateCompatibleDevice(
472 SkBitmap::Config config, int width, int height, bool isOpaque, 472 SkBitmap::Config config, int width, int height, bool isOpaque,
473 Usage usage) { 473 Usage usage) {
474 474
475 // Save layer usage not supported, and not required by SkDeferredCanvas. 475 // Save layer usage not supported, and not required by SkDeferredCanvas.
476 SkASSERT(usage != kSaveLayer_Usage); 476 SkASSERT(usage != kSaveLayer_Usage);
477 // Create a compatible non-deferred device. 477 // Create a compatible non-deferred device.
478 SkAutoTUnref<SkDevice> compatibleDevice 478 // We do not create a deferred device because we know the new device
479 (immediateDevice()->createCompatibleDevice(config, width, height, 479 // will not be used with a deferred canvas (there is no API for that).
480 isOpaque)); 480 // And connecting a DeferredDevice to non-deferred canvas can result
481 DeferredDevice* device = SkNEW_ARGS(DeferredDevice, (compatibleDevice)); 481 // in unpredictable behavior.
482 device->setNotificationClient(fNotificationClient); 482 return immediateDevice()->createCompatibleDevice(config, width, height, isOp aque);
483 return device;
484 } 483 }
485 484
486 bool DeferredDevice::onReadPixels( 485 bool DeferredDevice::onReadPixels(
487 const SkBitmap& bitmap, int x, int y, SkCanvas::Config8888 config8888) { 486 const SkBitmap& bitmap, int x, int y, SkCanvas::Config8888 config8888) {
488 this->flushPendingCommands(kNormal_PlaybackMode); 487 this->flushPendingCommands(kNormal_PlaybackMode);
489 return fImmediateCanvas->readPixels(const_cast<SkBitmap*>(&bitmap), 488 return fImmediateCanvas->readPixels(const_cast<SkBitmap*>(&bitmap),
490 x, y, config8888); 489 x, y, config8888);
491 } 490 }
492 491
493 class AutoImmediateDrawIfNeeded { 492 class AutoImmediateDrawIfNeeded {
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 SkDrawFilter* SkDeferredCanvas::setDrawFilter(SkDrawFilter* filter) { 968 SkDrawFilter* SkDeferredCanvas::setDrawFilter(SkDrawFilter* filter) {
970 this->drawingCanvas()->setDrawFilter(filter); 969 this->drawingCanvas()->setDrawFilter(filter);
971 this->INHERITED::setDrawFilter(filter); 970 this->INHERITED::setDrawFilter(filter);
972 this->recordedDrawCommand(); 971 this->recordedDrawCommand();
973 return filter; 972 return filter;
974 } 973 }
975 974
976 SkCanvas* SkDeferredCanvas::canvasForDrawIter() { 975 SkCanvas* SkDeferredCanvas::canvasForDrawIter() {
977 return this->drawingCanvas(); 976 return this->drawingCanvas();
978 } 977 }
OLDNEW
« no previous file with comments | « no previous file | tests/DeferredCanvasTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698