aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/SkBBoxRecord.cpp8
-rw-r--r--src/core/SkBBoxRecord.h2
-rw-r--r--src/core/SkCanvas.cpp18
-rw-r--r--src/core/SkDevice.cpp6
-rw-r--r--src/core/SkPicture.cpp4
-rw-r--r--src/core/SkPicturePlayback.cpp10
-rw-r--r--src/core/SkPicturePlayback.h6
-rw-r--r--src/core/SkPictureRecord.cpp10
-rw-r--r--src/core/SkPictureRecord.h9
-rw-r--r--src/core/SkPictureShader.cpp2
-rw-r--r--src/effects/SkPictureImageFilter.cpp2
-rw-r--r--src/gpu/GrLayerCache.cpp4
-rw-r--r--src/gpu/GrLayerCache.h4
-rw-r--r--src/gpu/GrPictureUtils.cpp35
-rw-r--r--src/gpu/GrPictureUtils.h2
-rw-r--r--src/gpu/SkGpuDevice.cpp6
-rw-r--r--src/pipe/SkGPipeWrite.cpp7
-rw-r--r--src/record/SkRecorder.cpp4
-rw-r--r--src/record/SkRecorder.h3
-rw-r--r--src/utils/SkDeferredCanvas.cpp2
-rw-r--r--src/utils/SkDumpCanvas.cpp10
-rw-r--r--src/utils/SkGatherPixelRefsAndRects.cpp2
-rw-r--r--src/utils/SkLuaCanvas.cpp4
-rw-r--r--src/utils/SkNWayCanvas.cpp2
-rw-r--r--src/utils/SkPictureUtils.cpp2
-rw-r--r--src/utils/SkProxyCanvas.cpp2
-rw-r--r--src/utils/debugger/SkDebugCanvas.cpp2
-rw-r--r--src/utils/debugger/SkDebugCanvas.h4
-rw-r--r--src/utils/debugger/SkDrawCommand.cpp12
-rw-r--r--src/utils/debugger/SkDrawCommand.h4
30 files changed, 100 insertions, 88 deletions
diff --git a/src/core/SkBBoxRecord.cpp b/src/core/SkBBoxRecord.cpp
index b1c229e68b..a40ea8ba0d 100644
--- a/src/core/SkBBoxRecord.cpp
+++ b/src/core/SkBBoxRecord.cpp
@@ -280,10 +280,10 @@ void SkBBoxRecord::drawVertices(VertexMode mode, int vertexCount,
}
}
-void SkBBoxRecord::drawPicture(SkPicture& picture) {
- if (picture.width() > 0 && picture.height() > 0 &&
- this->transformBounds(SkRect::MakeWH(picture.width(), picture.height()), NULL)) {
- INHERITED::drawPicture(picture);
+void SkBBoxRecord::onDrawPicture(const SkPicture* picture) {
+ if (picture->width() > 0 && picture->height() > 0 &&
+ this->transformBounds(SkRect::MakeWH(picture->width(), picture->height()), NULL)) {
+ this->INHERITED::onDrawPicture(picture);
}
}
diff --git a/src/core/SkBBoxRecord.h b/src/core/SkBBoxRecord.h
index f2e9d8d283..123a91f1ec 100644
--- a/src/core/SkBBoxRecord.h
+++ b/src/core/SkBBoxRecord.h
@@ -54,7 +54,6 @@ public:
const SkColor colors[], SkXfermode* xfer,
const uint16_t indices[], int indexCount,
const SkPaint& paint) SK_OVERRIDE;
- virtual void drawPicture(SkPicture& picture) SK_OVERRIDE;
protected:
virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRIDE;
@@ -66,6 +65,7 @@ protected:
SkScalar constY, const SkPaint&) SK_OVERRIDE;
virtual void onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path,
const SkMatrix* matrix, const SkPaint&) SK_OVERRIDE;
+ virtual void onDrawPicture(const SkPicture* picture) SK_OVERRIDE;
private:
/**
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 53dec2ef4c..3134c46686 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -2479,31 +2479,39 @@ void SkCanvas::drawTextOnPathHV(const void* text, size_t byteLength,
}
///////////////////////////////////////////////////////////////////////////////
-void SkCanvas::EXPERIMENTAL_optimize(SkPicture* picture) {
+void SkCanvas::EXPERIMENTAL_optimize(const SkPicture* picture) {
SkBaseDevice* device = this->getDevice();
if (NULL != device) {
device->EXPERIMENTAL_optimize(picture);
}
}
-void SkCanvas::EXPERIMENTAL_purge(SkPicture* picture) {
+void SkCanvas::EXPERIMENTAL_purge(const SkPicture* picture) {
SkBaseDevice* device = this->getTopDevice();
if (NULL != device) {
device->EXPERIMENTAL_purge(picture);
}
}
-void SkCanvas::drawPicture(SkPicture& picture) {
+void SkCanvas::drawPicture(const SkPicture* picture) {
+ if (NULL != picture) {
+ this->onDrawPicture(picture);
+ }
+}
+
+void SkCanvas::onDrawPicture(const SkPicture* picture) {
+ SkASSERT(NULL != picture);
+
SkBaseDevice* device = this->getTopDevice();
if (NULL != device) {
// Canvas has to first give the device the opportunity to render
// the picture itself.
- if (device->EXPERIMENTAL_drawPicture(this, &picture)) {
+ if (device->EXPERIMENTAL_drawPicture(this, picture)) {
return; // the device has rendered the entire picture
}
}
- picture.draw(this);
+ picture->draw(this);
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp
index 36a8a754c0..6c5c0f391d 100644
--- a/src/core/SkDevice.cpp
+++ b/src/core/SkDevice.cpp
@@ -131,15 +131,15 @@ void* SkBaseDevice::onAccessPixels(SkImageInfo* info, size_t* rowBytes) {
return NULL;
}
-void SkBaseDevice::EXPERIMENTAL_optimize(SkPicture* picture) {
+void SkBaseDevice::EXPERIMENTAL_optimize(const SkPicture* picture) {
// The base class doesn't perform any analysis but derived classes may
}
-void SkBaseDevice::EXPERIMENTAL_purge(SkPicture* picture) {
+void SkBaseDevice::EXPERIMENTAL_purge(const SkPicture* picture) {
// Derived-classes may have data to purge but not the base class
}
-bool SkBaseDevice::EXPERIMENTAL_drawPicture(SkCanvas* canvas, SkPicture* picture) {
+bool SkBaseDevice::EXPERIMENTAL_drawPicture(SkCanvas* canvas, const SkPicture* picture) {
// The base class doesn't perform any accelerated picture rendering
return false;
}
diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp
index 00bcbef275..98c0e00c8c 100644
--- a/src/core/SkPicture.cpp
+++ b/src/core/SkPicture.cpp
@@ -366,7 +366,7 @@ const SkPicture::OperationList& SkPicture::OperationList::InvalidList() {
return gInvalid;
}
-const SkPicture::OperationList& SkPicture::EXPERIMENTAL_getActiveOps(const SkIRect& queryRect) {
+const SkPicture::OperationList& SkPicture::EXPERIMENTAL_getActiveOps(const SkIRect& queryRect) const {
SkASSERT(NULL != fPlayback && NULL == fRecord);
if (NULL != fPlayback) {
return fPlayback->getActiveOps(queryRect);
@@ -381,7 +381,7 @@ size_t SkPicture::EXPERIMENTAL_curOpID() const {
return 0;
}
-void SkPicture::draw(SkCanvas* surface, SkDrawPictureCallback* callback) {
+void SkPicture::draw(SkCanvas* surface, SkDrawPictureCallback* callback) const {
SkASSERT(NULL != fPlayback && NULL == fRecord);
if (NULL != fPlayback) {
fPlayback->draw(*surface, callback);
diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp
index 8c77eeb6ac..63f2d7e8f9 100644
--- a/src/core/SkPicturePlayback.cpp
+++ b/src/core/SkPicturePlayback.cpp
@@ -129,10 +129,10 @@ SkPicturePlayback::SkPicturePlayback(const SkPicture* picture,
picture->initForPlayback();
- const SkTDArray<SkPicture* >& pictures = record.getPictureRefs();
+ const SkTDArray<const SkPicture* >& pictures = record.getPictureRefs();
fPictureCount = pictures.count();
if (fPictureCount > 0) {
- fPictureRefs = SkNEW_ARRAY(SkPicture*, fPictureCount);
+ fPictureRefs = SkNEW_ARRAY(const SkPicture*, fPictureCount);
for (int i = 0; i < fPictureCount; i++) {
if (deepCopy) {
fPictureRefs[i] = pictures[i]->clone();
@@ -210,7 +210,7 @@ SkPicturePlayback::SkPicturePlayback(const SkPicture* picture, const SkPicturePl
}
fPictureCount = src.fPictureCount;
- fPictureRefs = SkNEW_ARRAY(SkPicture*, fPictureCount);
+ fPictureRefs = SkNEW_ARRAY(const SkPicture*, fPictureCount);
for (int i = 0; i < fPictureCount; i++) {
if (deepCopyInfo) {
fPictureRefs[i] = src.fPictureRefs[i]->clone();
@@ -505,7 +505,7 @@ bool SkPicturePlayback::parseStreamTag(SkPicture* picture,
} break;
case SK_PICT_PICTURE_TAG: {
fPictureCount = size;
- fPictureRefs = SkNEW_ARRAY(SkPicture*, fPictureCount);
+ fPictureRefs = SkNEW_ARRAY(const SkPicture*, fPictureCount);
bool success = true;
int i = 0;
for ( ; i < fPictureCount; i++) {
@@ -590,7 +590,7 @@ bool SkPicturePlayback::parseBufferTag(SkPicture* picture,
return false;
}
fPictureCount = size;
- fPictureRefs = SkNEW_ARRAY(SkPicture*, fPictureCount);
+ fPictureRefs = SkNEW_ARRAY(const SkPicture*, fPictureCount);
bool success = true;
int i = 0;
for ( ; i < fPictureCount; i++) {
diff --git a/src/core/SkPicturePlayback.h b/src/core/SkPicturePlayback.h
index d6f0cf1919..ea36ca948b 100644
--- a/src/core/SkPicturePlayback.h
+++ b/src/core/SkPicturePlayback.h
@@ -150,10 +150,10 @@ private:
return fPicture->getPath(reader.readInt() - 1);
}
- SkPicture& getPicture(SkReader32& reader) {
+ const SkPicture* getPicture(SkReader32& reader) {
int index = reader.readInt();
SkASSERT(index > 0 && index <= fPictureCount);
- return *fPictureRefs[index - 1];
+ return fPictureRefs[index - 1];
}
const SkPaint* getPaint(SkReader32& reader) {
@@ -246,7 +246,7 @@ private:
SkData* fOpData; // opcodes and parameters
- SkPicture** fPictureRefs;
+ const SkPicture** fPictureRefs;
int fPictureCount;
SkBBoxHierarchy* fBoundingHierarchy;
diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp
index 36b0763e9f..0c59b13b86 100644
--- a/src/core/SkPictureRecord.cpp
+++ b/src/core/SkPictureRecord.cpp
@@ -1411,7 +1411,7 @@ void SkPictureRecord::onDrawTextOnPath(const void* text, size_t byteLength, cons
this->validate(initialOffset, size);
}
-void SkPictureRecord::drawPicture(SkPicture& picture) {
+void SkPictureRecord::onDrawPicture(const SkPicture* picture) {
#ifdef SK_COLLAPSE_MATRIX_CLIP_STATE
fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType);
@@ -1618,12 +1618,12 @@ void SkPictureRecord::addPath(const SkPath& path) {
this->addInt(this->addPathToHeap(path));
}
-void SkPictureRecord::addPicture(SkPicture& picture) {
- int index = fPictureRefs.find(&picture);
+void SkPictureRecord::addPicture(const SkPicture* picture) {
+ int index = fPictureRefs.find(picture);
if (index < 0) { // not found
index = fPictureRefs.count();
- *fPictureRefs.append() = &picture;
- picture.ref();
+ *fPictureRefs.append() = picture;
+ picture->ref();
}
// follow the convention of recording a 1-based index
this->addInt(index + 1);
diff --git a/src/core/SkPictureRecord.h b/src/core/SkPictureRecord.h
index 22d2546072..d6cdf05f28 100644
--- a/src/core/SkPictureRecord.h
+++ b/src/core/SkPictureRecord.h
@@ -55,7 +55,6 @@ public:
const SkRect& dst, const SkPaint*) SK_OVERRIDE;
virtual void drawSprite(const SkBitmap&, int left, int top,
const SkPaint*) SK_OVERRIDE;
- virtual void drawPicture(SkPicture& picture) SK_OVERRIDE;
virtual void drawVertices(VertexMode, int vertexCount,
const SkPoint vertices[], const SkPoint texs[],
const SkColor colors[], SkXfermode*,
@@ -70,7 +69,7 @@ public:
void addFontMetricsTopBottom(const SkPaint& paint, const SkFlatData&,
SkScalar minY, SkScalar maxY);
- const SkTDArray<SkPicture* >& getPictureRefs() const {
+ const SkTDArray<const SkPicture* >& getPictureRefs() const {
return fPictureRefs;
}
@@ -156,7 +155,7 @@ private:
const SkFlatData* addPaintPtr(const SkPaint* paint);
void addFlatPaint(const SkFlatData* flatPaint);
void addPath(const SkPath& path);
- void addPicture(SkPicture& picture);
+ void addPicture(const SkPicture* picture);
void addPoint(const SkPoint& point);
void addPoints(const SkPoint pts[], int count);
void addRect(const SkRect& rect);
@@ -236,6 +235,8 @@ protected:
virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
virtual void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE;
+ virtual void onDrawPicture(const SkPicture* picture) SK_OVERRIDE;
+
// Return fontmetrics.fTop,fBottom in topbot[0,1], after they have been
// tweaked by paint.computeFastBounds().
static void ComputeFontMetricsTopBottom(const SkPaint& paint, SkScalar topbot[2]);
@@ -295,7 +296,7 @@ private:
SkWriter32 fWriter;
// we ref each item in these arrays
- SkTDArray<SkPicture*> fPictureRefs;
+ SkTDArray<const SkPicture*> fPictureRefs;
uint32_t fRecordFlags;
bool fOptsEnabled;
diff --git a/src/core/SkPictureShader.cpp b/src/core/SkPictureShader.cpp
index ecb86e7e71..81e13752f6 100644
--- a/src/core/SkPictureShader.cpp
+++ b/src/core/SkPictureShader.cpp
@@ -92,7 +92,7 @@ SkShader* SkPictureShader::refBitmapShader(const SkMatrix& matrix, const SkMatri
SkCanvas canvas(bm);
canvas.scale(tileScale.width(), tileScale.height());
- canvas.drawPicture(*fPicture);
+ canvas.drawPicture(fPicture);
fCachedTileScale = tileScale;
fCachedLocalMatrix = this->getLocalMatrix();
diff --git a/src/effects/SkPictureImageFilter.cpp b/src/effects/SkPictureImageFilter.cpp
index af9466f977..2d2df9231e 100644
--- a/src/effects/SkPictureImageFilter.cpp
+++ b/src/effects/SkPictureImageFilter.cpp
@@ -85,7 +85,7 @@ bool SkPictureImageFilter::onFilterImage(Proxy* proxy, const SkBitmap&, const Co
canvas.translate(-SkIntToScalar(bounds.fLeft), -SkIntToScalar(bounds.fTop));
canvas.concat(ctx.ctm());
- canvas.drawPicture(*fPicture);
+ canvas.drawPicture(fPicture);
*result = device.get()->accessBitmap(false);
offset->fX = bounds.fLeft;
diff --git a/src/gpu/GrLayerCache.cpp b/src/gpu/GrLayerCache.cpp
index 0621aace44..f6377bf7e9 100644
--- a/src/gpu/GrLayerCache.cpp
+++ b/src/gpu/GrLayerCache.cpp
@@ -66,7 +66,7 @@ void GrLayerCache::freeAll() {
fAtlasMgr.free();
}
-GrCachedLayer* GrLayerCache::createLayer(SkPicture* picture, int layerID) {
+GrCachedLayer* GrLayerCache::createLayer(const SkPicture* picture, int layerID) {
GrCachedLayer* layer = fLayerPool.alloc();
SkASSERT(picture->uniqueID() != SK_InvalidGenID);
@@ -76,7 +76,7 @@ GrCachedLayer* GrLayerCache::createLayer(SkPicture* picture, int layerID) {
}
-GrCachedLayer* GrLayerCache::findLayerOrCreate(SkPicture* picture, int layerID) {
+GrCachedLayer* GrLayerCache::findLayerOrCreate(const SkPicture* picture, int layerID) {
SkASSERT(picture->uniqueID() != SK_InvalidGenID);
GrCachedLayer* layer = fLayerHash.find(PictureLayerKey(picture->uniqueID(), layerID));
if (NULL == layer) {
diff --git a/src/gpu/GrLayerCache.h b/src/gpu/GrLayerCache.h
index 414b87dbb3..a957e78013 100644
--- a/src/gpu/GrLayerCache.h
+++ b/src/gpu/GrLayerCache.h
@@ -102,7 +102,7 @@ public:
void freeAll();
- GrCachedLayer* findLayerOrCreate(SkPicture* picture, int id);
+ GrCachedLayer* findLayerOrCreate(const SkPicture* picture, int id);
private:
SkAutoTUnref<GrGpu> fGpu;
@@ -113,7 +113,7 @@ private:
GrTAllocPool<GrCachedLayer> fLayerPool;
void init();
- GrCachedLayer* createLayer(SkPicture* picture, int id);
+ GrCachedLayer* createLayer(const SkPicture* picture, int id);
};
diff --git a/src/gpu/GrPictureUtils.cpp b/src/gpu/GrPictureUtils.cpp
index f8c2d31843..5166bb154f 100644
--- a/src/gpu/GrPictureUtils.cpp
+++ b/src/gpu/GrPictureUtils.cpp
@@ -29,7 +29,7 @@ class GrGatherDevice : public SkBaseDevice {
public:
SK_DECLARE_INST_COUNT(GrGatherDevice)
- GrGatherDevice(int width, int height, SkPicture* picture, GPUAccelData* accelData,
+ GrGatherDevice(int width, int height, const SkPicture* picture, GPUAccelData* accelData,
int saveLayerDepth) {
fPicture = picture;
fSaveLayerDepth = saveLayerDepth;
@@ -172,7 +172,7 @@ protected:
private:
// The picture being processed
- SkPicture *fPicture;
+ const SkPicture *fPicture;
SkBitmap fEmptyBitmap; // legacy -- need to remove
@@ -223,7 +223,7 @@ private:
// which is all just to fill in 'accelData'
class SK_API GrGatherCanvas : public SkCanvas {
public:
- GrGatherCanvas(GrGatherDevice* device, SkPicture* pict)
+ GrGatherCanvas(GrGatherDevice* device, const SkPicture* pict)
: INHERITED(device)
, fPicture(pict) {
}
@@ -236,20 +236,9 @@ public:
this->clipRect(SkRect::MakeWH(SkIntToScalar(fPicture->width()),
SkIntToScalar(fPicture->height())),
SkRegion::kIntersect_Op, false);
- this->drawPicture(*fPicture);
+ this->drawPicture(fPicture);
}
- virtual void drawPicture(SkPicture& picture) SK_OVERRIDE {
- // BBH-based rendering doesn't re-issue many of the operations the gather
- // process cares about (e.g., saves and restores) so it must be disabled.
- if (NULL != picture.fPlayback) {
- picture.fPlayback->setUseBBH(false);
- }
- picture.draw(this);
- if (NULL != picture.fPlayback) {
- picture.fPlayback->setUseBBH(true);
- }
- }
protected:
// disable aa for speed
virtual void onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle) SK_OVERRIDE {
@@ -266,15 +255,27 @@ protected:
this->updateClipConservativelyUsingBounds(rrect.getBounds(), op, false);
}
+ virtual void onDrawPicture(const SkPicture* picture) SK_OVERRIDE {
+ // BBH-based rendering doesn't re-issue many of the operations the gather
+ // process cares about (e.g., saves and restores) so it must be disabled.
+ if (NULL != picture->fPlayback) {
+ picture->fPlayback->setUseBBH(false);
+ }
+ picture->draw(this);
+ if (NULL != picture->fPlayback) {
+ picture->fPlayback->setUseBBH(true);
+ }
+ }
+
private:
- SkPicture* fPicture;
+ const SkPicture* fPicture;
typedef SkCanvas INHERITED;
};
// GatherGPUInfo is only intended to be called within the context of SkGpuDevice's
// EXPERIMENTAL_optimize method.
-void GatherGPUInfo(SkPicture* pict, GPUAccelData* accelData) {
+void GatherGPUInfo(const SkPicture* pict, GPUAccelData* accelData) {
if (0 == pict->width() || 0 == pict->height()) {
return ;
}
diff --git a/src/gpu/GrPictureUtils.h b/src/gpu/GrPictureUtils.h
index a280a16ce3..a730697d62 100644
--- a/src/gpu/GrPictureUtils.h
+++ b/src/gpu/GrPictureUtils.h
@@ -74,6 +74,6 @@ private:
typedef SkPicture::AccelData INHERITED;
};
-void GatherGPUInfo(SkPicture* pict, GPUAccelData* accelData);
+void GatherGPUInfo(const SkPicture* pict, GPUAccelData* accelData);
#endif // GrPictureUtils_DEFINED
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index b05cd33425..7514359216 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1816,7 +1816,7 @@ SkSurface* SkGpuDevice::newSurface(const SkImageInfo& info) {
return SkSurface::NewRenderTarget(fContext, info, fRenderTarget->numSamples());
}
-void SkGpuDevice::EXPERIMENTAL_optimize(SkPicture* picture) {
+void SkGpuDevice::EXPERIMENTAL_optimize(const SkPicture* picture) {
SkPicture::AccelData::Key key = GPUAccelData::ComputeAccelDataKey();
const SkPicture::AccelData* existing = picture->EXPERIMENTAL_getAccelData(key);
@@ -1837,11 +1837,11 @@ static void wrap_texture(GrTexture* texture, int width, int height, SkBitmap* re
result->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, texture)))->unref();
}
-void SkGpuDevice::EXPERIMENTAL_purge(SkPicture* picture) {
+void SkGpuDevice::EXPERIMENTAL_purge(const SkPicture* picture) {
}
-bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* canvas, SkPicture* picture) {
+bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* canvas, const SkPicture* picture) {
SkPicture::AccelData::Key key = GPUAccelData::ComputeAccelDataKey();
diff --git a/src/pipe/SkGPipeWrite.cpp b/src/pipe/SkGPipeWrite.cpp
index 4a5dcd51a0..a3c38646bb 100644
--- a/src/pipe/SkGPipeWrite.cpp
+++ b/src/pipe/SkGPipeWrite.cpp
@@ -249,7 +249,6 @@ public:
const SkRect& dst, const SkPaint* paint = NULL) SK_OVERRIDE;
virtual void drawSprite(const SkBitmap&, int left, int top,
const SkPaint*) SK_OVERRIDE;
- virtual void drawPicture(SkPicture& picture) SK_OVERRIDE;
virtual void drawVertices(VertexMode, int vertexCount,
const SkPoint vertices[], const SkPoint texs[],
const SkColor colors[], SkXfermode*,
@@ -289,6 +288,8 @@ protected:
virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
virtual void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE;
+ virtual void onDrawPicture(const SkPicture* picture) SK_OVERRIDE;
+
private:
void recordTranslate(const SkMatrix&);
void recordScale(const SkMatrix&);
@@ -929,9 +930,9 @@ void SkGPipeCanvas::onDrawTextOnPath(const void* text, size_t byteLength, const
}
}
-void SkGPipeCanvas::drawPicture(SkPicture& picture) {
+void SkGPipeCanvas::onDrawPicture(const SkPicture* picture) {
// we want to playback the picture into individual draw calls
- this->INHERITED::drawPicture(picture);
+ this->INHERITED::onDrawPicture(picture);
}
void SkGPipeCanvas::drawVertices(VertexMode vmode, int vertexCount,
diff --git a/src/record/SkRecorder.cpp b/src/record/SkRecorder.cpp
index 74101c1bed..8581257c4a 100644
--- a/src/record/SkRecorder.cpp
+++ b/src/record/SkRecorder.cpp
@@ -186,8 +186,8 @@ void SkRecorder::onDrawTextOnPath(const void* text, size_t byteLength, const SkP
this->copy(matrix));
}
-void SkRecorder::drawPicture(SkPicture& picture) {
- picture.draw(this);
+void SkRecorder::onDrawPicture(const SkPicture* picture) {
+ picture->draw(this);
}
void SkRecorder::drawVertices(VertexMode vmode,
diff --git a/src/record/SkRecorder.h b/src/record/SkRecorder.h
index cee25c152b..3e2932d42e 100644
--- a/src/record/SkRecorder.h
+++ b/src/record/SkRecorder.h
@@ -52,7 +52,6 @@ public:
int left,
int top,
const SkPaint* paint = NULL) SK_OVERRIDE;
- void drawPicture(SkPicture& picture) SK_OVERRIDE;
void drawVertices(VertexMode vmode,
int vertexCount,
const SkPoint vertices[],
@@ -95,6 +94,8 @@ public:
void onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edgeStyle) SK_OVERRIDE;
void onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) SK_OVERRIDE;
+ void onDrawPicture(const SkPicture* picture) SK_OVERRIDE;
+
void onPushCull(const SkRect& cullRect) SK_OVERRIDE;
void onPopCull() SK_OVERRIDE;
diff --git a/src/utils/SkDeferredCanvas.cpp b/src/utils/SkDeferredCanvas.cpp
index 02c2c5af28..e244505263 100644
--- a/src/utils/SkDeferredCanvas.cpp
+++ b/src/utils/SkDeferredCanvas.cpp
@@ -936,7 +936,7 @@ void SkDeferredCanvas::onDrawTextOnPath(const void* text, size_t byteLength, con
this->recordedDrawCommand();
}
-void SkDeferredCanvas::drawPicture(SkPicture& picture) {
+void SkDeferredCanvas::onDrawPicture(const SkPicture* picture) {
this->drawingCanvas()->drawPicture(picture);
this->recordedDrawCommand();
}
diff --git a/src/utils/SkDumpCanvas.cpp b/src/utils/SkDumpCanvas.cpp
index 9814fb5762..4dfed395e0 100644
--- a/src/utils/SkDumpCanvas.cpp
+++ b/src/utils/SkDumpCanvas.cpp
@@ -422,14 +422,14 @@ void SkDumpCanvas::onDrawTextOnPath(const void* text, size_t byteLength, const S
str.c_str(), byteLength);
}
-void SkDumpCanvas::drawPicture(SkPicture& picture) {
- this->dump(kDrawPicture_Verb, NULL, "drawPicture(%p) %d:%d", &picture,
- picture.width(), picture.height());
+void SkDumpCanvas::onDrawPicture(const SkPicture* picture) {
+ this->dump(kDrawPicture_Verb, NULL, "drawPicture(%p) %d:%d", picture,
+ picture->width(), picture->height());
fNestLevel += 1;
- this->INHERITED::drawPicture(picture);
+ this->INHERITED::onDrawPicture(picture);
fNestLevel -= 1;
this->dump(kDrawPicture_Verb, NULL, "endPicture(%p) %d:%d", &picture,
- picture.width(), picture.height());
+ picture->width(), picture->height());
}
void SkDumpCanvas::drawVertices(VertexMode vmode, int vertexCount,
diff --git a/src/utils/SkGatherPixelRefsAndRects.cpp b/src/utils/SkGatherPixelRefsAndRects.cpp
index 320d99694a..f46fe8ed42 100644
--- a/src/utils/SkGatherPixelRefsAndRects.cpp
+++ b/src/utils/SkGatherPixelRefsAndRects.cpp
@@ -21,5 +21,5 @@ void SkPictureUtils::GatherPixelRefsAndRects(SkPicture* pict,
canvas.clipRect(SkRect::MakeWH(SkIntToScalar(pict->width()),
SkIntToScalar(pict->height())),
SkRegion::kIntersect_Op, false);
- canvas.drawPicture(*pict);
+ canvas.drawPicture(pict);
}
diff --git a/src/utils/SkLuaCanvas.cpp b/src/utils/SkLuaCanvas.cpp
index b4c7c771c3..d9c5dc1d76 100644
--- a/src/utils/SkLuaCanvas.cpp
+++ b/src/utils/SkLuaCanvas.cpp
@@ -268,10 +268,10 @@ void SkLuaCanvas::onDrawTextOnPath(const void* text, size_t byteLength, const Sk
lua.pushPaint(paint, "paint");
}
-void SkLuaCanvas::drawPicture(SkPicture& picture) {
+void SkLuaCanvas::onDrawPicture(const SkPicture* picture) {
AUTO_LUA("drawPicture");
// call through so we can see the nested picture ops
- this->INHERITED::drawPicture(picture);
+ this->INHERITED::onDrawPicture(picture);
}
void SkLuaCanvas::drawVertices(VertexMode vmode, int vertexCount,
diff --git a/src/utils/SkNWayCanvas.cpp b/src/utils/SkNWayCanvas.cpp
index 3c98e4be09..505c05cbf1 100644
--- a/src/utils/SkNWayCanvas.cpp
+++ b/src/utils/SkNWayCanvas.cpp
@@ -265,7 +265,7 @@ void SkNWayCanvas::onDrawTextOnPath(const void* text, size_t byteLength, const S
}
}
-void SkNWayCanvas::drawPicture(SkPicture& picture) {
+void SkNWayCanvas::onDrawPicture(const SkPicture* picture) {
Iter iter(fList);
while (iter.next()) {
iter->drawPicture(picture);
diff --git a/src/utils/SkPictureUtils.cpp b/src/utils/SkPictureUtils.cpp
index a2d6da131e..02fa6b11c4 100644
--- a/src/utils/SkPictureUtils.cpp
+++ b/src/utils/SkPictureUtils.cpp
@@ -214,7 +214,7 @@ SkData* SkPictureUtils::GatherPixelRefs(SkPicture* pict, const SkRect& area) {
SkNoSaveLayerCanvas canvas(&device);
canvas.clipRect(area, SkRegion::kIntersect_Op, false);
- canvas.drawPicture(*pict);
+ canvas.drawPicture(pict);
SkData* data = NULL;
int count = array.count();
diff --git a/src/utils/SkProxyCanvas.cpp b/src/utils/SkProxyCanvas.cpp
index 20f93071c0..5cb54698f6 100644
--- a/src/utils/SkProxyCanvas.cpp
+++ b/src/utils/SkProxyCanvas.cpp
@@ -136,7 +136,7 @@ void SkProxyCanvas::onDrawTextOnPath(const void* text, size_t byteLength, const
fProxy->drawTextOnPath(text, byteLength, path, matrix, paint);
}
-void SkProxyCanvas::drawPicture(SkPicture& picture) {
+void SkProxyCanvas::onDrawPicture(const SkPicture* picture) {
fProxy->drawPicture(picture);
}
diff --git a/src/utils/debugger/SkDebugCanvas.cpp b/src/utils/debugger/SkDebugCanvas.cpp
index 89a388e110..8f6dc1b7a2 100644
--- a/src/utils/debugger/SkDebugCanvas.cpp
+++ b/src/utils/debugger/SkDebugCanvas.cpp
@@ -519,7 +519,7 @@ void SkDebugCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
this->addDrawCommand(new SkDrawPathCommand(path, paint));
}
-void SkDebugCanvas::drawPicture(SkPicture& picture) {
+void SkDebugCanvas::onDrawPicture(const SkPicture* picture) {
this->addDrawCommand(new SkDrawPictureCommand(picture));
}
diff --git a/src/utils/debugger/SkDebugCanvas.h b/src/utils/debugger/SkDebugCanvas.h
index e94f30f335..f15b397251 100644
--- a/src/utils/debugger/SkDebugCanvas.h
+++ b/src/utils/debugger/SkDebugCanvas.h
@@ -189,8 +189,6 @@ public:
virtual void drawPath(const SkPath& path, const SkPaint&) SK_OVERRIDE;
- virtual void drawPicture(SkPicture& picture) SK_OVERRIDE;
-
virtual void drawPoints(PointMode, size_t count, const SkPoint pts[],
const SkPaint&) SK_OVERRIDE;
@@ -257,6 +255,8 @@ protected:
virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
virtual void onClipRegion(const SkRegion& region, SkRegion::Op) SK_OVERRIDE;
+ virtual void onDrawPicture(const SkPicture* picture) SK_OVERRIDE;
+
void markActiveCommands(int index);
private:
diff --git a/src/utils/debugger/SkDrawCommand.cpp b/src/utils/debugger/SkDrawCommand.cpp
index 079961ae70..7c73cec786 100644
--- a/src/utils/debugger/SkDrawCommand.cpp
+++ b/src/utils/debugger/SkDrawCommand.cpp
@@ -502,11 +502,11 @@ bool SkDrawPathCommand::render(SkCanvas* canvas) const {
return true;
}
-SkDrawPictureCommand::SkDrawPictureCommand(SkPicture& picture)
+SkDrawPictureCommand::SkDrawPictureCommand(const SkPicture* picture)
: INHERITED(DRAW_PICTURE)
- , fPicture(picture) {
+ , fPicture(SkRef(picture)) {
SkString* temp = new SkString;
- temp->appendf("SkPicture: W: %d H: %d", picture.width(), picture.height());
+ temp->appendf("SkPicture: W: %d H: %d", picture->width(), picture->height());
fInfo.push(temp);
}
@@ -518,11 +518,11 @@ bool SkDrawPictureCommand::render(SkCanvas* canvas) const {
canvas->clear(0xFFFFFFFF);
canvas->save();
- SkRect bounds = SkRect::MakeWH(SkIntToScalar(fPicture.width()),
- SkIntToScalar(fPicture.height()));
+ SkRect bounds = SkRect::MakeWH(SkIntToScalar(fPicture->width()),
+ SkIntToScalar(fPicture->height()));
xlate_and_scale_to_bounds(canvas, bounds);
- canvas->drawPicture(const_cast<SkPicture&>(fPicture));
+ canvas->drawPicture(fPicture.get());
canvas->restore();
diff --git a/src/utils/debugger/SkDrawCommand.h b/src/utils/debugger/SkDrawCommand.h
index f2e151ae4f..a0bfb2ddca 100644
--- a/src/utils/debugger/SkDrawCommand.h
+++ b/src/utils/debugger/SkDrawCommand.h
@@ -343,12 +343,12 @@ private:
class SkDrawPictureCommand : public SkDrawCommand {
public:
- SkDrawPictureCommand(SkPicture& picture);
+ SkDrawPictureCommand(const SkPicture* picture);
virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
virtual bool render(SkCanvas* canvas) const SK_OVERRIDE;
private:
- SkPicture fPicture;
+ SkAutoTUnref<const SkPicture> fPicture;
typedef SkDrawCommand INHERITED;
};