gfx/skia/trunk/src/utils/SkCanvasStack.h

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     2 /*
     3  * Copyright 2013 Google Inc.
     4  *
     5  * Use of this source code is governed by a BSD-style license that can be
     6  * found in the LICENSE file.
     7  */
     9 #ifndef SkCanvasStack_DEFINED
    10 #define SkCanvasStack_DEFINED
    12 #include "SkNWayCanvas.h"
    13 #include "SkTArray.h"
    15 class SkCanvasStack : public SkNWayCanvas {
    16 public:
    17     SkCanvasStack(int width, int height);
    18     virtual ~SkCanvasStack();
    20     void pushCanvas(SkCanvas* canvas, const SkIPoint& origin);
    21     virtual void removeAll() SK_OVERRIDE;
    23     /*
    24      * The following add/remove canvas methods are overrides from SkNWayCanvas
    25      * that do not make sense in the context of our CanvasStack, but since we
    26      * can share most of the other implementation of NWay we override those
    27      * methods to be no-ops.
    28      */
    29     virtual void addCanvas(SkCanvas*) SK_OVERRIDE { SkDEBUGFAIL("Invalid Op"); }
    30     virtual void removeCanvas(SkCanvas*) SK_OVERRIDE { SkDEBUGFAIL("Invalid Op"); }
    32 protected:
    33     virtual void didSetMatrix(const SkMatrix&) SK_OVERRIDE;
    35     virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
    36     virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
    37     virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
    38     virtual void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE;
    40 private:
    41     void clipToZOrderedBounds();
    43     struct CanvasData {
    44         SkIPoint origin;
    45         SkRegion requiredClip;
    46     };
    48     SkTArray<CanvasData> fCanvasData;
    50     typedef SkNWayCanvas INHERITED;
    51 };
    53 #endif

mercurial