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

Unified Diff: src/image/SkSurface_Gpu.cpp

Issue 141443009: use new instead of createCompatibleDevice, since we know the subclass we want (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/image/SkSurface_Gpu.cpp
diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp
index 719b0c065310ac062159012de6efad57a3ea5027..5350fe9c075ab23779229404517888301b854b9a 100644
--- a/src/image/SkSurface_Gpu.cpp
+++ b/src/image/SkSurface_Gpu.cpp
@@ -85,10 +85,10 @@ void SkSurface_Gpu::onCopyOnWrite(ContentChangeMode mode) {
// are we sharing our render target with the image?
SkASSERT(NULL != this->getCachedImage());
if (rt->asTexture() == SkTextureImageGetTexture(this->getCachedImage())) {
- SkGpuDevice* newDevice = static_cast<SkGpuDevice*>(
- fDevice->createCompatibleDevice(fDevice->config(), fDevice->width(),
- fDevice->height(), fDevice->isOpaque()));
- SkAutoTUnref<SkGpuDevice> aurd(newDevice);
+ SkAutoTUnref<SkGpuDevice> newDevice(SkNEW_ARGS(SkGpuDevice,
+ (fDevice->context(), fDevice->config(), fDevice->width(),
+ fDevice->height(), rt->numSamples())));
+
if (kRetain_ContentChangeMode == mode) {
fDevice->context()->copyTexture(rt->asTexture(),
reinterpret_cast<GrRenderTarget*>(newDevice->accessRenderTarget()));
@@ -96,7 +96,7 @@ void SkSurface_Gpu::onCopyOnWrite(ContentChangeMode mode) {
SkASSERT(NULL != this->getCachedCanvas());
SkASSERT(this->getCachedCanvas()->getDevice() == fDevice);
this->getCachedCanvas()->setDevice(newDevice);
- SkRefCnt_SafeAssign(fDevice, newDevice);
+ SkRefCnt_SafeAssign(fDevice, newDevice.get());
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698