Clean up usage of SkSurfaceProps
This CL continues cleaning up Skia's usage of SkSurfaceProps. It:
Removes the duplicate SkSurfaceProps object from SkImageFilter::Proxy.
Removes a dispreferred ctor from SkCanvas
Removes the initForRootLayer entry point from SkDevice (since the root device and the canvas should always have the same pixel geometry now).
Review URL: https://codereview.chromium.org/1201983006
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index f35727d..fcfb641 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -536,8 +536,8 @@
fSurfaceBase = NULL;
if (device) {
- // TODO: remove this - the root device & canvas should always have same surfaceProps
- device->initForRootLayer(fProps.pixelGeometry());
+ // The root device and the canvas should always have the same pixel geometry
+ SkASSERT(fProps.pixelGeometry() == device->surfaceProps().pixelGeometry());
if (device->forceConservativeRasterClip()) {
fConservativeRasterClip = true;
}
@@ -595,16 +595,6 @@
this->init(SkNEW_ARGS(SkNoPixelsBitmapDevice, (bounds, fProps)), flags)->unref();
}
-// TODO: remove this ctor
-SkCanvas::SkCanvas(SkBaseDevice* device, const SkSurfaceProps* props, InitFlags flags)
- : fMCStack(sizeof(MCRec), fMCRecStorage, sizeof(fMCRecStorage))
- , fProps(SkSurfacePropsCopyOrDefault(props))
-{
- inc_canvas();
-
- this->init(device, flags);
-}
-
SkCanvas::SkCanvas(SkBaseDevice* device)
: fMCStack(sizeof(MCRec), fMCRecStorage, sizeof(fMCRecStorage))
, fProps(device->surfaceProps())
@@ -1256,7 +1246,7 @@
SkImageFilter* filter = paint->getImageFilter();
SkIPoint pos = { x - iter.getX(), y - iter.getY() };
if (filter && !dstDev->canHandleImageFilter(filter)) {
- SkImageFilter::Proxy proxy(dstDev, fProps);
+ SkImageFilter::Proxy proxy(dstDev);
SkBitmap dst;
SkIPoint offset = SkIPoint::Make(0, 0);
const SkBitmap& src = srcDev->accessBitmap(false);
@@ -1308,7 +1298,7 @@
SkImageFilter* filter = paint->getImageFilter();
SkIPoint pos = { x - iter.getX(), y - iter.getY() };
if (filter && !iter.fDevice->canHandleImageFilter(filter)) {
- SkImageFilter::Proxy proxy(iter.fDevice, fProps);
+ SkImageFilter::Proxy proxy(iter.fDevice);
SkBitmap dst;
SkIPoint offset = SkIPoint::Make(0, 0);
SkMatrix matrix = *iter.fMatrix;