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

Unified Diff: src/core/SkCanvas.cpp

Issue 738083002: Allow pictures to have a full bounds (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update dox Created 6 years, 1 month 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 | « src/core/SkBBHFactory.cpp ('k') | src/core/SkCanvasDrawable.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkCanvas.cpp
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 4fda7a37b32a306aea9b229c083769acd44e0c1b..31a9a7970bbb5ba296171eae0d251effa67e071e 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -431,7 +431,7 @@ SkBaseDevice* SkCanvas::init(SkBaseDevice* device, InitFlags flags) {
}
device->onAttachToCanvas(this);
fMCRec->fLayer->fDevice = SkRef(device);
- fMCRec->fRasterClip.setRect(SkIRect::MakeWH(device->width(), device->height()));
+ fMCRec->fRasterClip.setRect(device->getGlobalBounds());
}
return device;
}
@@ -453,7 +453,11 @@ static SkBitmap make_nopixels(int width, int height) {
class SkNoPixelsBitmapDevice : public SkBitmapDevice {
public:
- SkNoPixelsBitmapDevice(int width, int height) : INHERITED(make_nopixels(width, height)) {}
+ SkNoPixelsBitmapDevice(const SkIRect& bounds)
+ : INHERITED(make_nopixels(bounds.width(), bounds.height()))
+ {
+ this->setOrigin(bounds.x(), bounds.y());
+ }
private:
@@ -466,16 +470,17 @@ SkCanvas::SkCanvas(int width, int height)
{
inc_canvas();
- this->init(SkNEW_ARGS(SkNoPixelsBitmapDevice, (width, height)), kDefault_InitFlags)->unref();
+ this->init(SkNEW_ARGS(SkNoPixelsBitmapDevice,
+ (SkIRect::MakeWH(width, height))), kDefault_InitFlags)->unref();
}
-SkCanvas::SkCanvas(int width, int height, InitFlags flags)
+SkCanvas::SkCanvas(const SkIRect& bounds, InitFlags flags)
: fMCStack(sizeof(MCRec), fMCRecStorage, sizeof(fMCRecStorage))
, fProps(SkSurfaceProps::kLegacyFontHost_InitType)
{
inc_canvas();
- this->init(SkNEW_ARGS(SkNoPixelsBitmapDevice, (width, height)), flags)->unref();
+ this->init(SkNEW_ARGS(SkNoPixelsBitmapDevice, (bounds)), flags)->unref();
}
SkCanvas::SkCanvas(SkBaseDevice* device, const SkSurfaceProps* props, InitFlags flags)
« no previous file with comments | « src/core/SkBBHFactory.cpp ('k') | src/core/SkCanvasDrawable.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698