add getMetaData() to SkCanvas (as part of our master plan to remove
subclasses of SkCanvas and SkDevice from our clients. git-svn-id: http://skia.googlecode.com/svn/trunk@5679 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
7064e9a3fc
commit
74bb77ee4c
@ -25,6 +25,7 @@ class SkBounder;
|
||||
class SkDevice;
|
||||
class SkDraw;
|
||||
class SkDrawFilter;
|
||||
class SkMetaData;
|
||||
class SkPicture;
|
||||
class SkSurface_Base;
|
||||
|
||||
@ -62,6 +63,8 @@ public:
|
||||
explicit SkCanvas(const SkBitmap& bitmap);
|
||||
virtual ~SkCanvas();
|
||||
|
||||
SkMetaData& getMetaData();
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
@ -986,6 +989,8 @@ private:
|
||||
SkDevice* fLastDeviceToGainFocus;
|
||||
int fSaveLayerCount; // number of successful saveLayer calls
|
||||
|
||||
SkMetaData* fMetaData;
|
||||
|
||||
SkSurface_Base* fSurfaceBase;
|
||||
SkSurface_Base* getSurfaceBase() const { return fSurfaceBase; }
|
||||
void setSurfaceBase(SkSurface_Base* sb) {
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "SkDraw.h"
|
||||
#include "SkDrawFilter.h"
|
||||
#include "SkDrawLooper.h"
|
||||
#include "SkMetaData.h"
|
||||
#include "SkPicture.h"
|
||||
#include "SkRasterClip.h"
|
||||
#include "SkScalarCompare.h"
|
||||
@ -457,6 +458,7 @@ SkDevice* SkCanvas::init(SkDevice* device) {
|
||||
fLastDeviceToGainFocus = NULL;
|
||||
fDeviceCMDirty = false;
|
||||
fSaveLayerCount = 0;
|
||||
fMetaData = NULL;
|
||||
|
||||
fMCRec = (MCRec*)fMCStack.push_back();
|
||||
new (fMCRec) MCRec(NULL, 0);
|
||||
@ -503,6 +505,7 @@ SkCanvas::~SkCanvas() {
|
||||
this->internalRestore(); // restore the last, since we're going away
|
||||
|
||||
SkSafeUnref(fBounder);
|
||||
SkDELETE(fMetaData);
|
||||
|
||||
dec_canvas();
|
||||
}
|
||||
@ -521,6 +524,15 @@ SkDrawFilter* SkCanvas::setDrawFilter(SkDrawFilter* filter) {
|
||||
return filter;
|
||||
}
|
||||
|
||||
SkMetaData& SkCanvas::getMetaData() {
|
||||
// metadata users are rare, so we lazily allocate it. If that changes we
|
||||
// can decide to just make it a field in the device (rather than a ptr)
|
||||
if (NULL == fMetaData) {
|
||||
fMetaData = new SkMetaData;
|
||||
}
|
||||
return *fMetaData;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void SkCanvas::flush() {
|
||||
|
Loading…
Reference in New Issue
Block a user