Rename SkCanvasDrawable to SkDrawable, and make public
(patchset #2 id:20001 of https://codereview.chromium.org/903993002/)"
This reverts commit c4e8772492
.
BUG=skia:
TBR=
NOTREECHECKS=True
Review URL: https://codereview.chromium.org/898343004
This commit is contained in:
parent
c4e8772492
commit
3cb3840c9a
@ -48,8 +48,6 @@
|
||||
'<(skia_src_path)/core/SkBuffer.cpp',
|
||||
'<(skia_src_path)/core/SkCachedData.cpp',
|
||||
'<(skia_src_path)/core/SkCanvas.cpp',
|
||||
'<(skia_src_path)/core/SkCanvasDrawable.cpp',
|
||||
'<(skia_src_path)/core/SkCanvasDrawable.h',
|
||||
'<(skia_src_path)/core/SkChunkAlloc.cpp',
|
||||
'<(skia_src_path)/core/SkClipStack.cpp',
|
||||
'<(skia_src_path)/core/SkColor.cpp',
|
||||
@ -78,6 +76,7 @@
|
||||
'<(skia_src_path)/core/SkDistanceFieldGen.h',
|
||||
'<(skia_src_path)/core/SkDither.cpp',
|
||||
'<(skia_src_path)/core/SkDraw.cpp',
|
||||
'<(skia_src_path)/core/SkDrawable.cpp',
|
||||
'<(skia_src_path)/core/SkDrawLooper.cpp',
|
||||
'<(skia_src_path)/core/SkDrawProcs.h',
|
||||
'<(skia_src_path)/core/SkEdgeBuilder.cpp',
|
||||
@ -255,6 +254,7 @@
|
||||
'<(skia_include_path)/core/SkDevice.h',
|
||||
'<(skia_include_path)/core/SkDither.h',
|
||||
'<(skia_include_path)/core/SkDraw.h',
|
||||
'<(skia_include_path)/core/SkDrawable.h',
|
||||
'<(skia_include_path)/core/SkDrawFilter.h',
|
||||
'<(skia_include_path)/core/SkDrawLooper.h',
|
||||
'<(skia_include_path)/core/SkEndian.h',
|
||||
|
@ -21,8 +21,8 @@
|
||||
|
||||
class SkBaseDevice;
|
||||
class SkCanvasClipVisitor;
|
||||
class SkCanvasDrawable;
|
||||
class SkDraw;
|
||||
class SkDrawable;
|
||||
class SkDrawFilter;
|
||||
class SkImage;
|
||||
class SkMetaData;
|
||||
@ -1018,7 +1018,15 @@ public:
|
||||
void drawPatch(const SkPoint cubics[12], const SkColor colors[4],
|
||||
const SkPoint texCoords[4], SkXfermode* xmode, const SkPaint& paint);
|
||||
|
||||
void EXPERIMENTAL_drawDrawable(SkCanvasDrawable*);
|
||||
/**
|
||||
* Draw the contents of this drawable into the canvas. If the canvas is async
|
||||
* (e.g. it is recording into a picture) then the drawable will be referenced instead,
|
||||
* to have its draw() method called when the picture is finalized.
|
||||
*
|
||||
* If the intent is to force the contents of the drawable into this canvas immediately,
|
||||
* then drawable->draw(canvas) may be called.
|
||||
*/
|
||||
void drawDrawable(SkDrawable* drawable);
|
||||
|
||||
/** Add comments. beginCommentGroup/endCommentGroup open/close a new group.
|
||||
Each comment added via addComment is notionally attached to its
|
||||
@ -1188,7 +1196,7 @@ protected:
|
||||
virtual void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
|
||||
const SkPoint texCoords[4], SkXfermode* xmode, const SkPaint& paint);
|
||||
|
||||
virtual void onDrawDrawable(SkCanvasDrawable*);
|
||||
virtual void onDrawDrawable(SkDrawable*);
|
||||
|
||||
virtual void onDrawPaint(const SkPaint&);
|
||||
virtual void onDrawRect(const SkRect&, const SkPaint&);
|
||||
|
@ -5,8 +5,8 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#ifndef SkCanvasDrawable_DEFINED
|
||||
#define SkCanvasDrawable_DEFINED
|
||||
#ifndef SkDrawable_DEFINED
|
||||
#define SkDrawable_DEFINED
|
||||
|
||||
#include "SkRefCnt.h"
|
||||
|
||||
@ -21,9 +21,9 @@ struct SkRect;
|
||||
* allow for clients of the drawable that may want to cache the results, the drawable must
|
||||
* change its generation ID whenever its internal state changes such that it will draw differently.
|
||||
*/
|
||||
class SkCanvasDrawable : public SkRefCnt {
|
||||
class SkDrawable : public SkRefCnt {
|
||||
public:
|
||||
SkCanvasDrawable();
|
||||
SkDrawable();
|
||||
|
||||
/**
|
||||
* Draws into the specified content. The drawing sequence will be balanced upon return
|
||||
@ -60,6 +60,13 @@ public:
|
||||
protected:
|
||||
virtual SkRect onGetBounds() = 0;
|
||||
virtual void onDraw(SkCanvas*) = 0;
|
||||
|
||||
/**
|
||||
* Default implementation calls onDraw() with a canvas that records into a picture. Subclasses
|
||||
* may override if they have a more efficient way to return a picture for the current state
|
||||
* of their drawable. Note: this picture must draw the same as what would be drawn from
|
||||
* onDraw().
|
||||
*/
|
||||
virtual SkPicture* onNewPictureSnapshot();
|
||||
|
||||
private:
|
@ -19,7 +19,7 @@ namespace android {
|
||||
#endif
|
||||
|
||||
class SkCanvas;
|
||||
class SkCanvasDrawable;
|
||||
class SkDrawable;
|
||||
class SkPictureRecord;
|
||||
class SkRecord;
|
||||
class SkRecorder;
|
||||
@ -79,7 +79,7 @@ public:
|
||||
* and therefore this drawable will reflect the current state of those nested drawables anytime
|
||||
* it is drawn or a new picture is snapped from it (by calling drawable->newPictureSnapshot()).
|
||||
*/
|
||||
SkCanvasDrawable* EXPERIMENTAL_endRecordingAsDrawable();
|
||||
SkDrawable* endRecordingAsDrawable();
|
||||
|
||||
// Legacy API -- use endRecordingAsPicture instead.
|
||||
SkPicture* endRecording() { return this->endRecordingAsPicture(); }
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "SkAnimTimer.h"
|
||||
#include "SkView.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkDrawable.h"
|
||||
#include "SkGradientShader.h"
|
||||
#include "SkPath.h"
|
||||
#include "SkRegion.h"
|
||||
@ -24,8 +25,6 @@
|
||||
#include "SkColorFilter.h"
|
||||
#include "SkLayerRasterizer.h"
|
||||
|
||||
#include "SkCanvasDrawable.h"
|
||||
|
||||
#include "SkParsePath.h"
|
||||
static void testparse() {
|
||||
SkRect r;
|
||||
@ -40,7 +39,7 @@ static void testparse() {
|
||||
}
|
||||
|
||||
class ArcsView : public SampleView {
|
||||
class MyDrawable : public SkCanvasDrawable {
|
||||
class MyDrawable : public SkDrawable {
|
||||
SkRect fR;
|
||||
SkScalar fSweep;
|
||||
public:
|
||||
@ -84,7 +83,7 @@ class ArcsView : public SampleView {
|
||||
public:
|
||||
SkRect fRect;
|
||||
MyDrawable* fAnimatingDrawable;
|
||||
SkCanvasDrawable* fRootDrawable;
|
||||
SkDrawable* fRootDrawable;
|
||||
|
||||
ArcsView() {
|
||||
testparse();
|
||||
@ -97,7 +96,7 @@ public:
|
||||
|
||||
SkPictureRecorder recorder;
|
||||
this->drawRoot(recorder.beginRecording(SkRect::MakeWH(800, 500)));
|
||||
fRootDrawable = recorder.EXPERIMENTAL_endRecordingAsDrawable();
|
||||
fRootDrawable = recorder.endRecordingAsDrawable();
|
||||
}
|
||||
|
||||
~ArcsView() SK_OVERRIDE {
|
||||
@ -190,13 +189,13 @@ protected:
|
||||
|
||||
DrawRectWithLines(canvas, fRect, paint);
|
||||
|
||||
canvas->EXPERIMENTAL_drawDrawable(fAnimatingDrawable);
|
||||
canvas->drawDrawable(fAnimatingDrawable);
|
||||
|
||||
DrawArcs(canvas);
|
||||
}
|
||||
|
||||
void onDrawContent(SkCanvas* canvas) SK_OVERRIDE {
|
||||
canvas->EXPERIMENTAL_drawDrawable(fRootDrawable);
|
||||
canvas->drawDrawable(fRootDrawable);
|
||||
}
|
||||
|
||||
bool onAnimate(const SkAnimTimer& timer) SK_OVERRIDE {
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "SkAnimTimer.h"
|
||||
#include "SkView.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkCanvasDrawable.h"
|
||||
#include "SkDrawable.h"
|
||||
#include "SkInterpolator.h"
|
||||
#include "SkPictureRecorder.h"
|
||||
#include "SkRandom.h"
|
||||
@ -43,7 +43,7 @@ static SkColor rand_opaque_color(uint32_t seed) {
|
||||
return rand.nextU() | (0xFF << 24);
|
||||
}
|
||||
|
||||
class HTDrawable : public SkCanvasDrawable {
|
||||
class HTDrawable : public SkDrawable {
|
||||
SkRect fR;
|
||||
SkColor fColor;
|
||||
SkInterpolator* fInterp;
|
||||
@ -127,7 +127,7 @@ public:
|
||||
HTDrawable* fDrawable;
|
||||
};
|
||||
Rec fArray[N];
|
||||
SkAutoTUnref<SkCanvasDrawable> fRoot;
|
||||
SkAutoTUnref<SkDrawable> fRoot;
|
||||
SkMSec fTime;
|
||||
|
||||
HTView() {
|
||||
@ -137,10 +137,10 @@ public:
|
||||
SkCanvas* canvas = recorder.beginRecording(SkRect::MakeWH(W, H));
|
||||
for (int i = 0; i < N; ++i) {
|
||||
fArray[i].fDrawable = new HTDrawable(rand);
|
||||
canvas->EXPERIMENTAL_drawDrawable(fArray[i].fDrawable);
|
||||
canvas->drawDrawable(fArray[i].fDrawable);
|
||||
fArray[i].fDrawable->unref();
|
||||
}
|
||||
fRoot.reset(recorder.EXPERIMENTAL_endRecordingAsDrawable());
|
||||
fRoot.reset(recorder.endRecordingAsDrawable());
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -153,7 +153,7 @@ protected:
|
||||
}
|
||||
|
||||
void onDrawContent(SkCanvas* canvas) SK_OVERRIDE {
|
||||
canvas->EXPERIMENTAL_drawDrawable(fRoot);
|
||||
canvas->drawDrawable(fRoot);
|
||||
}
|
||||
|
||||
bool onAnimate(const SkAnimTimer& timer) SK_OVERRIDE {
|
||||
|
@ -6,11 +6,11 @@
|
||||
*/
|
||||
|
||||
#include "SkCanvas.h"
|
||||
#include "SkCanvasDrawable.h"
|
||||
#include "SkCanvasPriv.h"
|
||||
#include "SkBitmapDevice.h"
|
||||
#include "SkDeviceImageFilterProxy.h"
|
||||
#include "SkDraw.h"
|
||||
#include "SkDrawable.h"
|
||||
#include "SkDrawFilter.h"
|
||||
#include "SkDrawLooper.h"
|
||||
#include "SkImage.h"
|
||||
@ -2293,13 +2293,13 @@ void SkCanvas::onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
|
||||
LOOPER_END
|
||||
}
|
||||
|
||||
void SkCanvas::EXPERIMENTAL_drawDrawable(SkCanvasDrawable* dr) {
|
||||
void SkCanvas::drawDrawable(SkDrawable* dr) {
|
||||
if (dr && !this->quickReject(dr->getBounds())) {
|
||||
this->onDrawDrawable(dr);
|
||||
}
|
||||
}
|
||||
|
||||
void SkCanvas::onDrawDrawable(SkCanvasDrawable* dr) {
|
||||
void SkCanvas::onDrawDrawable(SkDrawable* dr) {
|
||||
dr->draw(this);
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "SkCanvas.h"
|
||||
#include "SkCanvasDrawable.h"
|
||||
#include "SkDrawable.h"
|
||||
#include "SkThread.h"
|
||||
|
||||
static int32_t next_generation_id() {
|
||||
@ -21,7 +21,7 @@ static int32_t next_generation_id() {
|
||||
return genID;
|
||||
}
|
||||
|
||||
SkCanvasDrawable::SkCanvasDrawable() : fGenerationID(0) {}
|
||||
SkDrawable::SkDrawable() : fGenerationID(0) {}
|
||||
|
||||
static void draw_bbox(SkCanvas* canvas, const SkRect& r) {
|
||||
SkPaint paint;
|
||||
@ -32,7 +32,7 @@ static void draw_bbox(SkCanvas* canvas, const SkRect& r) {
|
||||
canvas->drawLine(r.left(), r.bottom(), r.right(), r.top(), paint);
|
||||
}
|
||||
|
||||
void SkCanvasDrawable::draw(SkCanvas* canvas) {
|
||||
void SkDrawable::draw(SkCanvas* canvas) {
|
||||
SkAutoCanvasRestore acr(canvas, true);
|
||||
this->onDraw(canvas);
|
||||
|
||||
@ -41,22 +41,22 @@ void SkCanvasDrawable::draw(SkCanvas* canvas) {
|
||||
}
|
||||
}
|
||||
|
||||
SkPicture* SkCanvasDrawable::newPictureSnapshot() {
|
||||
SkPicture* SkDrawable::newPictureSnapshot() {
|
||||
return this->onNewPictureSnapshot();
|
||||
}
|
||||
|
||||
uint32_t SkCanvasDrawable::getGenerationID() {
|
||||
uint32_t SkDrawable::getGenerationID() {
|
||||
if (0 == fGenerationID) {
|
||||
fGenerationID = next_generation_id();
|
||||
}
|
||||
return fGenerationID;
|
||||
}
|
||||
|
||||
SkRect SkCanvasDrawable::getBounds() {
|
||||
SkRect SkDrawable::getBounds() {
|
||||
return this->onGetBounds();
|
||||
}
|
||||
|
||||
void SkCanvasDrawable::notifyDrawingChanged() {
|
||||
void SkDrawable::notifyDrawingChanged() {
|
||||
fGenerationID = 0;
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ void SkCanvasDrawable::notifyDrawingChanged() {
|
||||
|
||||
#include "SkPictureRecorder.h"
|
||||
|
||||
SkPicture* SkCanvasDrawable::onNewPictureSnapshot() {
|
||||
SkPicture* SkDrawable::onNewPictureSnapshot() {
|
||||
SkPictureRecorder recorder;
|
||||
|
||||
const SkRect bounds = this->getBounds();
|
@ -5,8 +5,8 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "SkCanvasDrawable.h"
|
||||
#include "SkData.h"
|
||||
#include "SkDrawable.h"
|
||||
#include "SkLayerInfo.h"
|
||||
#include "SkPictureRecorder.h"
|
||||
#include "SkRecord.h"
|
||||
@ -51,7 +51,7 @@ SkPicture* SkPictureRecorder::endRecordingAsPicture() {
|
||||
saveLayerData.reset(SkNEW_ARGS(SkLayerInfo, (key)));
|
||||
}
|
||||
|
||||
SkCanvasDrawableList* drawableList = fRecorder->getDrawableList();
|
||||
SkDrawableList* drawableList = fRecorder->getDrawableList();
|
||||
SkPicture::SnapshotArray* pictList = drawableList ? drawableList->newDrawableSnapshot() : NULL;
|
||||
|
||||
if (fBBH.get()) {
|
||||
@ -82,8 +82,8 @@ void SkPictureRecorder::partialReplay(SkCanvas* canvas) const {
|
||||
}
|
||||
|
||||
int drawableCount = 0;
|
||||
SkCanvasDrawable* const* drawables = NULL;
|
||||
SkCanvasDrawableList* drawableList = fRecorder->getDrawableList();
|
||||
SkDrawable* const* drawables = NULL;
|
||||
SkDrawableList* drawableList = fRecorder->getDrawableList();
|
||||
if (drawableList) {
|
||||
drawableCount = drawableList->count();
|
||||
drawables = drawableList->begin();
|
||||
@ -93,15 +93,15 @@ void SkPictureRecorder::partialReplay(SkCanvas* canvas) const {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class SkRecordedDrawable : public SkCanvasDrawable {
|
||||
SkAutoTUnref<SkRecord> fRecord;
|
||||
SkAutoTUnref<SkBBoxHierarchy> fBBH;
|
||||
SkAutoTDelete<SkCanvasDrawableList> fDrawableList;
|
||||
const SkRect fBounds;
|
||||
const bool fDoSaveLayerInfo;
|
||||
class SkRecordedDrawable : public SkDrawable {
|
||||
SkAutoTUnref<SkRecord> fRecord;
|
||||
SkAutoTUnref<SkBBoxHierarchy> fBBH;
|
||||
SkAutoTDelete<SkDrawableList> fDrawableList;
|
||||
const SkRect fBounds;
|
||||
const bool fDoSaveLayerInfo;
|
||||
|
||||
public:
|
||||
SkRecordedDrawable(SkRecord* record, SkBBoxHierarchy* bbh, SkCanvasDrawableList* drawableList,
|
||||
SkRecordedDrawable(SkRecord* record, SkBBoxHierarchy* bbh, SkDrawableList* drawableList,
|
||||
const SkRect& bounds, bool doSaveLayerInfo)
|
||||
: fRecord(SkRef(record))
|
||||
, fBBH(SkSafeRef(bbh))
|
||||
@ -114,7 +114,7 @@ protected:
|
||||
SkRect onGetBounds() SK_OVERRIDE { return fBounds; }
|
||||
|
||||
void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
SkCanvasDrawable* const* drawables = NULL;
|
||||
SkDrawable* const* drawables = NULL;
|
||||
int drawableCount = 0;
|
||||
if (fDrawableList) {
|
||||
drawables = fDrawableList->begin();
|
||||
@ -153,7 +153,7 @@ protected:
|
||||
}
|
||||
};
|
||||
|
||||
SkCanvasDrawable* SkPictureRecorder::EXPERIMENTAL_endRecordingAsDrawable() {
|
||||
SkDrawable* SkPictureRecorder::endRecordingAsDrawable() {
|
||||
// TODO: delay as much of this work until just before first playback?
|
||||
SkRecordOptimize(fRecord);
|
||||
|
||||
@ -161,10 +161,10 @@ SkCanvasDrawable* SkPictureRecorder::EXPERIMENTAL_endRecordingAsDrawable() {
|
||||
SkRecordFillBounds(fCullRect, *fRecord, fBBH.get());
|
||||
}
|
||||
|
||||
SkCanvasDrawable* drawable = SkNEW_ARGS(SkRecordedDrawable,
|
||||
(fRecord, fBBH, fRecorder->detachDrawableList(),
|
||||
fCullRect,
|
||||
SkToBool(fFlags & kComputeSaveLayerInfo_RecordFlag)));
|
||||
SkDrawable* drawable = SkNEW_ARGS(SkRecordedDrawable,
|
||||
(fRecord, fBBH, fRecorder->detachDrawableList(),
|
||||
fCullRect,
|
||||
SkToBool(fFlags & kComputeSaveLayerInfo_RecordFlag)));
|
||||
|
||||
// release our refs now, so only the drawable will be the owner.
|
||||
fRecorder.reset(NULL);
|
||||
|
@ -12,7 +12,7 @@
|
||||
void SkRecordDraw(const SkRecord& record,
|
||||
SkCanvas* canvas,
|
||||
SkPicture const* const drawablePicts[],
|
||||
SkCanvasDrawable* const drawables[],
|
||||
SkDrawable* const drawables[],
|
||||
int drawableCount,
|
||||
const SkBBoxHierarchy* bbh,
|
||||
SkPicture::AbortCallback* callback) {
|
||||
@ -124,7 +124,7 @@ template <> void Draw::draw(const DrawDrawable& r) {
|
||||
SkASSERT(r.index < fDrawableCount);
|
||||
if (fDrawables) {
|
||||
SkASSERT(NULL == fDrawablePicts);
|
||||
fCanvas->EXPERIMENTAL_drawDrawable(fDrawables[r.index]);
|
||||
fCanvas->drawDrawable(fDrawables[r.index]);
|
||||
} else {
|
||||
fCanvas->drawPicture(fDrawablePicts[r.index]);
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "SkMatrix.h"
|
||||
#include "SkRecord.h"
|
||||
|
||||
class SkCanvasDrawable;
|
||||
class SkDrawable;
|
||||
class SkLayerInfo;
|
||||
|
||||
// Fill a BBH to be used by SkRecordDraw to accelerate playback.
|
||||
@ -25,7 +25,7 @@ void SkRecordComputeLayers(const SkRect& cullRect, const SkRecord& record,
|
||||
|
||||
// Draw an SkRecord into an SkCanvas. A convenience wrapper around SkRecords::Draw.
|
||||
void SkRecordDraw(const SkRecord&, SkCanvas*, SkPicture const* const drawablePicts[],
|
||||
SkCanvasDrawable* const drawables[], int drawableCount,
|
||||
SkDrawable* const drawables[], int drawableCount,
|
||||
const SkBBoxHierarchy*, SkPicture::AbortCallback*);
|
||||
|
||||
// Draw a portion of an SkRecord into an SkCanvas.
|
||||
@ -43,7 +43,7 @@ namespace SkRecords {
|
||||
class Draw : SkNoncopyable {
|
||||
public:
|
||||
explicit Draw(SkCanvas* canvas, SkPicture const* const drawablePicts[],
|
||||
SkCanvasDrawable* const drawables[], int drawableCount,
|
||||
SkDrawable* const drawables[], int drawableCount,
|
||||
const SkMatrix* initialCTM = NULL)
|
||||
: fInitialCTM(initialCTM ? *initialCTM : canvas->getTotalMatrix())
|
||||
, fCanvas(canvas)
|
||||
@ -70,7 +70,7 @@ private:
|
||||
const SkMatrix fInitialCTM;
|
||||
SkCanvas* fCanvas;
|
||||
SkPicture const* const* fDrawablePicts;
|
||||
SkCanvasDrawable* const* fDrawables;
|
||||
SkDrawable* const* fDrawables;
|
||||
int fDrawableCount;
|
||||
};
|
||||
|
||||
|
@ -9,11 +9,11 @@
|
||||
#include "SkPatchUtils.h"
|
||||
#include "SkPicture.h"
|
||||
|
||||
SkCanvasDrawableList::~SkCanvasDrawableList() {
|
||||
SkDrawableList::~SkDrawableList() {
|
||||
fArray.unrefAll();
|
||||
}
|
||||
|
||||
SkPicture::SnapshotArray* SkCanvasDrawableList::newDrawableSnapshot() {
|
||||
SkPicture::SnapshotArray* SkDrawableList::newDrawableSnapshot() {
|
||||
const int count = fArray.count();
|
||||
if (0 == count) {
|
||||
return NULL;
|
||||
@ -25,7 +25,7 @@ SkPicture::SnapshotArray* SkCanvasDrawableList::newDrawableSnapshot() {
|
||||
return SkNEW_ARGS(SkPicture::SnapshotArray, (pics.detach(), count));
|
||||
}
|
||||
|
||||
void SkCanvasDrawableList::append(SkCanvasDrawable* drawable) {
|
||||
void SkDrawableList::append(SkDrawable* drawable) {
|
||||
*fArray.append() = SkRef(drawable);
|
||||
}
|
||||
|
||||
@ -143,9 +143,9 @@ void SkRecorder::onDrawDRRect(const SkRRect& outer, const SkRRect& inner, const
|
||||
APPEND(DrawDRRect, delay_copy(paint), outer, inner);
|
||||
}
|
||||
|
||||
void SkRecorder::onDrawDrawable(SkCanvasDrawable* drawable) {
|
||||
void SkRecorder::onDrawDrawable(SkDrawable* drawable) {
|
||||
if (!fDrawableList) {
|
||||
fDrawableList.reset(SkNEW(SkCanvasDrawableList));
|
||||
fDrawableList.reset(SkNEW(SkDrawableList));
|
||||
}
|
||||
fDrawableList->append(drawable);
|
||||
APPEND(DrawDrawable, drawable->getBounds(), fDrawableList->count() - 1);
|
||||
|
@ -15,20 +15,20 @@
|
||||
|
||||
class SkBBHFactory;
|
||||
|
||||
class SkCanvasDrawableList : SkNoncopyable {
|
||||
class SkDrawableList : SkNoncopyable {
|
||||
public:
|
||||
~SkCanvasDrawableList();
|
||||
~SkDrawableList();
|
||||
|
||||
int count() const { return fArray.count(); }
|
||||
SkCanvasDrawable* const* begin() const { return fArray.begin(); }
|
||||
SkDrawable* const* begin() const { return fArray.begin(); }
|
||||
|
||||
void append(SkCanvasDrawable* drawable);
|
||||
void append(SkDrawable* drawable);
|
||||
|
||||
// Return a new or ref'd array of pictures that were snapped from our drawables.
|
||||
SkPicture::SnapshotArray* newDrawableSnapshot();
|
||||
|
||||
private:
|
||||
SkTDArray<SkCanvasDrawable*> fArray;
|
||||
SkTDArray<SkDrawable*> fArray;
|
||||
};
|
||||
|
||||
// SkRecorder provides an SkCanvas interface for recording into an SkRecord.
|
||||
@ -39,8 +39,8 @@ public:
|
||||
SkRecorder(SkRecord*, int width, int height); // legacy version
|
||||
SkRecorder(SkRecord*, const SkRect& bounds);
|
||||
|
||||
SkCanvasDrawableList* getDrawableList() const { return fDrawableList.get(); }
|
||||
SkCanvasDrawableList* detachDrawableList() { return fDrawableList.detach(); }
|
||||
SkDrawableList* getDrawableList() const { return fDrawableList.get(); }
|
||||
SkDrawableList* detachDrawableList() { return fDrawableList.detach(); }
|
||||
|
||||
// Make SkRecorder forget entirely about its SkRecord*; all calls to SkRecorder will fail.
|
||||
void forgetRecord();
|
||||
@ -54,7 +54,7 @@ public:
|
||||
void didSetMatrix(const SkMatrix&) SK_OVERRIDE;
|
||||
|
||||
void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRIDE;
|
||||
void onDrawDrawable(SkCanvasDrawable*) SK_OVERRIDE;
|
||||
void onDrawDrawable(SkDrawable*) SK_OVERRIDE;
|
||||
void onDrawText(const void* text,
|
||||
size_t byteLength,
|
||||
SkScalar x,
|
||||
@ -131,7 +131,7 @@ private:
|
||||
|
||||
SkRecord* fRecord;
|
||||
|
||||
SkAutoTDelete<SkCanvasDrawableList> fDrawableList;
|
||||
SkAutoTDelete<SkDrawableList> fDrawableList;
|
||||
};
|
||||
|
||||
#endif//SkRecorder_DEFINED
|
||||
|
@ -9,7 +9,7 @@
|
||||
#define SkRecords_DEFINED
|
||||
|
||||
#include "SkCanvas.h"
|
||||
#include "SkCanvasDrawable.h"
|
||||
#include "SkDrawable.h"
|
||||
#include "SkPicture.h"
|
||||
#include "SkTextBlob.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user