diff options
-rw-r--r-- | include/core/SkCanvas.h | 21 | ||||
-rw-r--r-- | src/core/SkCanvas.cpp | 4 | ||||
-rw-r--r-- | src/core/SkPictureRecord.cpp | 5 | ||||
-rw-r--r-- | src/core/SkPictureRecord.h | 2 | ||||
-rw-r--r-- | src/image/SkSurface_Gpu.cpp | 2 | ||||
-rw-r--r-- | src/pipe/SkGPipeWrite.cpp | 19 |
6 files changed, 20 insertions, 33 deletions
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h index 684541feb2..80d46ed9c5 100644 --- a/include/core/SkCanvas.h +++ b/include/core/SkCanvas.h @@ -1085,17 +1085,6 @@ protected: // can perform copy-on-write or invalidate any cached images void predrawNotify(); - /** - DEPRECATED -- need to remove when subclass stop relying on it. - Marked as 'protected' to avoid new clients using this before we can - completely remove it. - - Specify a device for this canvas to draw into. If it is not null, its - reference count is incremented. If the canvas was already holding a - device, its reference count is decremented. The new device is returned. - */ - virtual SkBaseDevice* setDevice(SkBaseDevice* device); - private: class MCRec; @@ -1129,6 +1118,16 @@ private: SkBaseDevice* init(SkBaseDevice*); + /** + * DEPRECATED + * + * Specify a device for this canvas to draw into. If it is not null, its + * reference count is incremented. If the canvas was already holding a + * device, its reference count is decremented. The new device is returned. + */ + SkBaseDevice* setRootDevice(SkBaseDevice* device); + + // internal methods are not virtual, so they can safely be called by other // canvas apis, without confusing subclasses (like SkPictureRecording) void internalDrawBitmap(const SkBitmap&, const SkMatrix& m, const SkPaint* paint); diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp index cffc46aed8..4462b4cc2a 100644 --- a/src/core/SkCanvas.cpp +++ b/src/core/SkCanvas.cpp @@ -501,7 +501,7 @@ SkBaseDevice* SkCanvas::init(SkBaseDevice* device) { fSurfaceBase = NULL; - return this->setDevice(device); + return this->setRootDevice(device); } SkCanvas::SkCanvas() @@ -602,7 +602,7 @@ SkBaseDevice* SkCanvas::getTopDevice(bool updateMatrixClip) const { return fMCRec->fTopLayer->fDevice; } -SkBaseDevice* SkCanvas::setDevice(SkBaseDevice* device) { +SkBaseDevice* SkCanvas::setRootDevice(SkBaseDevice* device) { // return root device SkDeque::F2BIter iter(fMCStack); MCRec* rec = (MCRec*)iter.next(); diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp index 042e6a39cb..babf1e47f1 100644 --- a/src/core/SkPictureRecord.cpp +++ b/src/core/SkPictureRecord.cpp @@ -139,11 +139,6 @@ static inline uint32_t getPaintOffset(DrawType op, uint32_t opSize) { return gPaintOffsets[op] * sizeof(uint32_t) + overflow; } -SkBaseDevice* SkPictureRecord::setDevice(SkBaseDevice* device) { - SkDEBUGFAIL("eeek, don't try to change the device on a recording canvas"); - return this->INHERITED::setDevice(device); -} - int SkPictureRecord::save(SaveFlags flags) { #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE diff --git a/src/core/SkPictureRecord.h b/src/core/SkPictureRecord.h index eaa5e73008..5e37f81c6b 100644 --- a/src/core/SkPictureRecord.h +++ b/src/core/SkPictureRecord.h @@ -36,8 +36,6 @@ public: SkPictureRecord(uint32_t recordFlags, SkBaseDevice*); virtual ~SkPictureRecord(); - virtual SkBaseDevice* setDevice(SkBaseDevice* device) SK_OVERRIDE; - virtual int save(SaveFlags) SK_OVERRIDE; virtual int saveLayer(const SkRect* bounds, const SkPaint*, SaveFlags) SK_OVERRIDE; virtual void restore() SK_OVERRIDE; diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp index d46d8bc74b..746bb06653 100644 --- a/src/image/SkSurface_Gpu.cpp +++ b/src/image/SkSurface_Gpu.cpp @@ -83,7 +83,7 @@ void SkSurface_Gpu::onCopyOnWrite(ContentChangeMode mode) { } SkASSERT(NULL != this->getCachedCanvas()); SkASSERT(this->getCachedCanvas()->getDevice() == fDevice); - this->getCachedCanvas()->setDevice(newDevice); + this->getCachedCanvas()->setRootDevice(newDevice); SkRefCnt_SafeAssign(fDevice, newDevice.get()); } } diff --git a/src/pipe/SkGPipeWrite.cpp b/src/pipe/SkGPipeWrite.cpp index 54e3bead69..adc9cc3a4b 100644 --- a/src/pipe/SkGPipeWrite.cpp +++ b/src/pipe/SkGPipeWrite.cpp @@ -425,11 +425,13 @@ int SkGPipeCanvas::flattenToIndex(SkFlattenable* obj, PaintFlats paintflat) { SkGPipeCanvas::SkGPipeCanvas(SkGPipeController* controller, SkWriter32* writer, uint32_t flags, uint32_t width, uint32_t height) -: fFactorySet(isCrossProcess(flags) ? SkNEW(SkNamedFactorySet) : NULL) -, fWriter(*writer) -, fFlags(flags) -, fFlattenableHeap(FLATTENABLES_TO_KEEP, fFactorySet, isCrossProcess(flags)) -, fFlatDictionary(&fFlattenableHeap) { + : SkCanvas(width, height) + , fFactorySet(isCrossProcess(flags) ? SkNEW(SkNamedFactorySet) : NULL) + , fWriter(*writer) + , fFlags(flags) + , fFlattenableHeap(FLATTENABLES_TO_KEEP, fFactorySet, isCrossProcess(flags)) + , fFlatDictionary(&fFlattenableHeap) +{ fController = controller; fDone = false; fBlockSize = 0; // need first block from controller @@ -437,13 +439,6 @@ SkGPipeCanvas::SkGPipeCanvas(SkGPipeController* controller, fFirstSaveLayerStackLevel = kNoSaveLayer; sk_bzero(fCurrFlatIndex, sizeof(fCurrFlatIndex)); - // we need a device to limit our clip - // We don't allocate pixels for the bitmap - SkBitmap bitmap; - bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height); - SkBaseDevice* device = SkNEW_ARGS(SkBitmapDevice, (bitmap)); - this->setDevice(device)->unref(); - // Tell the reader the appropriate flags to use. if (this->needOpBytes()) { this->writeOp(kReportFlags_DrawOp, fFlags, 0); |