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

Unified Diff: src/utils/SkDeferredCanvas.cpp

Issue 14263015: Fix crash with SkDeferredCanvas+SkSurface integration with in order draw buffer. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/DeferredCanvasTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils/SkDeferredCanvas.cpp
===================================================================
--- src/utils/SkDeferredCanvas.cpp (revision 8683)
+++ src/utils/SkDeferredCanvas.cpp (working copy)
@@ -146,7 +146,7 @@
void setNotificationClient(SkDeferredCanvas::NotificationClient* notificationClient);
SkCanvas* recordingCanvas();
SkCanvas* immediateCanvas() const {return fImmediateCanvas;}
- SkDevice* immediateDevice() const {return fImmediateDevice;}
+ SkDevice* immediateDevice() const {return fImmediateCanvas->getTopDevice();}
SkImage* newImageSnapshot();
bool isFreshFrame();
bool hasPendingCommands();
@@ -243,7 +243,6 @@
DeferredPipeController fPipeController;
SkGPipeWriter fPipeWriter;
- SkDevice* fImmediateDevice;
SkCanvas* fImmediateCanvas;
SkCanvas* fRecordingCanvas;
SkSurface* fSurface;
@@ -260,8 +259,7 @@
immediateDevice->isOpaque(),
immediateDevice->getDeviceProperties()) {
fSurface = NULL;
- fImmediateDevice = immediateDevice; // ref counted via fImmediateCanvas
- fImmediateCanvas = SkNEW_ARGS(SkCanvas, (fImmediateDevice));
+ fImmediateCanvas = SkNEW_ARGS(SkCanvas, (immediateDevice));
this->init();
}
@@ -277,7 +275,6 @@
SkSafeRef(fImmediateCanvas);
fSurface = surface;
SkSafeRef(fSurface);
- fImmediateDevice = fImmediateCanvas->getDevice(); // ref counted via fImmediateCanvas
this->init();
}
@@ -306,7 +303,7 @@
void DeferredDevice::beginRecording() {
SkASSERT(NULL == fRecordingCanvas);
fRecordingCanvas = fPipeWriter.startRecording(&fPipeController, 0,
- fImmediateDevice->width(), fImmediateDevice->height());
+ immediateDevice()->width(), immediateDevice()->height());
}
void DeferredDevice::setNotificationClient(
@@ -406,20 +403,20 @@
}
uint32_t DeferredDevice::getDeviceCapabilities() {
- return fImmediateDevice->getDeviceCapabilities();
+ return immediateDevice()->getDeviceCapabilities();
}
int DeferredDevice::width() const {
- return fImmediateDevice->width();
+ return immediateDevice()->width();
}
int DeferredDevice::height() const {
- return fImmediateDevice->height();
+ return immediateDevice()->height();
}
SkGpuRenderTarget* DeferredDevice::accessRenderTarget() {
this->flushPendingCommands(kNormal_PlaybackMode);
- return fImmediateDevice->accessRenderTarget();
+ return immediateDevice()->accessRenderTarget();
}
void DeferredDevice::writePixels(const SkBitmap& bitmap,
@@ -435,7 +432,7 @@
kPMColorAlias != config8888) {
//Special case config: no deferral
this->flushPendingCommands(kNormal_PlaybackMode);
- fImmediateDevice->writePixels(bitmap, x, y, config8888);
+ immediateDevice()->writePixels(bitmap, x, y, config8888);
return;
}
@@ -453,7 +450,7 @@
const SkBitmap& DeferredDevice::onAccessBitmap(SkBitmap*) {
this->flushPendingCommands(kNormal_PlaybackMode);
- return fImmediateDevice->accessBitmap(false);
+ return immediateDevice()->accessBitmap(false);
}
SkDevice* DeferredDevice::onCreateCompatibleDevice(
@@ -464,7 +461,7 @@
SkASSERT(usage != kSaveLayer_Usage);
// Create a compatible non-deferred device.
SkAutoTUnref<SkDevice> compatibleDevice
- (fImmediateDevice->createCompatibleDevice(config, width, height,
+ (immediateDevice()->createCompatibleDevice(config, width, height,
isOpaque));
DeferredDevice* device = SkNEW_ARGS(DeferredDevice, (compatibleDevice));
device->setNotificationClient(fNotificationClient);
« 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