2011-07-28 14:26:00 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright 2011 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
2008-12-17 15:59:43 +00:00
|
|
|
#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.
|
2012-01-28 01:45:11 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
There must be a proxy installed before the proxycanvas can be used (i.e.
|
|
|
|
before its virtual methods can be called).
|
|
|
|
*/
|
2013-07-15 22:49:37 +00:00
|
|
|
class SK_API SkProxyCanvas : public SkCanvas {
|
2008-12-17 15:59:43 +00:00
|
|
|
public:
|
|
|
|
SkProxyCanvas() : fProxy(NULL) {}
|
|
|
|
SkProxyCanvas(SkCanvas* proxy);
|
|
|
|
virtual ~SkProxyCanvas();
|
2012-01-28 01:45:11 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
SkCanvas* getProxy() const { return fProxy; }
|
|
|
|
void setProxy(SkCanvas* proxy);
|
2012-01-28 01:45:11 +00:00
|
|
|
|
2011-10-06 13:14:12 +00:00
|
|
|
virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE;
|
2008-12-17 15:59:43 +00:00
|
|
|
virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[],
|
2011-10-06 13:14:12 +00:00
|
|
|
const SkPaint& paint) SK_OVERRIDE;
|
2012-12-12 20:48:18 +00:00
|
|
|
virtual void drawOval(const SkRect&, const SkPaint& paint) SK_OVERRIDE;
|
2013-10-22 16:54:15 +00:00
|
|
|
virtual void drawRect(const SkRect&, const SkPaint& paint) SK_OVERRIDE;
|
2012-12-12 20:48:18 +00:00
|
|
|
virtual void drawRRect(const SkRRect&, const SkPaint& paint) SK_OVERRIDE;
|
2013-10-22 16:54:15 +00:00
|
|
|
virtual void drawPath(const SkPath& path, const SkPaint& paint) SK_OVERRIDE;
|
2008-12-17 15:59:43 +00:00
|
|
|
virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top,
|
2011-10-06 13:14:12 +00:00
|
|
|
const SkPaint* paint = NULL) SK_OVERRIDE;
|
2012-09-18 15:14:33 +00:00
|
|
|
virtual void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
|
2013-08-16 10:24:37 +00:00
|
|
|
const SkRect& dst, const SkPaint* paint,
|
|
|
|
DrawBitmapRectFlags flags) SK_OVERRIDE;
|
2008-12-17 15:59:43 +00:00
|
|
|
virtual void drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m,
|
2011-10-06 13:14:12 +00:00
|
|
|
const SkPaint* paint = NULL) SK_OVERRIDE;
|
2008-12-17 15:59:43 +00:00
|
|
|
virtual void drawSprite(const SkBitmap& bitmap, int left, int top,
|
2011-10-06 13:14:12 +00:00
|
|
|
const SkPaint* paint = NULL) SK_OVERRIDE;
|
2008-12-17 15:59:43 +00:00
|
|
|
virtual void drawVertices(VertexMode vmode, int vertexCount,
|
|
|
|
const SkPoint vertices[], const SkPoint texs[],
|
|
|
|
const SkColor colors[], SkXfermode* xmode,
|
|
|
|
const uint16_t indices[], int indexCount,
|
2011-10-06 13:14:12 +00:00
|
|
|
const SkPaint& paint) SK_OVERRIDE;
|
|
|
|
virtual void drawData(const void* data, size_t length) SK_OVERRIDE;
|
2009-12-04 21:32:27 +00:00
|
|
|
|
2013-05-29 13:24:23 +00:00
|
|
|
virtual void beginCommentGroup(const char* description) SK_OVERRIDE;
|
|
|
|
virtual void addComment(const char* kywd, const char* value) SK_OVERRIDE;
|
|
|
|
virtual void endCommentGroup() SK_OVERRIDE;
|
|
|
|
|
2011-10-06 13:14:12 +00:00
|
|
|
virtual SkDrawFilter* setDrawFilter(SkDrawFilter* filter) SK_OVERRIDE;
|
2008-12-17 15:59:43 +00:00
|
|
|
|
2014-02-21 12:20:45 +00:00
|
|
|
protected:
|
2014-03-12 20:21:48 +00:00
|
|
|
virtual void willSave(SaveFlags) SK_OVERRIDE;
|
|
|
|
virtual SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveFlags) SK_OVERRIDE;
|
|
|
|
virtual void willRestore() SK_OVERRIDE;
|
|
|
|
|
2014-03-13 20:03:58 +00:00
|
|
|
virtual void didConcat(const SkMatrix&) SK_OVERRIDE;
|
|
|
|
virtual void didSetMatrix(const SkMatrix&) SK_OVERRIDE;
|
|
|
|
|
2014-02-21 12:20:45 +00:00
|
|
|
virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRIDE;
|
2014-04-23 04:00:17 +00:00
|
|
|
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;
|
2014-02-21 12:20:45 +00:00
|
|
|
|
2014-02-28 18:19:39 +00:00
|
|
|
virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
|
|
|
|
virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
|
|
|
|
virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
|
|
|
|
virtual void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE;
|
|
|
|
|
2014-06-04 12:40:44 +00:00
|
|
|
virtual void onDrawPicture(const SkPicture*) SK_OVERRIDE;
|
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
private:
|
|
|
|
SkCanvas* fProxy;
|
2012-01-28 01:45:11 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
typedef SkCanvas INHERITED;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|