SkNWayCanvas.h revision 41af966ab338e95eee81ab618ab28195075338f7
16c924ad46c89955e78e071c792ef00df9910b42freed@android.com
2ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com/*
3ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Copyright 2011 Google Inc.
4ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com *
5ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Use of this source code is governed by a BSD-style license that can be
6ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * found in the LICENSE file.
7ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com */
8ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com
96c924ad46c89955e78e071c792ef00df9910b42freed@android.com#ifndef SkNWayCanvas_DEFINED
106c924ad46c89955e78e071c792ef00df9910b42freed@android.com#define SkNWayCanvas_DEFINED
116c924ad46c89955e78e071c792ef00df9910b42freed@android.com
126c924ad46c89955e78e071c792ef00df9910b42freed@android.com#include "SkCanvas.h"
136c924ad46c89955e78e071c792ef00df9910b42freed@android.com
14e1a81d2e22bc7221afdc200f372295b2510ab68bcommit-bot@chromium.orgclass SK_API SkNWayCanvas : public SkCanvas {
156c924ad46c89955e78e071c792ef00df9910b42freed@android.compublic:
16f0a062bc4573323abcf37394bb68e0230347a974djsollen@google.com    SkNWayCanvas(int width, int height);
176c924ad46c89955e78e071c792ef00df9910b42freed@android.com    virtual ~SkNWayCanvas();
1874b461961607fa57a150a9282c410ef0cab38764vandebo@chromium.org
19339e79fbeabae18a8b9ea094293c7c25eaf9dd68djsollen@google.com    virtual void addCanvas(SkCanvas*);
20339e79fbeabae18a8b9ea094293c7c25eaf9dd68djsollen@google.com    virtual void removeCanvas(SkCanvas*);
21339e79fbeabae18a8b9ea094293c7c25eaf9dd68djsollen@google.com    virtual void removeAll();
226c924ad46c89955e78e071c792ef00df9910b42freed@android.com
236c924ad46c89955e78e071c792ef00df9910b42freed@android.com    ///////////////////////////////////////////////////////////////////////////
246c924ad46c89955e78e071c792ef00df9910b42freed@android.com    // These are forwarded to the N canvases we're referencing
256c924ad46c89955e78e071c792ef00df9910b42freed@android.com
2643d748446a880c46d5b1ad8828cdbf796c07d9d9reed@google.com    virtual SkDrawFilter* setDrawFilter(SkDrawFilter*) SK_OVERRIDE;
2774b461961607fa57a150a9282c410ef0cab38764vandebo@chromium.org
2814cec91fe1dbe4986bfacdff8e2eb8928d60fb77commit-bot@chromium.org    virtual void beginCommentGroup(const char* description) SK_OVERRIDE;
2914cec91fe1dbe4986bfacdff8e2eb8928d60fb77commit-bot@chromium.org    virtual void addComment(const char* kywd, const char* value) SK_OVERRIDE;
3014cec91fe1dbe4986bfacdff8e2eb8928d60fb77commit-bot@chromium.org    virtual void endCommentGroup() SK_OVERRIDE;
3114cec91fe1dbe4986bfacdff8e2eb8928d60fb77commit-bot@chromium.org
32339e79fbeabae18a8b9ea094293c7c25eaf9dd68djsollen@google.comprotected:
336c924ad46c89955e78e071c792ef00df9910b42freed@android.com    SkTDArray<SkCanvas*> fList;
3474b461961607fa57a150a9282c410ef0cab38764vandebo@chromium.org
355f6102d07982043542343ff0a6c67b1319ac9fc7Florin Malita    virtual void willSave() SK_OVERRIDE;
36e54a23fcfa42b2fc9d320650de72bcb2d9566b2dcommit-bot@chromium.org    virtual SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveFlags) SK_OVERRIDE;
37e54a23fcfa42b2fc9d320650de72bcb2d9566b2dcommit-bot@chromium.org    virtual void willRestore() SK_OVERRIDE;
38e54a23fcfa42b2fc9d320650de72bcb2d9566b2dcommit-bot@chromium.org
3944c48d062f7996b5b46917e1b312a32ad101f326commit-bot@chromium.org    virtual void didConcat(const SkMatrix&) SK_OVERRIDE;
4044c48d062f7996b5b46917e1b312a32ad101f326commit-bot@chromium.org    virtual void didSetMatrix(const SkMatrix&) SK_OVERRIDE;
4144c48d062f7996b5b46917e1b312a32ad101f326commit-bot@chromium.org
42ab5827354e2c23624acc3fc1fe4a83788bc99e96commit-bot@chromium.org    virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRIDE;
43e0d9ce890e67d02727ac2811bb456ddb64f827d4reed@google.com    virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y,
44e0d9ce890e67d02727ac2811bb456ddb64f827d4reed@google.com                            const SkPaint&) SK_OVERRIDE;
45e0d9ce890e67d02727ac2811bb456ddb64f827d4reed@google.com    virtual void onDrawPosText(const void* text, size_t byteLength, const SkPoint pos[],
46e0d9ce890e67d02727ac2811bb456ddb64f827d4reed@google.com                               const SkPaint&) SK_OVERRIDE;
47e0d9ce890e67d02727ac2811bb456ddb64f827d4reed@google.com    virtual void onDrawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[],
48e0d9ce890e67d02727ac2811bb456ddb64f827d4reed@google.com                                SkScalar constY, const SkPaint&) SK_OVERRIDE;
49e0d9ce890e67d02727ac2811bb456ddb64f827d4reed@google.com    virtual void onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path,
50e0d9ce890e67d02727ac2811bb456ddb64f827d4reed@google.com                                  const SkMatrix* matrix, const SkPaint&) SK_OVERRIDE;
51b7425173f96e93b090787e2386ba5f022b6c2869fmalita    virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
52b7425173f96e93b090787e2386ba5f022b6c2869fmalita                                const SkPaint& paint) SK_OVERRIDE;
53b3c9d1c33caf325aada244204215eb790c228c12dandov    virtual void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
54b3c9d1c33caf325aada244204215eb790c228c12dandov                             const SkPoint texCoords[4], SkXfermode* xmode,
55b3c9d1c33caf325aada244204215eb790c228c12dandov                             const SkPaint& paint) SK_OVERRIDE;
56b7bac3d015cd1c85343d6c49316bfd942efa3f9fpiotaixr
5741af966ab338e95eee81ab618ab28195075338f7reed    void onDrawPaint(const SkPaint&) SK_OVERRIDE;
5841af966ab338e95eee81ab618ab28195075338f7reed    void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) SK_OVERRIDE;
5941af966ab338e95eee81ab618ab28195075338f7reed    void onDrawRect(const SkRect&, const SkPaint&) SK_OVERRIDE;
6041af966ab338e95eee81ab618ab28195075338f7reed    void onDrawOval(const SkRect&, const SkPaint&) SK_OVERRIDE;
6141af966ab338e95eee81ab618ab28195075338f7reed    void onDrawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE;
6241af966ab338e95eee81ab618ab28195075338f7reed    void onDrawPath(const SkPath&, const SkPaint&) SK_OVERRIDE;
6341af966ab338e95eee81ab618ab28195075338f7reed    void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPaint*) SK_OVERRIDE;
6441af966ab338e95eee81ab618ab28195075338f7reed    void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst, const SkPaint*,
6541af966ab338e95eee81ab618ab28195075338f7reed                          DrawBitmapRectFlags flags) SK_OVERRIDE;
6641af966ab338e95eee81ab618ab28195075338f7reed    void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*) SK_OVERRIDE;
6741af966ab338e95eee81ab618ab28195075338f7reed    void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst,
6841af966ab338e95eee81ab618ab28195075338f7reed                         const SkPaint*) SK_OVERRIDE;
6941af966ab338e95eee81ab618ab28195075338f7reed    void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst,
7041af966ab338e95eee81ab618ab28195075338f7reed                          const SkPaint*) SK_OVERRIDE;
7141af966ab338e95eee81ab618ab28195075338f7reed    void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) SK_OVERRIDE;
7241af966ab338e95eee81ab618ab28195075338f7reed    void onDrawVertices(VertexMode vmode, int vertexCount,
7341af966ab338e95eee81ab618ab28195075338f7reed                              const SkPoint vertices[], const SkPoint texs[],
7441af966ab338e95eee81ab618ab28195075338f7reed                              const SkColor colors[], SkXfermode* xmode,
7541af966ab338e95eee81ab618ab28195075338f7reed                              const uint16_t indices[], int indexCount,
7641af966ab338e95eee81ab618ab28195075338f7reed                              const SkPaint&) SK_OVERRIDE;
7741af966ab338e95eee81ab618ab28195075338f7reed
788f90a892c5130d4d26b5588e1ff151d01a40688arobertphillips@google.com    virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
798f90a892c5130d4d26b5588e1ff151d01a40688arobertphillips@google.com    virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
808f90a892c5130d4d26b5588e1ff151d01a40688arobertphillips@google.com    virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
818f90a892c5130d4d26b5588e1ff151d01a40688arobertphillips@google.com    virtual void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE;
828f90a892c5130d4d26b5588e1ff151d01a40688arobertphillips@google.com
83d5fa1a455aad61f3e99081fe7a9b065cb3b115c6reed    virtual void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) SK_OVERRIDE;
849b14f26d0f3a974f3dd626c8354e1db1cfcd322frobertphillips
856c924ad46c89955e78e071c792ef00df9910b42freed@android.com    class Iter;
866c924ad46c89955e78e071c792ef00df9910b42freed@android.com
87339e79fbeabae18a8b9ea094293c7c25eaf9dd68djsollen@google.comprivate:
886c924ad46c89955e78e071c792ef00df9910b42freed@android.com    typedef SkCanvas INHERITED;
896c924ad46c89955e78e071c792ef00df9910b42freed@android.com};
906c924ad46c89955e78e071c792ef00df9910b42freed@android.com
916c924ad46c89955e78e071c792ef00df9910b42freed@android.com
926c924ad46c89955e78e071c792ef00df9910b42freed@android.com#endif
93