still trying to kill setDevice: rename to setRootDevice (better name) and make private
BUG=skia: COLLABORATOR=reed@google.com R=bsalomon@google.com, scroggo@google.com, reed@google.com Author: reed@chromium.org Review URL: https://codereview.chromium.org/169023002 git-svn-id: http://skia.googlecode.com/svn/trunk@13476 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
93f5e51621
commit
403f8d7a05
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user