1 /* 2 Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) 3 4 This library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Library General Public 6 License as published by the Free Software Foundation; either 7 version 2 of the License, or (at your option) any later version. 8 9 This library is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Library General Public License for more details. 13 14 You should have received a copy of the GNU Library General Public License 15 along with this library; see the file COPYING.LIB. If not, write to 16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 Boston, MA 02110-1301, USA. 18 */ 19 20 #ifndef GraphicsLayerTextureMapper_h 21 #define GraphicsLayerTextureMapper_h 22 23 #include "GraphicsContext.h" 24 #include "GraphicsLayer.h" 25 #include "GraphicsLayerClient.h" 26 #include "Image.h" 27 #include "TextureMapperNode.h" 28 29 #if ENABLE(WEBGL) 30 #include "GraphicsContext3D.h" 31 #endif 32 33 namespace WebCore { 34 35 class TextureMapperNode; 36 class BitmapTexture; 37 class TextureMapper; 38 39 class GraphicsLayerTextureMapper : public GraphicsLayer { 40 friend class TextureMapperNode; 41 42 public: 43 GraphicsLayerTextureMapper(GraphicsLayerClient*); 44 virtual ~GraphicsLayerTextureMapper(); 45 46 // reimps from GraphicsLayer.h 47 virtual void setNeedsDisplay(); 48 virtual void setNeedsDisplayInRect(const FloatRect&); 49 virtual void setParent(GraphicsLayer* layer); 50 virtual bool setChildren(const Vector<GraphicsLayer*>&); 51 virtual void addChild(GraphicsLayer*); 52 virtual void addChildAtIndex(GraphicsLayer*, int index); 53 virtual void addChildAbove(GraphicsLayer* layer, GraphicsLayer* sibling); 54 virtual void addChildBelow(GraphicsLayer* layer, GraphicsLayer* sibling); 55 virtual bool replaceChild(GraphicsLayer* oldChild, GraphicsLayer* newChild); 56 virtual void removeFromParent(); 57 virtual void setMaskLayer(GraphicsLayer* layer); 58 virtual void setPosition(const FloatPoint& p); 59 virtual void setAnchorPoint(const FloatPoint3D& p); 60 virtual void setSize(const FloatSize& size); 61 virtual void setTransform(const TransformationMatrix& t); 62 virtual void setChildrenTransform(const TransformationMatrix& t); 63 virtual void setPreserves3D(bool b); 64 virtual void setMasksToBounds(bool b); 65 virtual void setDrawsContent(bool b); 66 virtual void setBackgroundColor(const Color&); 67 virtual void clearBackgroundColor(); 68 virtual void setContentsOpaque(bool b); 69 virtual void setBackfaceVisibility(bool b); 70 virtual void setOpacity(float opacity); 71 virtual void setContentsRect(const IntRect& r); 72 virtual void setReplicatedByLayer(GraphicsLayer*); 73 virtual void setContentsToImage(Image*); 74 virtual void setContentsToMedia(PlatformLayer*); 75 virtual void setContentsBackgroundColor(const Color&); 76 #if ENABLE(WEBGL) 77 virtual void setContentsToGraphicsContext3D(const GraphicsContext3D*); 78 virtual void setGraphicsContext3DNeedsDisplay(); 79 #endif 80 virtual void setContentsOrientation(CompositingCoordinatesOrientation orientation); 81 virtual void syncCompositingState(); 82 virtual void syncCompositingStateForThisLayerOnly(); 83 virtual void setName(const String& name); 84 virtual PlatformLayer* platformLayer() const; 85 86 virtual bool addAnimation(const KeyframeValueList&, const IntSize& /*boxSize*/, const Animation*, const String& /*keyframesName*/, double /*timeOffset*/) { return false; } 87 88 void notifyChange(TextureMapperNode::ChangeMask changeMask); 89 inline TextureMapperNode::ContentData& pendingContent() { return m_pendingContent; } 90 inline int changeMask() const { return m_changeMask; } 91 void didSynchronize(); 92 93 private: 94 OwnPtr<TextureMapperNode> m_node; 95 bool m_syncQueued; 96 int m_changeMask; 97 TextureMapperNode::ContentData m_pendingContent; 98 }; 99 100 inline static GraphicsLayerTextureMapper* toGraphicsLayerTextureMapper(GraphicsLayer* layer) 101 { 102 return static_cast<GraphicsLayerTextureMapper*>(layer); 103 } 104 105 } 106 #endif // GraphicsLayerTextureMapper_h 107