gfx/skia/trunk/include/utils/SkProxyCanvas.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/skia/trunk/include/utils/SkProxyCanvas.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,95 @@
     1.4 +
     1.5 +/*
     1.6 + * Copyright 2011 Google Inc.
     1.7 + *
     1.8 + * Use of this source code is governed by a BSD-style license that can be
     1.9 + * found in the LICENSE file.
    1.10 + */
    1.11 +#ifndef SkProxyCanvas_DEFINED
    1.12 +#define SkProxyCanvas_DEFINED
    1.13 +
    1.14 +#include "SkCanvas.h"
    1.15 +
    1.16 +/** This class overrides all virtual methods on SkCanvas, and redirects them
    1.17 +    to a "proxy", another SkCanvas instance. It can be the basis for
    1.18 +    intercepting (and possibly modifying) calls to a canvas.
    1.19 +
    1.20 +    There must be a proxy installed before the proxycanvas can be used (i.e.
    1.21 +    before its virtual methods can be called).
    1.22 + */
    1.23 +class SK_API SkProxyCanvas : public SkCanvas {
    1.24 +public:
    1.25 +    SkProxyCanvas() : fProxy(NULL) {}
    1.26 +    SkProxyCanvas(SkCanvas* proxy);
    1.27 +    virtual ~SkProxyCanvas();
    1.28 +
    1.29 +    SkCanvas*   getProxy() const { return fProxy; }
    1.30 +    void        setProxy(SkCanvas* proxy);
    1.31 +
    1.32 +    virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE;
    1.33 +    virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[],
    1.34 +                            const SkPaint& paint) SK_OVERRIDE;
    1.35 +    virtual void drawOval(const SkRect&, const SkPaint& paint) SK_OVERRIDE;
    1.36 +    virtual void drawRect(const SkRect&, const SkPaint& paint) SK_OVERRIDE;
    1.37 +    virtual void drawRRect(const SkRRect&, const SkPaint& paint) SK_OVERRIDE;
    1.38 +    virtual void drawPath(const SkPath& path, const SkPaint& paint) SK_OVERRIDE;
    1.39 +    virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top,
    1.40 +                            const SkPaint* paint = NULL) SK_OVERRIDE;
    1.41 +    virtual void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
    1.42 +                                      const SkRect& dst, const SkPaint* paint,
    1.43 +                                      DrawBitmapRectFlags flags) SK_OVERRIDE;
    1.44 +    virtual void drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m,
    1.45 +                                  const SkPaint* paint = NULL) SK_OVERRIDE;
    1.46 +    virtual void drawSprite(const SkBitmap& bitmap, int left, int top,
    1.47 +                            const SkPaint* paint = NULL) SK_OVERRIDE;
    1.48 +    virtual void drawText(const void* text, size_t byteLength, SkScalar x,
    1.49 +                          SkScalar y, const SkPaint& paint) SK_OVERRIDE;
    1.50 +    virtual void drawPosText(const void* text, size_t byteLength,
    1.51 +                             const SkPoint pos[], const SkPaint& paint) SK_OVERRIDE;
    1.52 +    virtual void drawPosTextH(const void* text, size_t byteLength,
    1.53 +                              const SkScalar xpos[], SkScalar constY,
    1.54 +                              const SkPaint& paint) SK_OVERRIDE;
    1.55 +    virtual void drawTextOnPath(const void* text, size_t byteLength,
    1.56 +                                const SkPath& path, const SkMatrix* matrix,
    1.57 +                                const SkPaint& paint) SK_OVERRIDE;
    1.58 +    virtual void drawPicture(SkPicture&) SK_OVERRIDE;
    1.59 +    virtual void drawVertices(VertexMode vmode, int vertexCount,
    1.60 +                              const SkPoint vertices[], const SkPoint texs[],
    1.61 +                              const SkColor colors[], SkXfermode* xmode,
    1.62 +                              const uint16_t indices[], int indexCount,
    1.63 +                              const SkPaint& paint) SK_OVERRIDE;
    1.64 +    virtual void drawData(const void* data, size_t length) SK_OVERRIDE;
    1.65 +
    1.66 +    virtual void beginCommentGroup(const char* description) SK_OVERRIDE;
    1.67 +    virtual void addComment(const char* kywd, const char* value) SK_OVERRIDE;
    1.68 +    virtual void endCommentGroup() SK_OVERRIDE;
    1.69 +
    1.70 +    virtual SkBounder* setBounder(SkBounder* bounder) SK_OVERRIDE;
    1.71 +    virtual SkDrawFilter* setDrawFilter(SkDrawFilter* filter) SK_OVERRIDE;
    1.72 +
    1.73 +protected:
    1.74 +    virtual void willSave(SaveFlags) SK_OVERRIDE;
    1.75 +    virtual SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveFlags) SK_OVERRIDE;
    1.76 +    virtual void willRestore() SK_OVERRIDE;
    1.77 +
    1.78 +    virtual void didTranslate(SkScalar, SkScalar) SK_OVERRIDE;
    1.79 +    virtual void didScale(SkScalar, SkScalar) SK_OVERRIDE;
    1.80 +    virtual void didRotate(SkScalar) SK_OVERRIDE;
    1.81 +    virtual void didSkew(SkScalar, SkScalar) SK_OVERRIDE;
    1.82 +    virtual void didConcat(const SkMatrix&) SK_OVERRIDE;
    1.83 +    virtual void didSetMatrix(const SkMatrix&) SK_OVERRIDE;
    1.84 +
    1.85 +    virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRIDE;
    1.86 +
    1.87 +    virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
    1.88 +    virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
    1.89 +    virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
    1.90 +    virtual void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE;
    1.91 +
    1.92 +private:
    1.93 +    SkCanvas*   fProxy;
    1.94 +
    1.95 +    typedef SkCanvas INHERITED;
    1.96 +};
    1.97 +
    1.98 +#endif

mercurial