Revert of Rename SkDrawPictureCallback to SkPicture::AbortCallback (patchset #2 id:20001 of https://codereview.chromium.org/829983003/)
Reason for revert: speculative revert to unblock DEPS roll Original issue's description: > Rename SkDrawPictureCallback to SkPicture::AbortCallback > > Committed: https://skia.googlesource.com/skia/+/7ef197255deb4e2fa64c03c7130d56ddf164e83c TBR=reed@google.com,robertphillips@google.com NOTREECHECKS=true NOTRY=true Review URL: https://codereview.chromium.org/824013004
This commit is contained in:
parent
66b29a6ad5
commit
8ea6dabbb1
@ -22,7 +22,6 @@
|
||||
'SK_SUPPORT_LEGACY_PORTER_DUFF',
|
||||
'SK_SUPPORT_LEGACY_DRAWDATA',
|
||||
'SK_SUPPORT_LEGACY_CANVAS_VIRTUAL',
|
||||
'SK_LEGACY_DRAWPICTURECALLBACK',
|
||||
],
|
||||
},
|
||||
}
|
||||
|
@ -15,7 +15,6 @@
|
||||
'skia_for_chromium_defines': [
|
||||
'SK_SUPPORT_LEGACY_DRAWDATA',
|
||||
'SK_SUPPORT_LEGACY_CANVAS_VIRTUAL',
|
||||
'SK_LEGACY_DRAWPICTURECALLBACK',
|
||||
],
|
||||
},
|
||||
}
|
||||
|
@ -10,9 +10,6 @@
|
||||
|
||||
#include "SkTypes.h"
|
||||
|
||||
#ifdef SK_LEGACY_DRAWPICTURECALLBACK
|
||||
#include "SkPicture.h"
|
||||
|
||||
/**
|
||||
* Subclasses of this can be passed to canvas.drawPicture(). During the drawing
|
||||
* of the picture, this callback will periodically be invoked. If its
|
||||
@ -23,12 +20,12 @@
|
||||
* calls to save(), restore will automatically be called to return the state
|
||||
* to the same level it was before the drawPicture call was made.
|
||||
*/
|
||||
class SK_API SkDrawPictureCallback : public SkPicture::AbortCallback {
|
||||
class SK_API SkDrawPictureCallback {
|
||||
public:
|
||||
SkDrawPictureCallback() {}
|
||||
virtual ~SkDrawPictureCallback() {}
|
||||
|
||||
virtual bool abortDrawing() = 0;
|
||||
|
||||
bool abort() SK_OVERRIDE { return this->abortDrawing(); }
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // SkDrawPictureCallback_DEFINED
|
||||
#endif//SkDrawPictureCallback_DEFINED
|
||||
|
@ -9,6 +9,8 @@
|
||||
#ifndef SkPicture_DEFINED
|
||||
#define SkPicture_DEFINED
|
||||
|
||||
#include "SkBitmap.h"
|
||||
#include "SkDrawPictureCallback.h"
|
||||
#include "SkImageDecoder.h"
|
||||
#include "SkRefCnt.h"
|
||||
#include "SkTDArray.h"
|
||||
@ -17,7 +19,6 @@
|
||||
class GrContext;
|
||||
#endif
|
||||
|
||||
class SkBitmap;
|
||||
class SkBBoxHierarchy;
|
||||
class SkCanvas;
|
||||
class SkData;
|
||||
@ -101,24 +102,6 @@ public:
|
||||
|
||||
~SkPicture();
|
||||
|
||||
/**
|
||||
* Subclasses of this can be passed to playback(). During the playback
|
||||
* of the picture, this callback will periodically be invoked. If its
|
||||
* abort() returns true, then picture playback will be interrupted.
|
||||
*
|
||||
* The resulting drawing is undefined, as there is no guarantee how often the
|
||||
* callback will be invoked. If the abort happens inside some level of nested
|
||||
* calls to save(), restore will automatically be called to return the state
|
||||
* to the same level it was before the playback call was made.
|
||||
*/
|
||||
class AbortCallback {
|
||||
public:
|
||||
AbortCallback() {}
|
||||
virtual ~AbortCallback() {}
|
||||
|
||||
virtual bool abort() = 0;
|
||||
};
|
||||
|
||||
/** Replays the drawing commands on the specified canvas. Note that
|
||||
this has the effect of unfurling this picture into the destination
|
||||
canvas. Using the SkCanvas::drawPicture entry point gives the destination
|
||||
@ -126,7 +109,7 @@ public:
|
||||
@param canvas the canvas receiving the drawing commands.
|
||||
@param callback a callback that allows interruption of playback
|
||||
*/
|
||||
void playback(SkCanvas* canvas, AbortCallback* = NULL) const;
|
||||
void playback(SkCanvas* canvas, SkDrawPictureCallback* = NULL) const;
|
||||
|
||||
/** Return the cull rect used when creating this picture: { 0, 0, cullWidth, cullHeight }.
|
||||
It does not necessarily reflect the bounds of what has been recorded into the picture.
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "SkBitmapDevice.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkChunkAlloc.h"
|
||||
#include "SkDrawPictureCallback.h"
|
||||
#include "SkMessageBus.h"
|
||||
#include "SkPaintPriv.h"
|
||||
#include "SkPathEffect.h"
|
||||
@ -309,7 +310,7 @@ SkPicture::AccelData::Domain SkPicture::AccelData::GenerateDomain() {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void SkPicture::playback(SkCanvas* canvas, AbortCallback* callback) const {
|
||||
void SkPicture::playback(SkCanvas* canvas, SkDrawPictureCallback* callback) const {
|
||||
SkASSERT(canvas);
|
||||
|
||||
// If the query contains the whole picture, don't bother with the BBH.
|
||||
|
@ -5,11 +5,14 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
#include <new>
|
||||
#include "SkBBoxHierarchy.h"
|
||||
#include "SkDrawPictureCallback.h"
|
||||
#include "SkPictureData.h"
|
||||
#include "SkPictureRecord.h"
|
||||
#include "SkReadBuffer.h"
|
||||
#include "SkTextBlob.h"
|
||||
#include "SkTypeface.h"
|
||||
#include "SkTSort.h"
|
||||
#include "SkWriteBuffer.h"
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
|
@ -65,7 +65,7 @@ static SkBitmap shallow_copy(const SkBitmap& bitmap) {
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
void SkPicturePlayback::draw(SkCanvas* canvas, SkPicture::AbortCallback* callback) {
|
||||
void SkPicturePlayback::draw(SkCanvas* canvas, SkDrawPictureCallback* callback) {
|
||||
AutoResetOpID aroi(this);
|
||||
SkASSERT(0 == fCurOffset);
|
||||
|
||||
@ -77,7 +77,7 @@ void SkPicturePlayback::draw(SkCanvas* canvas, SkPicture::AbortCallback* callbac
|
||||
SkAutoCanvasRestore acr(canvas, false);
|
||||
|
||||
while (!reader.eof()) {
|
||||
if (callback && callback->abort()) {
|
||||
if (callback && callback->abortDrawing()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
class SkBitmap;
|
||||
class SkCanvas;
|
||||
class SkDrawPictureCallback;
|
||||
class SkPaint;
|
||||
class SkPictureData;
|
||||
|
||||
@ -24,7 +25,7 @@ public:
|
||||
}
|
||||
virtual ~SkPicturePlayback() { }
|
||||
|
||||
virtual void draw(SkCanvas* canvas, SkPicture::AbortCallback*);
|
||||
virtual void draw(SkCanvas* canvas, SkDrawPictureCallback*);
|
||||
|
||||
// TODO: remove the curOp calls after cleaning up GrGatherDevice
|
||||
// Return the ID of the operation currently being executed when playing
|
||||
|
@ -15,7 +15,7 @@ void SkRecordDraw(const SkRecord& record,
|
||||
SkCanvasDrawable* const drawables[],
|
||||
int drawableCount,
|
||||
const SkBBoxHierarchy* bbh,
|
||||
SkPicture::AbortCallback* callback) {
|
||||
SkDrawPictureCallback* callback) {
|
||||
SkAutoCanvasRestore saveRestore(canvas, true /*save now, restore at exit*/);
|
||||
|
||||
if (bbh) {
|
||||
@ -34,7 +34,7 @@ void SkRecordDraw(const SkRecord& record,
|
||||
|
||||
SkRecords::Draw draw(canvas, drawablePicts, drawables, drawableCount);
|
||||
for (int i = 0; i < ops.count(); i++) {
|
||||
if (callback && callback->abort()) {
|
||||
if (callback && callback->abortDrawing()) {
|
||||
return;
|
||||
}
|
||||
// This visit call uses the SkRecords::Draw::operator() to call
|
||||
@ -46,7 +46,7 @@ void SkRecordDraw(const SkRecord& record,
|
||||
// Draw all ops.
|
||||
SkRecords::Draw draw(canvas, drawablePicts, drawables, drawableCount);
|
||||
for (unsigned i = 0; i < record.count(); i++) {
|
||||
if (callback && callback->abort()) {
|
||||
if (callback && callback->abortDrawing()) {
|
||||
return;
|
||||
}
|
||||
// This visit call uses the SkRecords::Draw::operator() to call
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#include "SkBBoxHierarchy.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkDrawPictureCallback.h"
|
||||
#include "SkMatrix.h"
|
||||
#include "SkRecord.h"
|
||||
|
||||
@ -26,7 +27,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,
|
||||
const SkBBoxHierarchy*, SkPicture::AbortCallback*);
|
||||
const SkBBoxHierarchy*, SkDrawPictureCallback*);
|
||||
|
||||
// Draw a portion of an SkRecord into an SkCanvas.
|
||||
// When drawing a portion of an SkRecord the CTM on the passed in canvas must be
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
const SkPicture* topLevelPicture,
|
||||
const SkPicture* picture,
|
||||
const SkMatrix& initialMatrix,
|
||||
SkPicture::AbortCallback* callback,
|
||||
SkDrawPictureCallback* callback,
|
||||
const unsigned* opIndices, int numIndices)
|
||||
: INHERITED(canvas, drawablePicts, NULL, drawableCount)
|
||||
, fCanvas(canvas)
|
||||
@ -92,7 +92,7 @@ public:
|
||||
bbh->search(query, &fOps);
|
||||
|
||||
for (fIndex = 0; fIndex < fOps.count(); ++fIndex) {
|
||||
if (fCallback && fCallback->abort()) {
|
||||
if (fCallback && fCallback->abortDrawing()) {
|
||||
return fNumReplaced;
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ public:
|
||||
|
||||
} else {
|
||||
for (fIndex = 0; fIndex < (int) record->count(); ++fIndex) {
|
||||
if (fCallback && fCallback->abort()) {
|
||||
if (fCallback && fCallback->abortDrawing()) {
|
||||
return fNumReplaced;
|
||||
}
|
||||
|
||||
@ -181,19 +181,19 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
SkCanvas* fCanvas;
|
||||
GrLayerCache* fLayerCache;
|
||||
const SkPicture* fTopLevelPicture;
|
||||
const SkPicture* fPicture;
|
||||
const SkMatrix fInitialMatrix;
|
||||
SkPicture::AbortCallback* fCallback;
|
||||
SkCanvas* fCanvas;
|
||||
GrLayerCache* fLayerCache;
|
||||
const SkPicture* fTopLevelPicture;
|
||||
const SkPicture* fPicture;
|
||||
const SkMatrix fInitialMatrix;
|
||||
SkDrawPictureCallback* fCallback;
|
||||
|
||||
SkTDArray<unsigned> fOps;
|
||||
int fIndex;
|
||||
int fNumReplaced;
|
||||
SkTDArray<unsigned> fOps;
|
||||
int fIndex;
|
||||
int fNumReplaced;
|
||||
|
||||
// The op code indices of all the enclosing drawPicture and saveLayer calls
|
||||
SkTDArray<unsigned> fOpIndexStack;
|
||||
SkTDArray<unsigned> fOpIndexStack;
|
||||
|
||||
typedef Draw INHERITED;
|
||||
};
|
||||
@ -202,7 +202,7 @@ int GrRecordReplaceDraw(const SkPicture* picture,
|
||||
SkCanvas* canvas,
|
||||
GrLayerCache* layerCache,
|
||||
const SkMatrix& initialMatrix,
|
||||
SkPicture::AbortCallback* callback) {
|
||||
SkDrawPictureCallback* callback) {
|
||||
SkAutoCanvasRestore saveRestore(canvas, true /*save now, restore at exit*/);
|
||||
|
||||
// TODO: drawablePicts?
|
||||
|
@ -8,11 +8,12 @@
|
||||
#ifndef GrRecordReplaceDraw_DEFINED
|
||||
#define GrRecordReplaceDraw_DEFINED
|
||||
|
||||
#include "SkPicture.h"
|
||||
#include "SkDrawPictureCallback.h"
|
||||
|
||||
class GrLayerCache;
|
||||
class SkCanvas;
|
||||
class SkMatrix;
|
||||
class SkPicture;
|
||||
|
||||
// Draw an SkPicture into an SkCanvas replacing saveLayer/restore blocks with
|
||||
// drawBitmap calls. A convenience wrapper around SkRecords::Draw.
|
||||
@ -21,6 +22,6 @@ int GrRecordReplaceDraw(const SkPicture*,
|
||||
SkCanvas*,
|
||||
GrLayerCache* layerCache,
|
||||
const SkMatrix& initialMatrix,
|
||||
SkPicture::AbortCallback*);
|
||||
SkDrawPictureCallback*);
|
||||
|
||||
#endif // GrRecordReplaceDraw_DEFINED
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "RecordTestUtils.h"
|
||||
|
||||
#include "SkDebugCanvas.h"
|
||||
#include "SkDrawPictureCallback.h"
|
||||
#include "SkDropShadowImageFilter.h"
|
||||
#include "SkImagePriv.h"
|
||||
#include "SkRecord.h"
|
||||
@ -20,11 +21,11 @@
|
||||
|
||||
static const int W = 1920, H = 1080;
|
||||
|
||||
class JustOneDraw : public SkPicture::AbortCallback {
|
||||
class JustOneDraw : public SkDrawPictureCallback {
|
||||
public:
|
||||
JustOneDraw() : fCalls(0) {}
|
||||
|
||||
virtual bool abort() SK_OVERRIDE { return fCalls++ > 0; }
|
||||
virtual bool abortDrawing() SK_OVERRIDE { return fCalls++ > 0; }
|
||||
private:
|
||||
int fCalls;
|
||||
};
|
||||
|
@ -22,11 +22,11 @@
|
||||
static const int kWidth = 100;
|
||||
static const int kHeight = 100;
|
||||
|
||||
class JustOneDraw : public SkPicture::AbortCallback {
|
||||
class JustOneDraw : public SkDrawPictureCallback {
|
||||
public:
|
||||
JustOneDraw() : fCalls(0) {}
|
||||
|
||||
virtual bool abort() SK_OVERRIDE { return fCalls++ > 0; }
|
||||
virtual bool abortDrawing() SK_OVERRIDE { return fCalls++ > 0; }
|
||||
private:
|
||||
int fCalls;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user