summaryrefslogtreecommitdiff
path: root/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp')
-rw-r--r--Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp274
1 files changed, 122 insertions, 152 deletions
diff --git a/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp b/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp
index 1b87ee626..78a0246f7 100644
--- a/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp
+++ b/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp
@@ -21,31 +21,25 @@
#include "GraphicsLayerTextureMapper.h"
#include "GraphicsContext.h"
-#include "GraphicsLayerAnimation.h"
#include "GraphicsLayerFactory.h"
#include "ImageBuffer.h"
+#include "TextureMapperAnimation.h"
#include <wtf/CurrentTime.h>
-#if USE(TEXTURE_MAPPER)
+#if !USE(COORDINATED_GRAPHICS)
namespace WebCore {
-TextureMapperLayer* toTextureMapperLayer(GraphicsLayer* layer)
-{
- return layer ? toGraphicsLayerTextureMapper(layer)->layer() : 0;
-}
-
-std::unique_ptr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, GraphicsLayerClient* client)
+std::unique_ptr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, GraphicsLayerClient& client, Type layerType)
{
if (!factory)
- return std::make_unique<GraphicsLayerTextureMapper>(client);
+ return std::make_unique<GraphicsLayerTextureMapper>(layerType, client);
- return factory->createGraphicsLayer(client);
+ return factory->createGraphicsLayer(layerType, client);
}
-GraphicsLayerTextureMapper::GraphicsLayerTextureMapper(GraphicsLayerClient* client)
- : GraphicsLayer(client)
- , m_layer(adoptPtr(new TextureMapperLayer()))
+GraphicsLayerTextureMapper::GraphicsLayerTextureMapper(Type layerType, GraphicsLayerClient& client)
+ : GraphicsLayer(layerType, client)
, m_compositedNativeImagePtr(0)
, m_changeMask(NoChanges)
, m_needsDisplay(false)
@@ -59,15 +53,11 @@ GraphicsLayerTextureMapper::GraphicsLayerTextureMapper(GraphicsLayerClient* clie
void GraphicsLayerTextureMapper::notifyChange(ChangeMask changeMask)
{
+ bool flushRequired = m_changeMask == NoChanges;
m_changeMask |= changeMask;
- if (!client())
- return;
- client()->notifyFlushRequired(this);
-}
-void GraphicsLayerTextureMapper::setName(const String& name)
-{
- GraphicsLayer::setName(name);
+ if (flushRequired)
+ client().notifyFlushRequired(this);
}
GraphicsLayerTextureMapper::~GraphicsLayerTextureMapper()
@@ -78,33 +68,23 @@ GraphicsLayerTextureMapper::~GraphicsLayerTextureMapper()
willBeDestroyed();
}
-void GraphicsLayerTextureMapper::willBeDestroyed()
-{
- GraphicsLayer::willBeDestroyed();
-}
-
-/* \reimp (GraphicsLayer.h): The current size might change, thus we need to update the whole display.
-*/
void GraphicsLayerTextureMapper::setNeedsDisplay()
{
if (!drawsContent())
return;
+ // The current size might change, thus we need to update the whole display.
m_needsDisplay = true;
notifyChange(DisplayChange);
addRepaintRect(FloatRect(FloatPoint(), m_size));
}
-/* \reimp (GraphicsLayer.h)
-*/
void GraphicsLayerTextureMapper::setContentsNeedsDisplay()
{
notifyChange(DisplayChange);
addRepaintRect(contentsRect());
}
-/* \reimp (GraphicsLayer.h)
-*/
void GraphicsLayerTextureMapper::setNeedsDisplayInRect(const FloatRect& rect, ShouldClipToLayer)
{
if (!drawsContent())
@@ -117,8 +97,6 @@ void GraphicsLayerTextureMapper::setNeedsDisplayInRect(const FloatRect& rect, Sh
addRepaintRect(rect);
}
-/* \reimp (GraphicsLayer.h)
-*/
bool GraphicsLayerTextureMapper::setChildren(const Vector<GraphicsLayer*>& children)
{
if (GraphicsLayer::setChildren(children)) {
@@ -128,40 +106,30 @@ bool GraphicsLayerTextureMapper::setChildren(const Vector<GraphicsLayer*>& child
return false;
}
-/* \reimp (GraphicsLayer.h)
-*/
void GraphicsLayerTextureMapper::addChild(GraphicsLayer* layer)
{
notifyChange(ChildrenChange);
GraphicsLayer::addChild(layer);
}
-/* \reimp (GraphicsLayer.h)
-*/
void GraphicsLayerTextureMapper::addChildAtIndex(GraphicsLayer* layer, int index)
{
GraphicsLayer::addChildAtIndex(layer, index);
notifyChange(ChildrenChange);
}
-/* \reimp (GraphicsLayer.h)
-*/
void GraphicsLayerTextureMapper::addChildAbove(GraphicsLayer* layer, GraphicsLayer* sibling)
{
GraphicsLayer::addChildAbove(layer, sibling);
notifyChange(ChildrenChange);
}
-/* \reimp (GraphicsLayer.h)
-*/
void GraphicsLayerTextureMapper::addChildBelow(GraphicsLayer* layer, GraphicsLayer* sibling)
{
GraphicsLayer::addChildBelow(layer, sibling);
notifyChange(ChildrenChange);
}
-/* \reimp (GraphicsLayer.h)
-*/
bool GraphicsLayerTextureMapper::replaceChild(GraphicsLayer* oldChild, GraphicsLayer* newChild)
{
if (GraphicsLayer::replaceChild(oldChild, newChild)) {
@@ -171,8 +139,6 @@ bool GraphicsLayerTextureMapper::replaceChild(GraphicsLayer* oldChild, GraphicsL
return false;
}
-/* \reimp (GraphicsLayer.h)
-*/
void GraphicsLayerTextureMapper::setMaskLayer(GraphicsLayer* value)
{
if (value == maskLayer())
@@ -187,8 +153,6 @@ void GraphicsLayerTextureMapper::setMaskLayer(GraphicsLayer* value)
}
-/* \reimp (GraphicsLayer.h)
-*/
void GraphicsLayerTextureMapper::setReplicatedByLayer(GraphicsLayer* value)
{
if (value == replicaLayer())
@@ -197,8 +161,6 @@ void GraphicsLayerTextureMapper::setReplicatedByLayer(GraphicsLayer* value)
notifyChange(ReplicaLayerChange);
}
-/* \reimp (GraphicsLayer.h)
-*/
void GraphicsLayerTextureMapper::setPosition(const FloatPoint& value)
{
if (value == position())
@@ -207,8 +169,6 @@ void GraphicsLayerTextureMapper::setPosition(const FloatPoint& value)
notifyChange(PositionChange);
}
-/* \reimp (GraphicsLayer.h)
-*/
void GraphicsLayerTextureMapper::setAnchorPoint(const FloatPoint3D& value)
{
if (value == anchorPoint())
@@ -217,8 +177,6 @@ void GraphicsLayerTextureMapper::setAnchorPoint(const FloatPoint3D& value)
notifyChange(AnchorPointChange);
}
-/* \reimp (GraphicsLayer.h)
-*/
void GraphicsLayerTextureMapper::setSize(const FloatSize& value)
{
if (value == size())
@@ -230,8 +188,6 @@ void GraphicsLayerTextureMapper::setSize(const FloatSize& value)
notifyChange(SizeChange);
}
-/* \reimp (GraphicsLayer.h)
-*/
void GraphicsLayerTextureMapper::setTransform(const TransformationMatrix& value)
{
if (value == transform())
@@ -241,8 +197,6 @@ void GraphicsLayerTextureMapper::setTransform(const TransformationMatrix& value)
notifyChange(TransformChange);
}
-/* \reimp (GraphicsLayer.h)
-*/
void GraphicsLayerTextureMapper::setChildrenTransform(const TransformationMatrix& value)
{
if (value == childrenTransform())
@@ -251,8 +205,6 @@ void GraphicsLayerTextureMapper::setChildrenTransform(const TransformationMatrix
notifyChange(ChildrenTransformChange);
}
-/* \reimp (GraphicsLayer.h)
-*/
void GraphicsLayerTextureMapper::setPreserves3D(bool value)
{
if (value == preserves3D())
@@ -261,8 +213,6 @@ void GraphicsLayerTextureMapper::setPreserves3D(bool value)
notifyChange(Preserves3DChange);
}
-/* \reimp (GraphicsLayer.h)
-*/
void GraphicsLayerTextureMapper::setMasksToBounds(bool value)
{
if (value == masksToBounds())
@@ -271,8 +221,6 @@ void GraphicsLayerTextureMapper::setMasksToBounds(bool value)
notifyChange(MasksToBoundsChange);
}
-/* \reimp (GraphicsLayer.h)
-*/
void GraphicsLayerTextureMapper::setDrawsContent(bool value)
{
if (value == drawsContent())
@@ -284,8 +232,6 @@ void GraphicsLayerTextureMapper::setDrawsContent(bool value)
setNeedsDisplay();
}
-/* \reimp (GraphicsLayer.h)
-*/
void GraphicsLayerTextureMapper::setContentsVisible(bool value)
{
if (value == contentsAreVisible())
@@ -296,8 +242,6 @@ void GraphicsLayerTextureMapper::setContentsVisible(bool value)
maskLayer()->setContentsVisible(value);
}
-/* \reimp (GraphicsLayer.h)
-*/
void GraphicsLayerTextureMapper::setContentsOpaque(bool value)
{
if (value == contentsOpaque())
@@ -306,8 +250,6 @@ void GraphicsLayerTextureMapper::setContentsOpaque(bool value)
GraphicsLayer::setContentsOpaque(value);
}
-/* \reimp (GraphicsLayer.h)
-*/
void GraphicsLayerTextureMapper::setBackfaceVisibility(bool value)
{
if (value == backfaceVisibility())
@@ -316,8 +258,6 @@ void GraphicsLayerTextureMapper::setBackfaceVisibility(bool value)
notifyChange(BackfaceVisibilityChange);
}
-/* \reimp (GraphicsLayer.h)
-*/
void GraphicsLayerTextureMapper::setOpacity(float value)
{
if (value == opacity())
@@ -326,9 +266,7 @@ void GraphicsLayerTextureMapper::setOpacity(float value)
notifyChange(OpacityChange);
}
-/* \reimp (GraphicsLayer.h)
-*/
-void GraphicsLayerTextureMapper::setContentsRect(const IntRect& value)
+void GraphicsLayerTextureMapper::setContentsRect(const FloatRect& value)
{
if (value == contentsRect())
return;
@@ -345,15 +283,12 @@ void GraphicsLayerTextureMapper::setContentsToSolidColor(const Color& color)
notifyChange(BackgroundColorChange);
}
-
-/* \reimp (GraphicsLayer.h)
-*/
void GraphicsLayerTextureMapper::setContentsToImage(Image* image)
{
if (image) {
// Make the decision about whether the image has changed.
// This code makes the assumption that pointer equality on a NativeImagePtr is a valid way to tell if the image is changed.
- // This assumption is true in Qt, GTK and EFL.
+ // This assumption is true for the GTK+ port.
NativeImagePtr newNativeImagePtr = image->nativeImageForCurrentFrame();
if (!newNativeImagePtr)
return;
@@ -365,28 +300,29 @@ void GraphicsLayerTextureMapper::setContentsToImage(Image* image)
if (!m_compositedImage)
m_compositedImage = TextureMapperTiledBackingStore::create();
m_compositedImage->setContentsToImage(image);
+ m_compositedImage->updateContentsScale(pageScaleFactor() * deviceScaleFactor());
} else {
- m_compositedNativeImagePtr = 0;
- m_compositedImage = 0;
+ m_compositedNativeImagePtr = nullptr;
+ m_compositedImage = nullptr;
}
- setContentsToMedia(m_compositedImage.get());
+ setContentsToPlatformLayer(m_compositedImage.get(), ContentsLayerForImage);
notifyChange(ContentChange);
GraphicsLayer::setContentsToImage(image);
}
-void GraphicsLayerTextureMapper::setContentsToMedia(TextureMapperPlatformLayer* media)
+void GraphicsLayerTextureMapper::setContentsToPlatformLayer(TextureMapperPlatformLayer* platformLayer, ContentsLayerPurpose purpose)
{
- if (media == m_contentsLayer)
+ if (platformLayer == m_contentsLayer)
return;
- GraphicsLayer::setContentsToMedia(media);
+ GraphicsLayer::setContentsToPlatformLayer(platformLayer, purpose);
notifyChange(ContentChange);
if (m_contentsLayer)
m_contentsLayer->setClient(0);
- m_contentsLayer = media;
+ m_contentsLayer = platformLayer;
if (m_contentsLayer)
m_contentsLayer->setClient(this);
@@ -428,26 +364,25 @@ void GraphicsLayerTextureMapper::setIsScrollable(bool isScrollable)
notifyChange(IsScrollableChange);
}
-/* \reimp (GraphicsLayer.h)
-*/
void GraphicsLayerTextureMapper::flushCompositingStateForThisLayerOnly()
{
prepareBackingStoreIfNeeded();
commitLayerChanges();
- m_layer->syncAnimations();
- updateBackingStoreIfNeeded();
+ m_layer.syncAnimations();
}
void GraphicsLayerTextureMapper::prepareBackingStoreIfNeeded()
{
- if (!shouldHaveBackingStore()) {
- m_backingStore.clear();
- m_changeMask |= BackingStoreChange;
- } else {
+ if (shouldHaveBackingStore()) {
if (!m_backingStore) {
m_backingStore = TextureMapperTiledBackingStore::create();
m_changeMask |= BackingStoreChange;
}
+ } else {
+ if (m_backingStore) {
+ m_backingStore = nullptr;
+ m_changeMask |= BackingStoreChange;
+ }
}
updateDebugBorderAndRepaintCount();
@@ -473,112 +408,98 @@ void GraphicsLayerTextureMapper::setDebugBorder(const Color& color, float width)
m_changeMask |= DebugVisualsChange;
}
-static void toTextureMapperLayerVector(const Vector<GraphicsLayer*>& layers, Vector<TextureMapperLayer*>& texmapLayers)
-{
- texmapLayers.reserveCapacity(layers.size());
- for (size_t i = 0; i < layers.size(); ++i)
- texmapLayers.append(toTextureMapperLayer(layers[i]));
-}
-
void GraphicsLayerTextureMapper::commitLayerChanges()
{
if (m_changeMask == NoChanges)
return;
- if (m_changeMask & ChildrenChange) {
- Vector<TextureMapperLayer*> textureMapperLayerChildren;
- toTextureMapperLayerVector(children(), textureMapperLayerChildren);
- m_layer->setChildren(textureMapperLayerChildren);
- }
+ if (m_changeMask & ChildrenChange)
+ m_layer.setChildren(children());
if (m_changeMask & MaskLayerChange)
- m_layer->setMaskLayer(toTextureMapperLayer(maskLayer()));
+ m_layer.setMaskLayer(&downcast<GraphicsLayerTextureMapper>(maskLayer())->layer());
if (m_changeMask & ReplicaLayerChange)
- m_layer->setReplicaLayer(toTextureMapperLayer(replicaLayer()));
+ m_layer.setReplicaLayer(&downcast<GraphicsLayerTextureMapper>(replicaLayer())->layer());
if (m_changeMask & PositionChange)
- m_layer->setPosition(position());
+ m_layer.setPosition(position());
if (m_changeMask & AnchorPointChange)
- m_layer->setAnchorPoint(anchorPoint());
+ m_layer.setAnchorPoint(anchorPoint());
if (m_changeMask & SizeChange)
- m_layer->setSize(size());
+ m_layer.setSize(size());
if (m_changeMask & TransformChange)
- m_layer->setTransform(transform());
+ m_layer.setTransform(transform());
if (m_changeMask & ChildrenTransformChange)
- m_layer->setChildrenTransform(childrenTransform());
+ m_layer.setChildrenTransform(childrenTransform());
if (m_changeMask & Preserves3DChange)
- m_layer->setPreserves3D(preserves3D());
+ m_layer.setPreserves3D(preserves3D());
if (m_changeMask & ContentsRectChange)
- m_layer->setContentsRect(contentsRect());
+ m_layer.setContentsRect(contentsRect());
if (m_changeMask & MasksToBoundsChange)
- m_layer->setMasksToBounds(masksToBounds());
+ m_layer.setMasksToBounds(masksToBounds());
if (m_changeMask & DrawsContentChange)
- m_layer->setDrawsContent(drawsContent());
+ m_layer.setDrawsContent(drawsContent());
if (m_changeMask & ContentsVisibleChange)
- m_layer->setContentsVisible(contentsAreVisible());
+ m_layer.setContentsVisible(contentsAreVisible());
if (m_changeMask & ContentsOpaqueChange)
- m_layer->setContentsOpaque(contentsOpaque());
+ m_layer.setContentsOpaque(contentsOpaque());
if (m_changeMask & BackfaceVisibilityChange)
- m_layer->setBackfaceVisibility(backfaceVisibility());
+ m_layer.setBackfaceVisibility(backfaceVisibility());
if (m_changeMask & OpacityChange)
- m_layer->setOpacity(opacity());
+ m_layer.setOpacity(opacity());
if (m_changeMask & BackgroundColorChange)
- m_layer->setSolidColor(solidColor());
+ m_layer.setSolidColor(m_solidColor);
-#if ENABLE(CSS_FILTERS)
if (m_changeMask & FilterChange)
- m_layer->setFilters(filters());
-#endif
+ m_layer.setFilters(filters());
if (m_changeMask & BackingStoreChange)
- m_layer->setBackingStore(m_backingStore);
+ m_layer.setBackingStore(m_backingStore);
if (m_changeMask & DebugVisualsChange)
- m_layer->setDebugVisuals(isShowingDebugBorder(), debugBorderColor(), debugBorderWidth(), isShowingRepaintCounter());
+ m_layer.setDebugVisuals(isShowingDebugBorder(), debugBorderColor(), debugBorderWidth(), isShowingRepaintCounter());
if (m_changeMask & RepaintCountChange)
- m_layer->setRepaintCount(repaintCount());
+ m_layer.setRepaintCount(repaintCount());
if (m_changeMask & ContentChange)
- m_layer->setContentsLayer(platformLayer());
+ m_layer.setContentsLayer(platformLayer());
if (m_changeMask & AnimationChange)
- m_layer->setAnimations(m_animations);
+ m_layer.setAnimations(m_animations);
if (m_changeMask & AnimationStarted)
- client()->notifyAnimationStarted(this, m_animationStartTime);
+ client().notifyAnimationStarted(this, "", m_animationStartTime);
if (m_changeMask & FixedToViewporChange)
- m_layer->setFixedToViewport(fixedToViewport());
+ m_layer.setFixedToViewport(fixedToViewport());
if (m_changeMask & IsScrollableChange)
- m_layer->setIsScrollable(isScrollable());
+ m_layer.setIsScrollable(isScrollable());
if (m_changeMask & CommittedScrollOffsetChange)
- m_layer->didCommitScrollOffset(m_committedScrollOffset);
+ m_layer.didCommitScrollOffset(m_committedScrollOffset);
m_changeMask = NoChanges;
}
-/* \reimp (GraphicsLayer.h)
-*/
void GraphicsLayerTextureMapper::flushCompositingState(const FloatRect& rect)
{
- if (!m_layer->textureMapper())
+ if (!m_layer.textureMapper())
return;
flushCompositingStateForThisLayerOnly();
@@ -587,13 +508,28 @@ void GraphicsLayerTextureMapper::flushCompositingState(const FloatRect& rect)
maskLayer()->flushCompositingState(rect);
if (replicaLayer())
replicaLayer()->flushCompositingState(rect);
- for (size_t i = 0; i < children().size(); ++i)
- children()[i]->flushCompositingState(rect);
+ for (auto* child : children())
+ child->flushCompositingState(rect);
+}
+
+void GraphicsLayerTextureMapper::updateBackingStoreIncludingSubLayers()
+{
+ if (!m_layer.textureMapper())
+ return;
+
+ updateBackingStoreIfNeeded();
+
+ if (maskLayer())
+ downcast<GraphicsLayerTextureMapper>(*maskLayer()).updateBackingStoreIfNeeded();
+ if (replicaLayer())
+ downcast<GraphicsLayerTextureMapper>(*replicaLayer()).updateBackingStoreIfNeeded();
+ for (auto* child : children())
+ downcast<GraphicsLayerTextureMapper>(*child).updateBackingStoreIncludingSubLayers();
}
void GraphicsLayerTextureMapper::updateBackingStoreIfNeeded()
{
- TextureMapper* textureMapper = m_layer->textureMapper();
+ TextureMapper* textureMapper = m_layer.textureMapper();
if (!textureMapper)
return;
@@ -610,8 +546,10 @@ void GraphicsLayerTextureMapper::updateBackingStoreIfNeeded()
return;
TextureMapperTiledBackingStore* backingStore = static_cast<TextureMapperTiledBackingStore*>(m_backingStore.get());
+ backingStore->updateContentsScale(pageScaleFactor() * deviceScaleFactor());
- backingStore->updateContents(textureMapper, this, m_size, dirtyRect, BitmapTexture::UpdateCanModifyOriginalImageData);
+ dirtyRect.scale(pageScaleFactor() * deviceScaleFactor());
+ backingStore->updateContents(*textureMapper, this, m_size, dirtyRect, BitmapTexture::UpdateCanModifyOriginalImageData);
m_needsDisplay = false;
m_needsDisplayRect = IntRect();
@@ -622,21 +560,44 @@ bool GraphicsLayerTextureMapper::shouldHaveBackingStore() const
return drawsContent() && contentsAreVisible() && !m_size.isEmpty();
}
-bool GraphicsLayerTextureMapper::addAnimation(const KeyframeValueList& valueList, const IntSize& boxSize, const Animation* anim, const String& keyframesName, double timeOffset)
+bool GraphicsLayerTextureMapper::filtersCanBeComposited(const FilterOperations& filters) const
+{
+ if (!filters.size())
+ return false;
+
+ for (const auto& filterOperation : filters.operations()) {
+ if (filterOperation->type() == FilterOperation::REFERENCE)
+ return false;
+ }
+
+ return true;
+}
+
+bool GraphicsLayerTextureMapper::addAnimation(const KeyframeValueList& valueList, const FloatSize& boxSize, const Animation* anim, const String& keyframesName, double timeOffset)
{
ASSERT(!keyframesName.isEmpty());
- if (!anim || anim->isEmptyOrZeroDuration() || valueList.size() < 2 || (valueList.property() != AnimatedPropertyWebkitTransform && valueList.property() != AnimatedPropertyOpacity))
+ if (!anim || anim->isEmptyOrZeroDuration() || valueList.size() < 2 || (valueList.property() != AnimatedPropertyTransform && valueList.property() != AnimatedPropertyOpacity))
return false;
+ if (valueList.property() == AnimatedPropertyFilter) {
+ int listIndex = validateFilterOperations(valueList);
+ if (listIndex < 0)
+ return false;
+
+ const auto& filters = static_cast<const FilterAnimationValue&>(valueList.at(listIndex)).value();
+ if (!filtersCanBeComposited(filters))
+ return false;
+ }
+
bool listsMatch = false;
bool hasBigRotation;
- if (valueList.property() == AnimatedPropertyWebkitTransform)
+ if (valueList.property() == AnimatedPropertyTransform)
listsMatch = validateTransformOperations(valueList, hasBigRotation) >= 0;
const double currentTime = monotonicallyIncreasingTime();
- m_animations.add(GraphicsLayerAnimation(keyframesName, valueList, boxSize, anim, currentTime - timeOffset, listsMatch));
+ m_animations.add(TextureMapperAnimation(keyframesName, valueList, boxSize, *anim, listsMatch, currentTime - timeOffset, 0, TextureMapperAnimation::AnimationState::Playing));
// m_animationStartTime is the time of the first real frame of animation, now or delayed by a negative offset.
if (timeOffset > 0)
m_animationStartTime = currentTime;
@@ -647,7 +608,7 @@ bool GraphicsLayerTextureMapper::addAnimation(const KeyframeValueList& valueList
return true;
}
-void GraphicsLayerTextureMapper::setAnimations(const GraphicsLayerAnimations& animations)
+void GraphicsLayerTextureMapper::setAnimations(const TextureMapperAnimations& animations)
{
m_animations = animations;
notifyChange(AnimationChange);
@@ -664,17 +625,26 @@ void GraphicsLayerTextureMapper::removeAnimation(const String& animationName)
m_animations.remove(animationName);
}
-#if ENABLE(CSS_FILTERS)
bool GraphicsLayerTextureMapper::setFilters(const FilterOperations& filters)
{
- TextureMapper* textureMapper = m_layer->textureMapper();
- // TextureMapperImageBuffer does not support CSS filters.
- if (!textureMapper || textureMapper->accelerationMode() == TextureMapper::SoftwareMode)
+ if (!m_layer.textureMapper())
return false;
- notifyChange(FilterChange);
- return GraphicsLayer::setFilters(filters);
+
+ bool canCompositeFilters = filtersCanBeComposited(filters);
+ if (GraphicsLayer::filters() == filters)
+ return canCompositeFilters;
+
+ if (canCompositeFilters) {
+ if (!GraphicsLayer::setFilters(filters))
+ return false;
+ notifyChange(FilterChange);
+ } else if (GraphicsLayer::filters().size()) {
+ clearFilters();
+ notifyChange(FilterChange);
+ }
+
+ return canCompositeFilters;
}
-#endif
void GraphicsLayerTextureMapper::setFixedToViewport(bool fixed)
{