Swap render target instead of creating a new gpu device for surface copy-on-write
Swap render target of the gpu device instead of creating a new gpu
device when making a copy-on-write upon surface modification.
This removes the SkCanvas::setRootDevice which contains problematic code
when trying to increase the use of SkImages internally in Skia.
BUG=skia:3388
Review URL: https://codereview.chromium.org/925343002
diff --git a/src/gpu/SkGpuDevice.h b/src/gpu/SkGpuDevice.h
index 4830c02..cd2dcdc 100644
--- a/src/gpu/SkGpuDevice.h
+++ b/src/gpu/SkGpuDevice.h
@@ -62,6 +62,8 @@
// set all pixels to 0
void clearAll();
+ void replaceRenderTarget(bool shouldRetainContent);
+
GrRenderTarget* accessRenderTarget() SK_OVERRIDE;
SkImageInfo imageInfo() const SK_OVERRIDE {
@@ -199,6 +201,9 @@
static SkPicture::AccelData::Key ComputeAccelDataKey();
+ static GrRenderTarget* CreateRenderTarget(GrContext*, SkSurface::Budgeted, const SkImageInfo&,
+ int sampleCount);
+
typedef SkBaseDevice INHERITED;
};