1a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch/* 2a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) 3a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 4a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch This library is free software; you can redistribute it and/or 5a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch modify it under the terms of the GNU Library General Public 6a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch License as published by the Free Software Foundation; either 7a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch version 2 of the License, or (at your option) any later version. 8a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 9a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch This library is distributed in the hope that it will be useful, 10a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch but WITHOUT ANY WARRANTY; without even the implied warranty of 11a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch Library General Public License for more details. 13a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 14a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch You should have received a copy of the GNU Library General Public License 15a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch along with this library; see the file COPYING.LIB. If not, write to 16a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch Boston, MA 02110-1301, USA. 18a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch*/ 19a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 20a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#include "config.h" 21a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#include "GraphicsLayerTextureMapper.h" 22a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 2328040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu#include "TextureMapperNode.h" 24a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 25a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochnamespace WebCore { 26a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 2728040489d744e0c5d475a88663056c9040ed5320Teng-Hui ZhuGraphicsLayerTextureMapper::GraphicsLayerTextureMapper(GraphicsLayerClient* client) 2828040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu : GraphicsLayer(client) 2928040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu , m_node(new TextureMapperNode()) 3028040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu , m_changeMask(0) 31a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 32a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 33a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 3428040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhuvoid GraphicsLayerTextureMapper::notifyChange(TextureMapperNode::ChangeMask changeMask) 35a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 36a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch m_changeMask |= changeMask; 3728040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu if (!client()) 38a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch return; 3928040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu client()->notifySyncRequired(this); 40a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 41a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 4228040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhuvoid GraphicsLayerTextureMapper::didSynchronize() 43a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 4428040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu m_syncQueued = false; 4528040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu m_changeMask = 0; 46a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch m_pendingContent.needsDisplay = false; 47a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch m_pendingContent.needsDisplayRect = IntRect(); 48a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 49a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 50a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochvoid GraphicsLayerTextureMapper::setName(const String& name) 51a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 5228040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu GraphicsLayer::setName(name); 53a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 54a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 55a94275402997c11dd2e778633dacf4b7e630a35dBen MurdochGraphicsLayerTextureMapper::~GraphicsLayerTextureMapper() 56a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 57a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 58a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 59a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch/* \reimp (GraphicsLayer.h): The current size might change, thus we need to update the whole display. 60a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch*/ 61a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochvoid GraphicsLayerTextureMapper::setNeedsDisplay() 62a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 6328040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu m_pendingContent.needsDisplay = true; 6428040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu notifyChange(TextureMapperNode::DisplayChange); 65a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 66a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 67a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch/* \reimp (GraphicsLayer.h) 68a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch*/ 69a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochvoid GraphicsLayerTextureMapper::setNeedsDisplayInRect(const FloatRect& rect) 70a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 7128040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu if (m_pendingContent.needsDisplay) 72a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch return; 7328040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu m_pendingContent.needsDisplayRect.unite(IntRect(rect)); 7428040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu notifyChange(TextureMapperNode::DisplayChange); 75a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 76a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 77a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch/* \reimp (GraphicsLayer.h) 78a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch*/ 79a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochvoid GraphicsLayerTextureMapper::setParent(GraphicsLayer* layer) 80a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 8128040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu notifyChange(TextureMapperNode::ParentChange); 82a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch GraphicsLayer::setParent(layer); 83a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 84a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 85a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch/* \reimp (GraphicsLayer.h) 86a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch*/ 87a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochbool GraphicsLayerTextureMapper::setChildren(const Vector<GraphicsLayer*>& children) 88a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 8928040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu notifyChange(TextureMapperNode::ChildrenChange); 90a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch return GraphicsLayer::setChildren(children); 91a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 92a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 93a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch/* \reimp (GraphicsLayer.h) 94a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch*/ 95a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochvoid GraphicsLayerTextureMapper::addChild(GraphicsLayer* layer) 96a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 9728040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu notifyChange(TextureMapperNode::ChildrenChange); 98a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch GraphicsLayer::addChild(layer); 99a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 100a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 101a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch/* \reimp (GraphicsLayer.h) 102a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch*/ 103a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochvoid GraphicsLayerTextureMapper::addChildAtIndex(GraphicsLayer* layer, int index) 104a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 105a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch GraphicsLayer::addChildAtIndex(layer, index); 10628040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu notifyChange(TextureMapperNode::ChildrenChange); 107a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 108a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 109a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch/* \reimp (GraphicsLayer.h) 110a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch*/ 111a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochvoid GraphicsLayerTextureMapper::addChildAbove(GraphicsLayer* layer, GraphicsLayer* sibling) 112a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 113a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch GraphicsLayer::addChildAbove(layer, sibling); 11428040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu notifyChange(TextureMapperNode::ChildrenChange); 115a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 116a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 117a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch/* \reimp (GraphicsLayer.h) 118a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch*/ 119a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochvoid GraphicsLayerTextureMapper::addChildBelow(GraphicsLayer* layer, GraphicsLayer* sibling) 120a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 121a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 122a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch GraphicsLayer::addChildBelow(layer, sibling); 12328040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu notifyChange(TextureMapperNode::ChildrenChange); 124a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 125a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 126a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch/* \reimp (GraphicsLayer.h) 127a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch*/ 128a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochbool GraphicsLayerTextureMapper::replaceChild(GraphicsLayer* oldChild, GraphicsLayer* newChild) 129a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 130a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch if (GraphicsLayer::replaceChild(oldChild, newChild)) { 13128040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu notifyChange(TextureMapperNode::ChildrenChange); 132a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch return true; 133a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch } 134a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch return false; 135a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 136a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 137a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch/* \reimp (GraphicsLayer.h) 138a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch*/ 139a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochvoid GraphicsLayerTextureMapper::removeFromParent() 140a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 141a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch if (!parent()) 142a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch return; 14328040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu notifyChange(TextureMapperNode::ParentChange); 144a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch GraphicsLayer::removeFromParent(); 145a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 146a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 147a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch/* \reimp (GraphicsLayer.h) 148a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch*/ 149a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochvoid GraphicsLayerTextureMapper::setMaskLayer(GraphicsLayer* value) 150a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 151a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch if (value == maskLayer()) 152a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch return; 153a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch GraphicsLayer::setMaskLayer(value); 15428040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu notifyChange(TextureMapperNode::MaskLayerChange); 155a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 156a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 157a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 158a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch/* \reimp (GraphicsLayer.h) 159a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch*/ 160a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochvoid GraphicsLayerTextureMapper::setReplicatedByLayer(GraphicsLayer* value) 161a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 162a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch if (value == replicaLayer()) 163a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch return; 164a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch GraphicsLayer::setReplicatedByLayer(value); 16528040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu notifyChange(TextureMapperNode::ReplicaLayerChange); 166a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 167a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 168a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch/* \reimp (GraphicsLayer.h) 169a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch*/ 170a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochvoid GraphicsLayerTextureMapper::setPosition(const FloatPoint& value) 171a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 172a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch if (value == position()) 173a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch return; 174a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch GraphicsLayer::setPosition(value); 17528040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu notifyChange(TextureMapperNode::PositionChange); 176a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 177a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 178a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch/* \reimp (GraphicsLayer.h) 179a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch*/ 180a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochvoid GraphicsLayerTextureMapper::setAnchorPoint(const FloatPoint3D& value) 181a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 182a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch if (value == anchorPoint()) 183a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch return; 184a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch GraphicsLayer::setAnchorPoint(value); 18528040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu notifyChange(TextureMapperNode::AnchorPointChange); 186a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 187a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 188a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch/* \reimp (GraphicsLayer.h) 189a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch*/ 190a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochvoid GraphicsLayerTextureMapper::setSize(const FloatSize& value) 191a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 192a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch if (value == size()) 193a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch return; 194a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 195a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch GraphicsLayer::setSize(value); 19628040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu notifyChange(TextureMapperNode::SizeChange); 197a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 198a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 199a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch/* \reimp (GraphicsLayer.h) 200a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch*/ 201a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochvoid GraphicsLayerTextureMapper::setTransform(const TransformationMatrix& value) 202a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 203a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch if (value == transform()) 204a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch return; 205a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 206a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch GraphicsLayer::setTransform(value); 20728040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu notifyChange(TextureMapperNode::TransformChange); 208a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 209a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 210a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch/* \reimp (GraphicsLayer.h) 211a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch*/ 212a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochvoid GraphicsLayerTextureMapper::setChildrenTransform(const TransformationMatrix& value) 213a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 214a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch if (value == childrenTransform()) 215a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch return; 216a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch GraphicsLayer::setChildrenTransform(value); 21728040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu notifyChange(TextureMapperNode::ChildrenTransformChange); 218a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 219a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 220a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch/* \reimp (GraphicsLayer.h) 221a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch*/ 222a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochvoid GraphicsLayerTextureMapper::setPreserves3D(bool value) 223a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 224a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch if (value == preserves3D()) 225a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch return; 226a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch GraphicsLayer::setPreserves3D(value); 22728040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu notifyChange(TextureMapperNode::Preserves3DChange); 228a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 229a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 230a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch/* \reimp (GraphicsLayer.h) 231a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch*/ 232a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochvoid GraphicsLayerTextureMapper::setMasksToBounds(bool value) 233a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 234a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch if (value == masksToBounds()) 235a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch return; 236a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch GraphicsLayer::setMasksToBounds(value); 23728040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu notifyChange(TextureMapperNode::MasksToBoundsChange); 238a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 239a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 240a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch/* \reimp (GraphicsLayer.h) 241a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch*/ 242a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochvoid GraphicsLayerTextureMapper::setDrawsContent(bool value) 243a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 244a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch if (value == drawsContent()) 245a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch return; 24628040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu notifyChange(TextureMapperNode::DrawsContentChange); 247a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch GraphicsLayer::setDrawsContent(value); 248a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 249a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 250a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch/* \reimp (GraphicsLayer.h) 251a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch*/ 252a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochvoid GraphicsLayerTextureMapper::setBackgroundColor(const Color& value) 253a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 25428040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu if (value == m_pendingContent.backgroundColor) 255a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch return; 25628040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu m_pendingContent.backgroundColor = value; 257a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch GraphicsLayer::setBackgroundColor(value); 25828040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu notifyChange(TextureMapperNode::BackgroundColorChange); 259a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 260a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 261a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch/* \reimp (GraphicsLayer.h) 262a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch*/ 263a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochvoid GraphicsLayerTextureMapper::clearBackgroundColor() 264a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 26528040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu if (!m_pendingContent.backgroundColor.isValid()) 266a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch return; 26728040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu m_pendingContent.backgroundColor = Color(); 268a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch GraphicsLayer::clearBackgroundColor(); 26928040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu notifyChange(TextureMapperNode::BackgroundColorChange); 270a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 271a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 272a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch/* \reimp (GraphicsLayer.h) 273a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch*/ 274a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochvoid GraphicsLayerTextureMapper::setContentsOpaque(bool value) 275a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 276a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch if (value == contentsOpaque()) 277a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch return; 27828040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu notifyChange(TextureMapperNode::ContentsOpaqueChange); 279a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch GraphicsLayer::setContentsOpaque(value); 280a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 281a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 282a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch/* \reimp (GraphicsLayer.h) 283a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch*/ 284a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochvoid GraphicsLayerTextureMapper::setBackfaceVisibility(bool value) 285a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 286a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch if (value == backfaceVisibility()) 287a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch return; 288a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch GraphicsLayer::setBackfaceVisibility(value); 28928040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu notifyChange(TextureMapperNode::BackfaceVisibilityChange); 290a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 291a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 292a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch/* \reimp (GraphicsLayer.h) 293a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch*/ 294a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochvoid GraphicsLayerTextureMapper::setOpacity(float value) 295a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 296a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch if (value == opacity()) 297a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch return; 298a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch GraphicsLayer::setOpacity(value); 29928040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu notifyChange(TextureMapperNode::OpacityChange); 300a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 301a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 302a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch/* \reimp (GraphicsLayer.h) 303a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch*/ 304a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochvoid GraphicsLayerTextureMapper::setContentsRect(const IntRect& value) 305a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 306a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch if (value == contentsRect()) 307a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch return; 308a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch GraphicsLayer::setContentsRect(value); 30928040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu notifyChange(TextureMapperNode::ContentsRectChange); 310a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 311a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 312a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch/* \reimp (GraphicsLayer.h) 313a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch*/ 314a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochvoid GraphicsLayerTextureMapper::setContentsToImage(Image* image) 315a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 31628040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu notifyChange(TextureMapperNode::ContentChange); 31728040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu m_pendingContent.contentType = image ? TextureMapperNode::DirectImageContentType : TextureMapperNode::HTMLContentType; 31828040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu m_pendingContent.image = image; 319a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch GraphicsLayer::setContentsToImage(image); 320a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 321a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 322a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch/* \reimp (GraphicsLayer.h) 323a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch*/ 324a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochvoid GraphicsLayerTextureMapper::setContentsBackgroundColor(const Color& color) 325a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 32628040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu notifyChange(TextureMapperNode::ContentChange); 32728040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu m_pendingContent.contentType = TextureMapperNode::ColorContentType; 32828040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu m_pendingContent.backgroundColor = color; 329a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch GraphicsLayer::setContentsBackgroundColor(color); 330a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 331a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 332a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 333a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochvoid GraphicsLayerTextureMapper::setContentsToMedia(PlatformLayer* media) 334a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 335a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch GraphicsLayer::setContentsToMedia(media); 33628040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu notifyChange(TextureMapperNode::ContentChange); 33728040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu m_pendingContent.contentType = media ? TextureMapperNode::MediaContentType : TextureMapperNode::HTMLContentType; 338a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch if (media) 3392bde8e466a4451c7319e3a072d118917957d6554Steve Block m_pendingContent.media = static_cast<TextureMapperMediaLayer*>(media); 340a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch else 34128040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu m_pendingContent.media = 0; 342a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 343a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 344a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch/* \reimp (GraphicsLayer.h) 345a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch*/ 346a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochvoid GraphicsLayerTextureMapper::setContentsOrientation(CompositingCoordinatesOrientation orientation) 347a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 348a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch if (contentsOrientation() == orientation) 349a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch return; 35028040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu notifyChange(TextureMapperNode::ContentsOrientationChange); 351a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch GraphicsLayer::setContentsOrientation(orientation); 352a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 353a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 354a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch/* \reimp (GraphicsLayer.h) 355a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch*/ 356a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochvoid GraphicsLayerTextureMapper::syncCompositingStateForThisLayerOnly() 357a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 35828040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu m_node->syncCompositingState(this, false); 359a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 360a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 361a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch/* \reimp (GraphicsLayer.h) 362a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch*/ 363a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochvoid GraphicsLayerTextureMapper::syncCompositingState() 364a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 36528040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu m_node->syncCompositingState(this, true); 366a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 367a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 368a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch/* \reimp (GraphicsLayer.h) 369a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch*/ 370a94275402997c11dd2e778633dacf4b7e630a35dBen MurdochPlatformLayer* GraphicsLayerTextureMapper::platformLayer() const 371a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 372a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch return m_node.get(); 373a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 374a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 375a94275402997c11dd2e778633dacf4b7e630a35dBen MurdochPassOwnPtr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerClient* client) 376a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 377a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch return new GraphicsLayerTextureMapper(client); 378a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 379a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 380a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 381