replace SkRefDict with SkMetaData (much more general)
git-svn-id: http://skia.googlecode.com/svn/trunk@1025 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
0e6dc0a320
commit
a7d948523d
@ -21,13 +21,13 @@
|
||||
#include "SkBitmap.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkColor.h"
|
||||
#include "SkRefDict.h"
|
||||
|
||||
class SkClipStack;
|
||||
class SkDevice;
|
||||
class SkDraw;
|
||||
struct SkIRect;
|
||||
class SkMatrix;
|
||||
class SkMetaData;
|
||||
class SkRegion;
|
||||
|
||||
/** \class SkDeviceFactory
|
||||
@ -63,6 +63,7 @@ public:
|
||||
@param bitmap A copy of this bitmap is made and stored in the device
|
||||
*/
|
||||
SkDevice(SkCanvas*, const SkBitmap& bitmap, bool forOffscreen);
|
||||
virtual ~SkDevice();
|
||||
|
||||
virtual SkDeviceFactory* getDeviceFactory() {
|
||||
return SkNEW(SkRasterDeviceFactory);
|
||||
@ -223,7 +224,7 @@ public:
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SkRefDict& getRefDict() { return fRefDict; }
|
||||
SkMetaData& getMetaData();
|
||||
|
||||
struct TextFlags {
|
||||
uint32_t fFlags; // SkPaint::getFlags()
|
||||
@ -261,8 +262,8 @@ private:
|
||||
|
||||
SkCanvas* fCanvas;
|
||||
SkBitmap fBitmap;
|
||||
SkRefDict fRefDict;
|
||||
SkIPoint fOrigin;
|
||||
SkMetaData* fMetaData;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,15 +1,16 @@
|
||||
#include "SkDevice.h"
|
||||
#include "SkDraw.h"
|
||||
#include "SkMetaData.h"
|
||||
#include "SkRect.h"
|
||||
|
||||
SkDeviceFactory::~SkDeviceFactory() {}
|
||||
|
||||
SkDevice::SkDevice(SkCanvas* canvas) : fCanvas(canvas) {
|
||||
SkDevice::SkDevice(SkCanvas* canvas) : fCanvas(canvas), fMetaData(NULL) {
|
||||
fOrigin.setZero();
|
||||
}
|
||||
|
||||
SkDevice::SkDevice(SkCanvas* canvas, const SkBitmap& bitmap, bool isForLayer)
|
||||
: fCanvas(canvas), fBitmap(bitmap) {
|
||||
: fCanvas(canvas), fBitmap(bitmap), fMetaData(NULL) {
|
||||
fOrigin.setZero();
|
||||
// auto-allocate if we're for offscreen drawing
|
||||
if (isForLayer) {
|
||||
@ -22,6 +23,19 @@ SkDevice::SkDevice(SkCanvas* canvas, const SkBitmap& bitmap, bool isForLayer)
|
||||
}
|
||||
}
|
||||
|
||||
SkDevice::~SkDevice() {
|
||||
delete fMetaData;
|
||||
}
|
||||
|
||||
SkMetaData& SkDevice::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 SkDevice::lockPixels() {
|
||||
fBitmap.lockPixels();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user