aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2014-11-19 06:59:41 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-11-19 06:59:41 -0800
commit7e76bff26e7c74902841ca4f607eb0b24a833a4a (patch)
treecb2f55b88a3ec2b3838dc9003808af03b6700e1d /include/core
parentec03a4608025106ea3f21353865c7d302c0a13c6 (diff)
allow pictures to have a full bounds
Diffstat (limited to 'include/core')
-rw-r--r--include/core/SkBBHFactory.h8
-rw-r--r--include/core/SkCanvas.h2
-rw-r--r--include/core/SkDevice.h7
-rw-r--r--include/core/SkPicture.h7
-rw-r--r--include/core/SkPictureRecorder.h11
5 files changed, 23 insertions, 12 deletions
diff --git a/include/core/SkBBHFactory.h b/include/core/SkBBHFactory.h
index 67c9cd767d..2cc37e5491 100644
--- a/include/core/SkBBHFactory.h
+++ b/include/core/SkBBHFactory.h
@@ -9,7 +9,7 @@
#define SkBBHFactory_DEFINED
#include "SkSize.h"
-#include "SkPoint.h"
+#include "SkRect.h"
class SkBBoxHierarchy;
@@ -18,13 +18,13 @@ public:
/**
* Allocate a new SkBBoxHierarchy. Return NULL on failure.
*/
- virtual SkBBoxHierarchy* operator()(int width, int height) const = 0;
+ virtual SkBBoxHierarchy* operator()(const SkRect& bounds) const = 0;
virtual ~SkBBHFactory() {};
};
class SK_API SkRTreeFactory : public SkBBHFactory {
public:
- virtual SkBBoxHierarchy* operator()(int width, int height) const SK_OVERRIDE;
+ virtual SkBBoxHierarchy* operator()(const SkRect& bounds) const SK_OVERRIDE;
private:
typedef SkBBHFactory INHERITED;
};
@@ -50,7 +50,7 @@ public:
SkTileGridFactory(const TileGridInfo& info) : fInfo(info) { }
- virtual SkBBoxHierarchy* operator()(int width, int height) const SK_OVERRIDE;
+ virtual SkBBoxHierarchy* operator()(const SkRect& bounds) const SK_OVERRIDE;
private:
TileGridInfo fInfo;
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index 276b39236f..d172674c41 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -1335,7 +1335,7 @@ private:
kDefault_InitFlags = 0,
kConservativeRasterClip_InitFlag = 1 << 0,
};
- SkCanvas(int width, int height, InitFlags);
+ SkCanvas(const SkIRect& bounds, InitFlags);
SkCanvas(SkBaseDevice*, const SkSurfaceProps*, InitFlags);
SkCanvas(const SkBitmap&, const SkSurfaceProps&);
diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h
index 471a76be8e..3c26baca5b 100644
--- a/include/core/SkDevice.h
+++ b/include/core/SkDevice.h
@@ -53,6 +53,12 @@ public:
bounds->setXYWH(origin.x(), origin.y(), this->width(), this->height());
}
+ SkIRect getGlobalBounds() const {
+ SkIRect bounds;
+ this->getGlobalBounds(&bounds);
+ return bounds;
+ }
+
int width() const {
return this->imageInfo().width();
}
@@ -366,6 +372,7 @@ private:
friend class SkDeviceFilteredPaint;
friend class SkDeviceImageFilterProxy;
friend class SkDeferredDevice; // for newSurface
+ friend class SkNoPixelsBitmapDevice;
friend class SkSurface_Raster;
diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h
index 99bca367d9..c69db37ffa 100644
--- a/include/core/SkPicture.h
+++ b/include/core/SkPicture.h
@@ -130,7 +130,7 @@ public:
It does not necessarily reflect the bounds of what has been recorded into the picture.
@return the cull rect used to create this picture
*/
- const SkRect cullRect() const { return SkRect::MakeWH(fCullWidth, fCullHeight); }
+ SkRect cullRect() const { return fCullRect; }
/** Return a non-zero, unique value representing the picture. This call is
only valid when not recording. Between a beginRecording/endRecording
@@ -260,15 +260,14 @@ private:
static bool IsValidPictInfo(const SkPictInfo& info);
// Takes ownership of the SkRecord, refs the (optional) drawablePicts and BBH.
- SkPicture(SkScalar width, SkScalar height, SkRecord*, SkData* drawablePicts,
+ SkPicture(const SkRect& cullRect, SkRecord*, SkData* drawablePicts,
SkBBoxHierarchy*);
static SkPicture* Forwardport(const SkPictInfo&, const SkPictureData*);
static SkPictureData* Backport(const SkRecord&, const SkPictInfo&,
SkPicture const* const drawablePics[], int drawableCount);
- const SkScalar fCullWidth;
- const SkScalar fCullHeight;
+ const SkRect fCullRect;
mutable SkAutoTUnref<const AccelData> fAccelData;
mutable SkTDArray<DeletionListener*> fDeletionListeners; // pointers are refed
SkAutoTDelete<SkRecord> fRecord;
diff --git a/include/core/SkPictureRecorder.h b/include/core/SkPictureRecorder.h
index de216b4e5b..a8ca600b81 100644
--- a/include/core/SkPictureRecorder.h
+++ b/include/core/SkPictureRecorder.h
@@ -50,10 +50,16 @@ public:
@param recordFlags optional flags that control recording.
@return the canvas.
*/
- SkCanvas* beginRecording(SkScalar width, SkScalar height,
+ SkCanvas* beginRecording(const SkRect& bounds,
SkBBHFactory* bbhFactory = NULL,
uint32_t recordFlags = 0);
+ SkCanvas* beginRecording(SkScalar width, SkScalar height,
+ SkBBHFactory* bbhFactory = NULL,
+ uint32_t recordFlags = 0) {
+ return this->beginRecording(SkRect::MakeWH(width, height), bbhFactory, recordFlags);
+ }
+
/** Returns the recording canvas if one is active, or NULL if recording is
not active. This does not alter the refcnt on the canvas (if present).
*/
@@ -79,8 +85,7 @@ private:
void partialReplay(SkCanvas* canvas) const;
uint32_t fFlags;
- SkScalar fCullWidth;
- SkScalar fCullHeight;
+ SkRect fCullRect;
SkAutoTUnref<SkBBoxHierarchy> fBBH;
SkAutoTUnref<SkRecorder> fRecorder;
SkAutoTDelete<SkRecord> fRecord;