Remove SkProxyCanvas.

SkProxyCanvas is redundant with SkNWayCanvas, and means another class
we have to keep in sync with the SkCanvas interface.

Remove tests which use an SkProxyCanvas.

Requires a change to chromium.

BUG=skia:3279
BUG=skia:500

Review URL: https://codereview.chromium.org/886813002
This commit is contained in:
scroggo 2015-01-29 11:58:51 -08:00 committed by Commit bot
parent 65df6edf63
commit 648238cc90
4 changed files with 1 additions and 318 deletions

View File

@ -36,7 +36,6 @@
'<(skia_include_path)/utils/SkPictureUtils.h',
'<(skia_include_path)/utils/SkRandom.h',
'<(skia_include_path)/utils/SkRTConf.h',
'<(skia_include_path)/utils/SkProxyCanvas.h',
'<(skia_include_path)/utils/SkTextBox.h',
'<(skia_src_path)/utils/SkBase64.cpp',
@ -80,7 +79,6 @@
'<(skia_src_path)/utils/SkPatchUtils.cpp',
'<(skia_src_path)/utils/SkPatchUtils.h',
'<(skia_src_path)/utils/SkPathUtils.cpp',
'<(skia_src_path)/utils/SkProxyCanvas.cpp',
'<(skia_src_path)/utils/SkSHA1.cpp',
'<(skia_src_path)/utils/SkSHA1.h',
'<(skia_src_path)/utils/SkRTConf.cpp',

View File

@ -1,92 +0,0 @@
/*
* Copyright 2011 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkProxyCanvas_DEFINED
#define SkProxyCanvas_DEFINED
#include "SkCanvas.h"
/** This class overrides all virtual methods on SkCanvas, and redirects them
to a "proxy", another SkCanvas instance. It can be the basis for
intercepting (and possibly modifying) calls to a canvas.
There must be a proxy installed before the proxycanvas can be used (i.e.
before its virtual methods can be called).
*/
class SK_API SkProxyCanvas : public SkCanvas {
public:
SkProxyCanvas() : fProxy(NULL) {}
SkProxyCanvas(SkCanvas* proxy);
virtual ~SkProxyCanvas();
SkCanvas* getProxy() const { return fProxy; }
void setProxy(SkCanvas* proxy);
void beginCommentGroup(const char* description) SK_OVERRIDE;
void addComment(const char* kywd, const char* value) SK_OVERRIDE;
void endCommentGroup() SK_OVERRIDE;
SkDrawFilter* setDrawFilter(SkDrawFilter* filter) SK_OVERRIDE;
protected:
void willSave() SK_OVERRIDE;
SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveFlags) SK_OVERRIDE;
void willRestore() SK_OVERRIDE;
void didConcat(const SkMatrix&) SK_OVERRIDE;
void didSetMatrix(const SkMatrix&) SK_OVERRIDE;
void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRIDE;
virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y,
const SkPaint&) SK_OVERRIDE;
virtual void onDrawPosText(const void* text, size_t byteLength, const SkPoint pos[],
const SkPaint&) SK_OVERRIDE;
virtual void onDrawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[],
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 onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
const SkPaint& paint) SK_OVERRIDE;
virtual void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
const SkPoint texCoords[4], SkXfermode* xmode,
const SkPaint& paint) SK_OVERRIDE;
void onDrawPaint(const SkPaint&) SK_OVERRIDE;
void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) SK_OVERRIDE;
void onDrawRect(const SkRect&, const SkPaint&) SK_OVERRIDE;
void onDrawOval(const SkRect&, const SkPaint&) SK_OVERRIDE;
void onDrawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE;
void onDrawPath(const SkPath&, const SkPaint&) SK_OVERRIDE;
void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPaint*) SK_OVERRIDE;
void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst, const SkPaint*,
DrawBitmapRectFlags flags) SK_OVERRIDE;
void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*) SK_OVERRIDE;
void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst,
const SkPaint*) SK_OVERRIDE;
void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst,
const SkPaint*) SK_OVERRIDE;
void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) SK_OVERRIDE;
void onDrawVertices(VertexMode vmode, int vertexCount,
const SkPoint vertices[], const SkPoint texs[],
const SkColor colors[], SkXfermode* xmode,
const uint16_t indices[], int indexCount,
const SkPaint&) SK_OVERRIDE;
void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE;
void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) SK_OVERRIDE;
private:
SkCanvas* fProxy;
typedef SkCanvas INHERITED;
};
#endif

View File

@ -1,186 +0,0 @@
/*
* Copyright 2011 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkProxyCanvas.h"
SkProxyCanvas::SkProxyCanvas(SkCanvas* proxy) : fProxy(proxy) {
SkSafeRef(fProxy);
}
SkProxyCanvas::~SkProxyCanvas() {
SkSafeUnref(fProxy);
}
void SkProxyCanvas::setProxy(SkCanvas* proxy) {
SkRefCnt_SafeAssign(fProxy, proxy);
}
///////////////////////////////// Overrides ///////////
void SkProxyCanvas::willSave() {
fProxy->save();
this->INHERITED::willSave();
}
SkCanvas::SaveLayerStrategy SkProxyCanvas::willSaveLayer(const SkRect* bounds, const SkPaint* paint,
SaveFlags flags) {
fProxy->saveLayer(bounds, paint, flags);
this->INHERITED::willSaveLayer(bounds, paint, flags);
// No need for a layer.
return kNoLayer_SaveLayerStrategy;
}
void SkProxyCanvas::willRestore() {
fProxy->restore();
this->INHERITED::willRestore();
}
void SkProxyCanvas::didConcat(const SkMatrix& matrix) {
fProxy->concat(matrix);
this->INHERITED::didConcat(matrix);
}
void SkProxyCanvas::didSetMatrix(const SkMatrix& matrix) {
fProxy->setMatrix(matrix);
this->INHERITED::didSetMatrix(matrix);
}
void SkProxyCanvas::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
fProxy->clipRect(rect, op, kSoft_ClipEdgeStyle == edgeStyle);
}
void SkProxyCanvas::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
fProxy->clipRRect(rrect, op, kSoft_ClipEdgeStyle == edgeStyle);
}
void SkProxyCanvas::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
fProxy->clipPath(path, op, kSoft_ClipEdgeStyle == edgeStyle);
}
void SkProxyCanvas::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
fProxy->clipRegion(deviceRgn, op);
}
void SkProxyCanvas::onDrawPaint(const SkPaint& paint) {
fProxy->drawPaint(paint);
}
void SkProxyCanvas::onDrawPoints(PointMode mode, size_t count,
const SkPoint pts[], const SkPaint& paint) {
fProxy->drawPoints(mode, count, pts, paint);
}
void SkProxyCanvas::onDrawOval(const SkRect& rect, const SkPaint& paint) {
fProxy->drawOval(rect, paint);
}
void SkProxyCanvas::onDrawRect(const SkRect& rect, const SkPaint& paint) {
fProxy->drawRect(rect, paint);
}
void SkProxyCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) {
fProxy->drawRRect(rrect, paint);
}
void SkProxyCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner,
const SkPaint& paint) {
fProxy->drawDRRect(outer, inner, paint);
}
void SkProxyCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) {
fProxy->drawPath(path, paint);
}
void SkProxyCanvas::onDrawImage(const SkImage* image, SkScalar left, SkScalar top,
const SkPaint* paint) {
fProxy->drawImage(image, left, top, paint);
}
void SkProxyCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, const SkRect& dst,
const SkPaint* paint) {
fProxy->drawImageRect(image, src, dst, paint);
}
void SkProxyCanvas::onDrawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y,
const SkPaint* paint) {
fProxy->drawBitmap(bitmap, x, y, paint);
}
void SkProxyCanvas::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const SkRect& dst,
const SkPaint* paint, DrawBitmapRectFlags flags) {
fProxy->drawBitmapRectToRect(bitmap, src, dst, paint, flags);
}
void SkProxyCanvas::onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
const SkRect& dst, const SkPaint* paint) {
fProxy->drawBitmapNine(bitmap, center, dst, paint);
}
void SkProxyCanvas::onDrawSprite(const SkBitmap& bitmap, int x, int y, const SkPaint* paint) {
fProxy->drawSprite(bitmap, x, y, paint);
}
void SkProxyCanvas::onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y,
const SkPaint& paint) {
fProxy->drawText(text, byteLength, x, y, paint);
}
void SkProxyCanvas::onDrawPosText(const void* text, size_t byteLength, const SkPoint pos[],
const SkPaint& paint) {
fProxy->drawPosText(text, byteLength, pos, paint);
}
void SkProxyCanvas::onDrawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[],
SkScalar constY, const SkPaint& paint) {
fProxy->drawPosTextH(text, byteLength, xpos, constY, paint);
}
void SkProxyCanvas::onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path,
const SkMatrix* matrix, const SkPaint& paint) {
fProxy->drawTextOnPath(text, byteLength, path, matrix, paint);
}
void SkProxyCanvas::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
const SkPaint& paint) {
fProxy->drawTextBlob(blob, x, y, paint);
}
void SkProxyCanvas::onDrawPicture(const SkPicture* picture, const SkMatrix* matrix,
const SkPaint* paint) {
fProxy->drawPicture(picture, matrix, paint);
}
void SkProxyCanvas::onDrawVertices(VertexMode vmode, int vertexCount,
const SkPoint vertices[], const SkPoint texs[],
const SkColor colors[], SkXfermode* xmode,
const uint16_t indices[], int indexCount,
const SkPaint& paint) {
fProxy->drawVertices(vmode, vertexCount, vertices, texs, colors,
xmode, indices, indexCount, paint);
}
void SkProxyCanvas::onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
const SkPoint texCoords[4], SkXfermode* xmode,
const SkPaint& paint) {
fProxy->drawPatch(cubics, colors, texCoords, xmode, paint);
}
void SkProxyCanvas::beginCommentGroup(const char* description) {
fProxy->beginCommentGroup(description);
}
void SkProxyCanvas::addComment(const char* kywd, const char* value) {
fProxy->addComment(kywd, value);
}
void SkProxyCanvas::endCommentGroup() {
fProxy->endCommentGroup();
}
SkDrawFilter* SkProxyCanvas::setDrawFilter(SkDrawFilter* filter) {
return fProxy->setDrawFilter(filter);
}

View File

@ -56,7 +56,6 @@
#include "SkPicture.h"
#include "SkPictureRecord.h"
#include "SkPictureRecorder.h"
#include "SkProxyCanvas.h"
#include "SkRect.h"
#include "SkRegion.h"
#include "SkShader.h"
@ -229,8 +228,6 @@ static const char* const kCanvasDrawAssertMessageFormat =
"Drawing test step %s with SkCanvas";
static const char* const kDeferredDrawAssertMessageFormat =
"Drawing test step %s with SkDeferredCanvas";
static const char* const kProxyDrawAssertMessageFormat =
"Drawing test step %s with SkProxyCanvas";
static const char* const kNWayDrawAssertMessageFormat =
"Drawing test step %s with SkNWayCanvas";
static const char* const kDeferredPreFlushAssertMessageFormat =
@ -239,10 +236,6 @@ static const char* const kDeferredPostFlushPlaybackAssertMessageFormat =
"test step %s, SkDeferredCanvas playback canvas state consistency after flush";
static const char* const kDeferredPostSilentFlushPlaybackAssertMessageFormat =
"test step %s, SkDeferredCanvas playback canvas state consistency after silent flush";
static const char* const kProxyStateAssertMessageFormat =
"test step %s, SkProxyCanvas state consistency";
static const char* const kProxyIndirectStateAssertMessageFormat =
"test step %s, SkProxyCanvas indirect canvas state consistency";
static const char* const kNWayStateAssertMessageFormat =
"test step %s, SkNWayCanvas state consistency";
static const char* const kNWayIndirect1StateAssertMessageFormat =
@ -618,27 +611,6 @@ public:
}
};
// unused
static void TestProxyCanvasStateConsistency(
skiatest::Reporter* reporter,
const TestData& d,
CanvasTestStep* testStep,
const SkCanvas& referenceCanvas) {
SkBitmap indirectStore;
createBitmap(&indirectStore, 0xFFFFFFFF);
SkCanvas indirectCanvas(indirectStore);
SkProxyCanvas proxyCanvas(&indirectCanvas);
testStep->setAssertMessageFormat(kProxyDrawAssertMessageFormat);
testStep->draw(&proxyCanvas, d, reporter);
// Verify that the SkProxyCanvas reports consitent state
testStep->setAssertMessageFormat(kProxyStateAssertMessageFormat);
AssertCanvasStatesEqual(reporter, d, &proxyCanvas, &referenceCanvas, testStep);
// Verify that the indirect canvas reports consitent state
testStep->setAssertMessageFormat(kProxyIndirectStateAssertMessageFormat);
AssertCanvasStatesEqual(reporter, d, &indirectCanvas, &referenceCanvas, testStep);
}
// unused
static void TestNWayCanvasStateConsistency(
skiatest::Reporter* reporter,
@ -661,7 +633,7 @@ static void TestNWayCanvasStateConsistency(
testStep->setAssertMessageFormat(kNWayDrawAssertMessageFormat);
testStep->draw(&nWayCanvas, d, reporter);
// Verify that the SkProxyCanvas reports consitent state
// Verify that the SkNWayCanvas reports consitent state
testStep->setAssertMessageFormat(kNWayStateAssertMessageFormat);
AssertCanvasStatesEqual(reporter, d, &nWayCanvas, &referenceCanvas, testStep);
// Verify that the indirect canvases report consitent state
@ -689,15 +661,6 @@ static void TestOverrideStateConsistency(skiatest::Reporter* reporter, const Tes
SkDeferredCanvasTester::TestDeferredCanvasStateConsistency(reporter, d, testStep, referenceCanvas, true);
// The following test code is disabled because SkProxyCanvas is
// missing a lot of virtual overrides on get* methods, which are used
// to verify canvas state.
// Issue: http://code.google.com/p/skia/issues/detail?id=500
if (false) { // avoid bit rot, suppress warning
TestProxyCanvasStateConsistency(reporter, d, testStep, referenceCanvas);
}
// The following test code is disabled because SkNWayCanvas does not
// report correct clipping and device bounds information
// Issue: http://code.google.com/p/skia/issues/detail?id=501