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 "SkBitmap.h"
|
||||||
#include "SkCanvas.h"
|
#include "SkCanvas.h"
|
||||||
#include "SkColor.h"
|
#include "SkColor.h"
|
||||||
#include "SkRefDict.h"
|
|
||||||
|
|
||||||
class SkClipStack;
|
class SkClipStack;
|
||||||
class SkDevice;
|
class SkDevice;
|
||||||
class SkDraw;
|
class SkDraw;
|
||||||
struct SkIRect;
|
struct SkIRect;
|
||||||
class SkMatrix;
|
class SkMatrix;
|
||||||
|
class SkMetaData;
|
||||||
class SkRegion;
|
class SkRegion;
|
||||||
|
|
||||||
/** \class SkDeviceFactory
|
/** \class SkDeviceFactory
|
||||||
@ -63,6 +63,7 @@ public:
|
|||||||
@param bitmap A copy of this bitmap is made and stored in the device
|
@param bitmap A copy of this bitmap is made and stored in the device
|
||||||
*/
|
*/
|
||||||
SkDevice(SkCanvas*, const SkBitmap& bitmap, bool forOffscreen);
|
SkDevice(SkCanvas*, const SkBitmap& bitmap, bool forOffscreen);
|
||||||
|
virtual ~SkDevice();
|
||||||
|
|
||||||
virtual SkDeviceFactory* getDeviceFactory() {
|
virtual SkDeviceFactory* getDeviceFactory() {
|
||||||
return SkNEW(SkRasterDeviceFactory);
|
return SkNEW(SkRasterDeviceFactory);
|
||||||
@ -223,7 +224,7 @@ public:
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
SkRefDict& getRefDict() { return fRefDict; }
|
SkMetaData& getMetaData();
|
||||||
|
|
||||||
struct TextFlags {
|
struct TextFlags {
|
||||||
uint32_t fFlags; // SkPaint::getFlags()
|
uint32_t fFlags; // SkPaint::getFlags()
|
||||||
@ -261,8 +262,8 @@ private:
|
|||||||
|
|
||||||
SkCanvas* fCanvas;
|
SkCanvas* fCanvas;
|
||||||
SkBitmap fBitmap;
|
SkBitmap fBitmap;
|
||||||
SkRefDict fRefDict;
|
|
||||||
SkIPoint fOrigin;
|
SkIPoint fOrigin;
|
||||||
|
SkMetaData* fMetaData;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
#include "SkDevice.h"
|
#include "SkDevice.h"
|
||||||
#include "SkDraw.h"
|
#include "SkDraw.h"
|
||||||
|
#include "SkMetaData.h"
|
||||||
#include "SkRect.h"
|
#include "SkRect.h"
|
||||||
|
|
||||||
SkDeviceFactory::~SkDeviceFactory() {}
|
SkDeviceFactory::~SkDeviceFactory() {}
|
||||||
|
|
||||||
SkDevice::SkDevice(SkCanvas* canvas) : fCanvas(canvas) {
|
SkDevice::SkDevice(SkCanvas* canvas) : fCanvas(canvas), fMetaData(NULL) {
|
||||||
fOrigin.setZero();
|
fOrigin.setZero();
|
||||||
}
|
}
|
||||||
|
|
||||||
SkDevice::SkDevice(SkCanvas* canvas, const SkBitmap& bitmap, bool isForLayer)
|
SkDevice::SkDevice(SkCanvas* canvas, const SkBitmap& bitmap, bool isForLayer)
|
||||||
: fCanvas(canvas), fBitmap(bitmap) {
|
: fCanvas(canvas), fBitmap(bitmap), fMetaData(NULL) {
|
||||||
fOrigin.setZero();
|
fOrigin.setZero();
|
||||||
// auto-allocate if we're for offscreen drawing
|
// auto-allocate if we're for offscreen drawing
|
||||||
if (isForLayer) {
|
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() {
|
void SkDevice::lockPixels() {
|
||||||
fBitmap.lockPixels();
|
fBitmap.lockPixels();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user