summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@digia.com>2014-06-04 13:35:27 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-06-04 18:43:38 +0200
commit29dd87ecc570ebc51890e0587e73e7a144d892aa (patch)
tree8c59a0e1154c646f2500eaa5b0b33017e5647ac2
parent2748cfb515a8668695d4962eaa3d7ce76504c97c (diff)
downloadqtwebkit-29dd87ecc570ebc51890e0587e73e7a144d892aa.tar.gz
Ensure replaced tiles are repainted
If a layer with a backing store is resized, we may replace some tiles that were not at maximum size. When that happens we need to ensure the replaced area is repainted, otherwise the content disappears until refreshed. Change-Id: Ie2f7796a2493a56ed5fc6cc4cea55f4ab9f38bbe Reviewed-by: Michael Bruning <michael.bruning@digia.com>
-rw-r--r--Source/WebCore/platform/graphics/texmap/TextureMapperTiledBackingStore.cpp19
-rw-r--r--Source/WebCore/platform/graphics/texmap/TextureMapperTiledBackingStore.h2
2 files changed, 13 insertions, 8 deletions
diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperTiledBackingStore.cpp b/Source/WebCore/platform/graphics/texmap/TextureMapperTiledBackingStore.cpp
index ef564023d..801a2d46f 100644
--- a/Source/WebCore/platform/graphics/texmap/TextureMapperTiledBackingStore.cpp
+++ b/Source/WebCore/platform/graphics/texmap/TextureMapperTiledBackingStore.cpp
@@ -69,11 +69,10 @@ void TextureMapperTiledBackingStore::drawRepaintCounter(TextureMapper* textureMa
textureMapper->drawNumber(repaintCount, borderColor, m_tiles[i].rect().location(), adjustedTransform);
}
-void TextureMapperTiledBackingStore::createOrDestroyTilesIfNeeded(const FloatSize& size, const IntSize& tileSize, bool hasAlpha)
+void TextureMapperTiledBackingStore::createOrDestroyTilesIfNeeded(const FloatSize& size, const IntSize& tileSize, bool hasAlpha, IntRect& repaintRect)
{
if (size == m_size)
return;
-
m_size = size;
Vector<FloatRect> tileRectsToAdd;
@@ -107,8 +106,12 @@ void TextureMapperTiledBackingStore::createOrDestroyTilesIfNeeded(const FloatSiz
}
// This tile is not needed.
- if (!existsAlready)
+ if (!existsAlready) {
tileIndicesToRemove.append(i);
+ // If the removed tile was painted ensure the area it covered is repainted.
+ if (m_tiles[i].texture())
+ repaintRect.unite(enclosingIntRect(oldTile));
+ }
}
// Recycle removable tiles to be used for newly requested tiles.
@@ -135,16 +138,18 @@ void TextureMapperTiledBackingStore::createOrDestroyTilesIfNeeded(const FloatSiz
void TextureMapperTiledBackingStore::updateContents(TextureMapper* textureMapper, Image* image, const FloatSize& totalSize, const IntRect& dirtyRect, BitmapTexture::UpdateContentsFlag updateContentsFlag)
{
- createOrDestroyTilesIfNeeded(totalSize, textureMapper->maxTextureSize(), !image->currentFrameKnownToBeOpaque());
+ IntRect repaintRect(dirtyRect);
+ createOrDestroyTilesIfNeeded(totalSize, textureMapper->maxTextureSize(), !image->currentFrameKnownToBeOpaque(), repaintRect);
for (size_t i = 0; i < m_tiles.size(); ++i)
- m_tiles[i].updateContents(textureMapper, image, dirtyRect, updateContentsFlag);
+ m_tiles[i].updateContents(textureMapper, image, repaintRect, updateContentsFlag);
}
void TextureMapperTiledBackingStore::updateContents(TextureMapper* textureMapper, GraphicsLayer* sourceLayer, const FloatSize& totalSize, const IntRect& dirtyRect, BitmapTexture::UpdateContentsFlag updateContentsFlag)
{
- createOrDestroyTilesIfNeeded(totalSize, textureMapper->maxTextureSize(), true);
+ IntRect repaintRect(dirtyRect);
+ createOrDestroyTilesIfNeeded(totalSize, textureMapper->maxTextureSize(), true, repaintRect);
for (size_t i = 0; i < m_tiles.size(); ++i)
- m_tiles[i].updateContents(textureMapper, sourceLayer, dirtyRect, updateContentsFlag);
+ m_tiles[i].updateContents(textureMapper, sourceLayer, repaintRect, updateContentsFlag);
}
PassRefPtr<BitmapTexture> TextureMapperTiledBackingStore::texture() const
diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperTiledBackingStore.h b/Source/WebCore/platform/graphics/texmap/TextureMapperTiledBackingStore.h
index 9b8568463..6a44b68ae 100644
--- a/Source/WebCore/platform/graphics/texmap/TextureMapperTiledBackingStore.h
+++ b/Source/WebCore/platform/graphics/texmap/TextureMapperTiledBackingStore.h
@@ -48,7 +48,7 @@ public:
private:
TextureMapperTiledBackingStore();
- void createOrDestroyTilesIfNeeded(const FloatSize& backingStoreSize, const IntSize& tileSize, bool hasAlpha);
+ void createOrDestroyTilesIfNeeded(const FloatSize& backingStoreSize, const IntSize& tileSize, bool hasAlpha, IntRect&);
void updateContentsFromImageIfNeeded(TextureMapper*);
TransformationMatrix adjustedTransformForRect(const FloatRect&);
inline FloatRect rect() const { return FloatRect(FloatPoint::zero(), m_size); }