change PictureRecord (and its private subclasses) to take size instead of device

BUG=skia:
R=mtklein@google.com, scroggo@google.com, reed@google.com

Author: reed@chromium.org

Review URL: https://codereview.chromium.org/168983003

git-svn-id: http://skia.googlecode.com/svn/trunk@13477 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
commit-bot@chromium.org 2014-02-17 15:28:00 +00:00
parent 403f8d7a05
commit 19fafef978
6 changed files with 13 additions and 17 deletions

View File

@ -9,10 +9,10 @@
#include "SkBBoxHierarchyRecord.h"
#include "SkPictureStateTree.h"
SkBBoxHierarchyRecord::SkBBoxHierarchyRecord(uint32_t recordFlags,
SkBBoxHierarchy* h,
SkBaseDevice* device)
: INHERITED(recordFlags, device) {
SkBBoxHierarchyRecord::SkBBoxHierarchyRecord(const SkISize& size,
uint32_t recordFlags,
SkBBoxHierarchy* h)
: INHERITED(size, recordFlags) {
fStateTree = SkNEW(SkPictureStateTree);
fBoundingHierarchy = h;
fBoundingHierarchy->ref();

View File

@ -19,8 +19,7 @@
class SkBBoxHierarchyRecord : public SkBBoxRecord, public SkBBoxHierarchyClient {
public:
/** This will take a ref of h */
SkBBoxHierarchyRecord(uint32_t recordFlags, SkBBoxHierarchy* h,
SkBaseDevice*);
SkBBoxHierarchyRecord(const SkISize& size, uint32_t recordFlags, SkBBoxHierarchy* h);
virtual void handleBBox(const SkRect& bounds) SK_OVERRIDE;

View File

@ -19,8 +19,7 @@
class SkBBoxRecord : public SkPictureRecord {
public:
SkBBoxRecord(uint32_t recordFlags, SkBaseDevice* device)
: INHERITED(recordFlags, device) { }
SkBBoxRecord(const SkISize& size, uint32_t recordFlags) : INHERITED(size, recordFlags) {}
virtual ~SkBBoxRecord() { }
/**

View File

@ -193,21 +193,19 @@ SkCanvas* SkPicture::beginRecording(int width, int height,
SkSafeSetNull(fRecord);
SkBitmap bm;
bm.setConfig(SkBitmap::kNo_Config, width, height);
SkAutoTUnref<SkBaseDevice> dev(SkNEW_ARGS(SkBitmapDevice, (bm)));
// Must be set before calling createBBoxHierarchy
fWidth = width;
fHeight = height;
const SkISize size = SkISize::Make(width, height);
if (recordingFlags & kOptimizeForClippedPlayback_RecordingFlag) {
SkBBoxHierarchy* tree = this->createBBoxHierarchy();
SkASSERT(NULL != tree);
fRecord = SkNEW_ARGS(SkBBoxHierarchyRecord, (recordingFlags, tree, dev));
fRecord = SkNEW_ARGS(SkBBoxHierarchyRecord, (size, recordingFlags, tree));
tree->unref();
} else {
fRecord = SkNEW_ARGS(SkPictureRecord, (recordingFlags, dev));
fRecord = SkNEW_ARGS(SkPictureRecord, (size, recordingFlags));
}
fRecord->beginRecording();

View File

@ -28,8 +28,8 @@ static const uint32_t kSaveSize = 2 * kUInt32Size;
static const uint32_t kSaveLayerNoBoundsSize = 4 * kUInt32Size;
static const uint32_t kSaveLayerWithBoundsSize = 4 * kUInt32Size + sizeof(SkRect);
SkPictureRecord::SkPictureRecord(uint32_t flags, SkBaseDevice* device)
: INHERITED(device)
SkPictureRecord::SkPictureRecord(const SkISize& dimensions, uint32_t flags)
: INHERITED(dimensions.width(), dimensions.height())
, fBoundingHierarchy(NULL)
, fStateTree(NULL)
, fFlattenableHeap(HEAP_BLOCK_SIZE)

View File

@ -33,7 +33,7 @@ class SkBBoxHierarchy;
class SkPictureRecord : public SkCanvas {
public:
SkPictureRecord(uint32_t recordFlags, SkBaseDevice*);
SkPictureRecord(const SkISize& dimensions, uint32_t recordFlags);
virtual ~SkPictureRecord();
virtual int save(SaveFlags) SK_OVERRIDE;