virtual void setMatrixClip(const SkMatrix&, const SkRegion&,
const SkClipStack&);
- /**
- * Observer interface for listening to the calls to
- * SkDevice::setMatrixClip(...). Users of SkDevice instances should
- * implement matrixClipChanged(...) to receive notifications.
- */
- class SkMatrixClipObserver : public SkRefCnt {
- public:
- virtual void matrixClipChanged(const SkMatrix&, const SkRegion&,
- const SkClipStack&) = 0;
- };
-
- /** Assign the clip observer. Note that an extra reference is added to the
- * observer, and removed at SkDevice construction, or re-assignment of a
- * different observer.
- */
- void setMatrixClipObserver(SkMatrixClipObserver* observer);
-
- /** Return the device's associated SkMatrixClipObserver, or NULL.
- * If non-null is returned, the reference count of the object is not
- * modified.
- */
- SkMatrixClipObserver* getMatrixClipObserver() const {
- return fMatrixClipObserver;
- }
-
/** Called when this device gains focus (i.e becomes the current device
for drawing).
*/
SkIPoint fOrigin;
SkMetaData* fMetaData;
- SkMatrixClipObserver* fMatrixClipObserver;
-
SkDeviceFactory* fCachedDeviceFactory;
};
///////////////////////////////////////////////////////////////////////////////
-SkDevice::SkDevice(SkCanvas* canvas) : fCanvas(canvas), fMetaData(NULL), fMatrixClipObserver(NULL) {
+SkDevice::SkDevice(SkCanvas* canvas) : fCanvas(canvas), fMetaData(NULL) {
fOrigin.setZero();
fCachedDeviceFactory = NULL;
}
SkDevice::SkDevice(SkCanvas* canvas, const SkBitmap& bitmap, bool isForLayer)
- : fCanvas(canvas), fBitmap(bitmap), fMetaData(NULL), fMatrixClipObserver(NULL) {
+ : fCanvas(canvas), fBitmap(bitmap), fMetaData(NULL) {
fOrigin.setZero();
// auto-allocate if we're for offscreen drawing
if (isForLayer) {
SkDevice::~SkDevice() {
delete fMetaData;
SkSafeUnref(fCachedDeviceFactory);
- SkSafeUnref(fMatrixClipObserver);
}
SkDeviceFactory* SkDevice::onNewDeviceFactory() {
void SkDevice::setMatrixClip(const SkMatrix& matrix, const SkRegion& region,
const SkClipStack& clipStack) {
- if (fMatrixClipObserver) {
- fMatrixClipObserver->matrixClipChanged(matrix, region, clipStack);
- }
-}
-
-void SkDevice::setMatrixClipObserver(SkMatrixClipObserver* observer) {
- SkRefCnt_SafeAssign(fMatrixClipObserver, observer);
}
///////////////////////////////////////////////////////////////////////////////