michael@0: michael@0: /* michael@0: * Copyright 2013 Google Inc. michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: michael@0: #ifndef SkCanvasStack_DEFINED michael@0: #define SkCanvasStack_DEFINED michael@0: michael@0: #include "SkNWayCanvas.h" michael@0: #include "SkTArray.h" michael@0: michael@0: class SkCanvasStack : public SkNWayCanvas { michael@0: public: michael@0: SkCanvasStack(int width, int height); michael@0: virtual ~SkCanvasStack(); michael@0: michael@0: void pushCanvas(SkCanvas* canvas, const SkIPoint& origin); michael@0: virtual void removeAll() SK_OVERRIDE; michael@0: michael@0: /* michael@0: * The following add/remove canvas methods are overrides from SkNWayCanvas michael@0: * that do not make sense in the context of our CanvasStack, but since we michael@0: * can share most of the other implementation of NWay we override those michael@0: * methods to be no-ops. michael@0: */ michael@0: virtual void addCanvas(SkCanvas*) SK_OVERRIDE { SkDEBUGFAIL("Invalid Op"); } michael@0: virtual void removeCanvas(SkCanvas*) SK_OVERRIDE { SkDEBUGFAIL("Invalid Op"); } michael@0: michael@0: protected: michael@0: virtual void didSetMatrix(const SkMatrix&) SK_OVERRIDE; michael@0: michael@0: virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; michael@0: virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; michael@0: virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; michael@0: virtual void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE; michael@0: michael@0: private: michael@0: void clipToZOrderedBounds(); michael@0: michael@0: struct CanvasData { michael@0: SkIPoint origin; michael@0: SkRegion requiredClip; michael@0: }; michael@0: michael@0: SkTArray fCanvasData; michael@0: michael@0: typedef SkNWayCanvas INHERITED; michael@0: }; michael@0: michael@0: #endif