OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2010, Google Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 4 * |
| 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are |
| 7 * met: |
| 8 * |
| 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. |
| 11 * * Redistributions in binary form must reproduce the above |
| 12 * copyright notice, this list of conditions and the following disclaimer |
| 13 * in the documentation and/or other materials provided with the |
| 14 * distribution. |
| 15 * * Neither the name of Google Inc. nor the names of its |
| 16 * contributors may be used to endorse or promote products derived from |
| 17 * this software without specific prior written permission. |
| 18 * |
| 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 */ |
| 31 |
| 32 #ifndef GraphicsLayerSkia_h_ |
| 33 #define GraphicsLayerSkia_h_ |
| 34 |
| 35 // TODO(vangelis): File heavily borrows from GraphicsLayerCACF.h. See comment |
| 36 // at the top of GraphicsLayerSkia.cpp. |
| 37 |
| 38 #if USE(ACCELERATED_COMPOSITING) |
| 39 |
| 40 #include "GraphicsLayer.h" |
| 41 #include "GraphicsContext.h" |
| 42 |
| 43 namespace WebCore { |
| 44 |
| 45 class LayerSkia; |
| 46 |
| 47 class GraphicsLayerSkia : public GraphicsLayer { |
| 48 public: |
| 49 |
| 50 GraphicsLayerSkia(GraphicsLayerClient*); |
| 51 virtual ~GraphicsLayerSkia(); |
| 52 |
| 53 virtual void setName(const String& inName); |
| 54 |
| 55 // for hosting this GraphicsLayer in a native layer hierarchy |
| 56 virtual NativeLayer nativeLayer() const; |
| 57 |
| 58 virtual bool setChildren(const Vector<GraphicsLayer*>&); |
| 59 virtual void addChild(GraphicsLayer *layer); |
| 60 virtual void addChildAtIndex(GraphicsLayer *layer, int index); |
| 61 virtual void addChildAbove(GraphicsLayer *layer, GraphicsLayer *sibling); |
| 62 virtual void addChildBelow(GraphicsLayer *layer, GraphicsLayer *sibling); |
| 63 virtual bool replaceChild(GraphicsLayer *oldChild, GraphicsLayer *newChild); |
| 64 |
| 65 virtual void removeFromParent(); |
| 66 |
| 67 virtual void setPosition(const FloatPoint& inPoint); |
| 68 virtual void setAnchorPoint(const FloatPoint3D& inPoint); |
| 69 virtual void setSize(const FloatSize& inSize); |
| 70 |
| 71 virtual void setTransform(const TransformationMatrix&); |
| 72 |
| 73 virtual void setChildrenTransform(const TransformationMatrix&); |
| 74 |
| 75 virtual void setPreserves3D(bool); |
| 76 virtual void setMasksToBounds(bool); |
| 77 virtual void setDrawsContent(bool); |
| 78 |
| 79 virtual void setBackgroundColor(const Color&); |
| 80 virtual void clearBackgroundColor(); |
| 81 |
| 82 virtual void setContentsOpaque(bool); |
| 83 virtual void setBackfaceVisibility(bool); |
| 84 |
| 85 virtual void setOpacity(float opacity); |
| 86 |
| 87 virtual void setNeedsDisplay(); |
| 88 virtual void setNeedsDisplayInRect(const FloatRect&); |
| 89 |
| 90 virtual void setContentsRect(const IntRect&); |
| 91 |
| 92 virtual void setContentsToImage(Image*); |
| 93 virtual void setContentsToVideo(PlatformLayer*); |
| 94 |
| 95 virtual PlatformLayer* platformLayer() const; |
| 96 |
| 97 virtual void setDebugBackgroundColor(const Color&); |
| 98 virtual void setDebugBorder(const Color&, float borderWidth); |
| 99 |
| 100 virtual void setGeometryOrientation(CompositingCoordinatesOrientation); |
| 101 |
| 102 void notifySyncRequired() { if (m_client) m_client->notifySyncRequired(this)
; } |
| 103 |
| 104 private: |
| 105 void updateOpacityOnLayer(); |
| 106 |
| 107 LayerSkia* primaryLayer() const { return m_transformLayer.get() ? m_transfo
rmLayer.get() : m_layer.get(); } |
| 108 LayerSkia* hostLayerForSublayers() const; |
| 109 LayerSkia* layerForSuperlayer() const; |
| 110 |
| 111 CompositingCoordinatesOrientation defaultContentsOrientation() const; |
| 112 void updateSublayerList(); |
| 113 void updateLayerPosition(); |
| 114 void updateLayerSize(); |
| 115 void updateAnchorPoint(); |
| 116 void updateTransform(); |
| 117 void updateChildrenTransform(); |
| 118 void updateMasksToBounds(); |
| 119 void updateContentsOpaque(); |
| 120 void updateBackfaceVisibility(); |
| 121 void updateLayerPreserves3D(); |
| 122 void updateLayerDrawsContent(); |
| 123 void updateLayerBackgroundColor(); |
| 124 |
| 125 void updateContentsImage(); |
| 126 void updateContentsVideo(); |
| 127 void updateContentsRect(); |
| 128 void updateGeometryOrientation(); |
| 129 |
| 130 void setupContentsLayer(LayerSkia*); |
| 131 LayerSkia* contentsLayer() const { return m_contentsLayer.get(); } |
| 132 |
| 133 RefPtr<LayerSkia> m_layer; |
| 134 RefPtr<LayerSkia> m_transformLayer; |
| 135 RefPtr<LayerSkia> m_contentsLayer; |
| 136 |
| 137 enum ContentsLayerPurpose { |
| 138 NoContentsLayer = 0, |
| 139 ContentsLayerForImage, |
| 140 ContentsLayerForVideo |
| 141 }; |
| 142 |
| 143 ContentsLayerPurpose m_contentsLayerPurpose; |
| 144 bool m_contentsLayerHasBackgroundColor : 1; |
| 145 }; |
| 146 |
| 147 } // namespace WebCore |
| 148 |
| 149 #endif // USE(ACCELERATED_COMPOSITING) |
| 150 |
| 151 #endif // GraphicsLayerSkia_h_ |
OLD | NEW |