Skip to content
Permalink
Browse files
[TexMap] Don't bother caching pattern transform matrix
https://bugs.webkit.org/show_bug.cgi?id=183633

Reviewed by Michael Catanzaro.

Remove the m_patternTransform and m_patternTransformDirty member
variables from the TextureMapperLayer class. These unnecessarily
complicate the state update methods that need to compare the given
attribute against the current state, and only update it if it has
changed.

Instead, compute the pattern TransformationMatrix value on-the-fly in
the paintSelf() method, if at all necessary.

No change in functionality.

* platform/graphics/texmap/TextureMapperLayer.cpp:
(WebCore::TextureMapperLayer::paintSelf):
(WebCore::TextureMapperLayer::setContentsRect):
(WebCore::TextureMapperLayer::setContentsTileSize):
(WebCore::TextureMapperLayer::setContentsTilePhase):
(WebCore::TextureMapperLayer::computePatternTransformIfNeeded): Deleted.
* platform/graphics/texmap/TextureMapperLayer.h:


Canonical link: https://commits.webkit.org/199301@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229621 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
zdobersek committed Mar 15, 2018
1 parent 22d563a commit beb6f5cefcfdce7284238a3684a936385e9fa920
Showing with 30 additions and 26 deletions.
  1. +26 −0 Source/WebCore/ChangeLog
  2. +4 −22 Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp
  3. +0 −4 Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h
@@ -1,3 +1,29 @@
2018-03-15 Zan Dobersek <zdobersek@igalia.com>

[TexMap] Don't bother caching pattern transform matrix
https://bugs.webkit.org/show_bug.cgi?id=183633

Reviewed by Michael Catanzaro.

Remove the m_patternTransform and m_patternTransformDirty member
variables from the TextureMapperLayer class. These unnecessarily
complicate the state update methods that need to compare the given
attribute against the current state, and only update it if it has
changed.

Instead, compute the pattern TransformationMatrix value on-the-fly in
the paintSelf() method, if at all necessary.

No change in functionality.

* platform/graphics/texmap/TextureMapperLayer.cpp:
(WebCore::TextureMapperLayer::paintSelf):
(WebCore::TextureMapperLayer::setContentsRect):
(WebCore::TextureMapperLayer::setContentsTileSize):
(WebCore::TextureMapperLayer::setContentsTilePhase):
(WebCore::TextureMapperLayer::computePatternTransformIfNeeded): Deleted.
* platform/graphics/texmap/TextureMapperLayer.h:

2018-03-14 John Wilander <wilander@apple.com>

Resource Load Statistics: Add clearing of storage access to WebResourceLoadStatisticsStore::clearInMemory()
@@ -91,17 +91,6 @@ static Color blendWithOpacity(const Color& color, float opacity)
return color.colorWithAlphaMultipliedBy(opacity);
}

void TextureMapperLayer::computePatternTransformIfNeeded()
{
if (!m_patternTransformDirty)
return;

m_patternTransformDirty = false;
m_patternTransform =
TransformationMatrix::rectToRect(FloatRect(FloatPoint::zero(), m_state.contentsTileSize), FloatRect(FloatPoint::zero(), m_state.contentsRect.size()))
.multiply(TransformationMatrix().translate(m_state.contentsTilePhase.width() / m_state.contentsRect.width(), m_state.contentsTilePhase.height() / m_state.contentsRect.height()));
}

void TextureMapperLayer::paintSelf(const TextureMapperPaintOptions& options)
{
if (!m_state.visible || !m_state.contentsVisible)
@@ -138,9 +127,11 @@ void TextureMapperLayer::paintSelf(const TextureMapperPaintOptions& options)
return;

if (!m_state.contentsTileSize.isEmpty()) {
computePatternTransformIfNeeded();
options.textureMapper.setWrapMode(TextureMapper::RepeatWrap);
options.textureMapper.setPatternTransform(m_patternTransform);

auto patternTransform = TransformationMatrix::rectToRect({ { }, m_state.contentsTileSize }, { { }, m_state.contentsRect.size() })
.translate(m_state.contentsTilePhase.width() / m_state.contentsRect.width(), m_state.contentsTilePhase.height() / m_state.contentsRect.height());
options.textureMapper.setPatternTransform(patternTransform);
}

ASSERT(!layerRect().isEmpty());
@@ -555,26 +546,17 @@ void TextureMapperLayer::setChildrenTransform(const TransformationMatrix& childr

void TextureMapperLayer::setContentsRect(const FloatRect& contentsRect)
{
if (contentsRect == m_state.contentsRect)
return;
m_state.contentsRect = contentsRect;
m_patternTransformDirty = true;
}

void TextureMapperLayer::setContentsTileSize(const FloatSize& size)
{
if (size == m_state.contentsTileSize)
return;
m_state.contentsTileSize = size;
m_patternTransformDirty = true;
}

void TextureMapperLayer::setContentsTilePhase(const FloatSize& phase)
{
if (phase == m_state.contentsTilePhase)
return;
m_state.contentsTilePhase = phase;
m_patternTransformDirty = true;
}

void TextureMapperLayer::setMasksToBounds(bool masksToBounds)
@@ -47,7 +47,6 @@ class WEBCORE_EXPORT TextureMapperLayer : public TextureMapperAnimation::Client
, m_textureMapper(0)
, m_fixedToViewport(false)
, m_id(0)
, m_patternTransformDirty(false)
{ }

virtual ~TextureMapperLayer();
@@ -147,7 +146,6 @@ class WEBCORE_EXPORT TextureMapperLayer : public TextureMapperAnimation::Client
void paintSelfAndChildren(const TextureMapperPaintOptions&);
void paintSelfAndChildrenWithReplica(const TextureMapperPaintOptions&);
void applyMask(const TextureMapperPaintOptions&);
void computePatternTransformIfNeeded();

// TextureMapperAnimation::Client
void setAnimatedTransform(const TransformationMatrix&) override;
@@ -226,8 +224,6 @@ class WEBCORE_EXPORT TextureMapperLayer : public TextureMapperAnimation::Client
FloatSize m_scrollPositionDelta;
bool m_fixedToViewport;
uint32_t m_id;
TransformationMatrix m_patternTransform;
bool m_patternTransformDirty;
};

}

0 comments on commit beb6f5c

Please sign in to comment.