aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkCanvas.cpp
diff options
context:
space:
mode:
authorGravatar kkinnunen <kkinnunen@nvidia.com>2015-02-22 22:53:44 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-02-22 22:53:44 -0800
commitabcfab4d68d53900ef33320bb2622696c14d14b0 (patch)
tree8ea70d5b22a26ba36811f51bb97361c9bb1e96d6 /src/core/SkCanvas.cpp
parent54bf133ca445011e54cd4a98f9be14681869991f (diff)
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
Diffstat (limited to 'src/core/SkCanvas.cpp')
-rw-r--r--src/core/SkCanvas.cpp53
1 files changed, 0 insertions, 53 deletions
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index c523ca07dd..221ed93ac8 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -608,59 +608,6 @@ SkBaseDevice* SkCanvas::getTopDevice(bool updateMatrixClip) const {
return fMCRec->fTopLayer->fDevice;
}
-SkBaseDevice* SkCanvas::setRootDevice(SkBaseDevice* device) {
- // return root device
- SkDeque::F2BIter iter(fMCStack);
- MCRec* rec = (MCRec*)iter.next();
- SkASSERT(rec && rec->fLayer);
- SkBaseDevice* rootDevice = rec->fLayer->fDevice;
-
- if (rootDevice == device) {
- return device;
- }
-
- if (device) {
- device->onAttachToCanvas(this);
- device->initForRootLayer(fProps.pixelGeometry());
- }
- if (rootDevice) {
- rootDevice->onDetachFromCanvas();
- }
-
- SkRefCnt_SafeAssign(rec->fLayer->fDevice, device);
- rootDevice = device;
-
- fDeviceCMDirty = true;
-
- /* Now we update our initial region to have the bounds of the new device,
- and then intersect all of the clips in our stack with these bounds,
- to ensure that we can't draw outside of the device's bounds (and trash
- memory).
-
- NOTE: this is only a partial-fix, since if the new device is larger than
- the previous one, we don't know how to "enlarge" the clips in our stack,
- so drawing may be artificially restricted. Without keeping a history of
- all calls to canvas->clipRect() and canvas->clipPath(), we can't exactly
- reconstruct the correct clips, so this approximation will have to do.
- The caller really needs to restore() back to the base if they want to
- accurately take advantage of the new device bounds.
- */
-
- SkIRect bounds;
- if (device) {
- bounds.set(0, 0, device->width(), device->height());
- } else {
- bounds.setEmpty();
- }
- // now jam our 1st clip to be bounds, and intersect the rest with that
- rec->fRasterClip.setRect(bounds);
- while ((rec = (MCRec*)iter.next()) != NULL) {
- (void)rec->fRasterClip.op(bounds, SkRegion::kIntersect_Op);
- }
-
- return device;
-}
-
bool SkCanvas::readPixels(SkBitmap* bitmap, int x, int y) {
if (kUnknown_SkColorType == bitmap->colorType() || bitmap->getTexture()) {
return false;