summaryrefslogtreecommitdiffstats
path: root/WebCore/platform
diff options
context:
space:
mode:
authorGrace Kloba <klobag@google.com>2010-06-29 16:31:27 -0700
committerGrace Kloba <klobag@google.com>2010-06-30 13:39:10 -0700
commite27ce86d74110353e4b3ab3726fea15ff0c67cc5 (patch)
tree9fef03cf3b3994df057a65f15ee68db0c118b669 /WebCore/platform
parent5bde0f53b35681f9195cca182adfbcba8edc47f6 (diff)
downloadexternal_webkit-e27ce86d74110353e4b3ab3726fea15ff0c67cc5.zip
external_webkit-e27ce86d74110353e4b3ab3726fea15ff0c67cc5.tar.gz
external_webkit-e27ce86d74110353e4b3ab3726fea15ff0c67cc5.tar.bz2
Remove the double traversal in GraphicsLayerAndroid,
so we should draw much less now. As we use Picture instead of PictureSet, ignore the m_invalidatedRects for now. This should also reduce the number of draws when m_invalidatedRects has more than one rect.
Diffstat (limited to 'WebCore/platform')
-rw-r--r--WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp71
-rw-r--r--WebCore/platform/graphics/android/GraphicsLayerAndroid.h4
2 files changed, 23 insertions, 52 deletions
diff --git a/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp b/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
index c3df943..8403a03 100644
--- a/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
+++ b/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
@@ -398,29 +398,6 @@ void GraphicsLayerAndroid::setOpacity(float opacity)
askForSync();
}
-bool GraphicsLayerAndroid::repaintAll()
-{
- LOG("(%x) repaintAll", this);
- bool ret = false;
- for (unsigned int i = 0; i < m_children.size(); i++) {
- GraphicsLayerAndroid* layer = static_cast<GraphicsLayerAndroid*>(m_children[i]);
- if (layer && layer->repaintAll())
- ret = true;
- }
- int nbRects = m_invalidatedRects.size();
-
- for (int i = 0; !gPaused && i < nbRects; i++) {
- FloatRect rect = m_invalidatedRects[i];
- if (repaint(rect))
- ret = true;
- }
- if (!gPaused) {
- m_needsRepaint = false;
- m_invalidatedRects.clear();
- }
- return ret;
-}
-
void GraphicsLayerAndroid::setNeedsDisplay()
{
LOG("(%x) setNeedsDisplay()", this);
@@ -455,11 +432,10 @@ void GraphicsLayerAndroid::sendImmediateRepaint()
}
}
-bool GraphicsLayerAndroid::repaint(const FloatRect& rect)
+bool GraphicsLayerAndroid::repaint()
{
- LOG("(%x) repaint(%.2f,%.2f,%.2f,%.2f), gPaused(%d) m_needsRepaint(%d) m_haveContents(%d) ",
- this, rect.x(), rect.y(), rect.width(), rect.height(),
- gPaused, m_needsRepaint, m_haveContents);
+ LOG("(%x) repaint(), gPaused(%d) m_needsRepaint(%d) m_haveContents(%d) ",
+ this, gPaused, m_needsRepaint, m_haveContents);
if (!gPaused && m_haveContents && m_needsRepaint && !m_haveImage) {
SkAutoPictureRecord arp(m_contentLayer->recordContext(), m_size.width(), m_size.height());
@@ -468,28 +444,23 @@ bool GraphicsLayerAndroid::repaint(const FloatRect& rect)
if (!recordingCanvas)
return false;
- if ((rect.width() > 0.5) && (rect.height() > 0.5)) {
- IntRect r((int)rect.x(), (int)rect.y(),
- (int)rect.width(), (int)rect.height());
-
- PlatformGraphicsContext pgc(recordingCanvas, 0);
- GraphicsContext gc(&pgc);
-
- // with SkPicture, we request the entire layer's content.
- r.setX(0);
- r.setY(0);
- r.setWidth(m_contentLayer->getWidth());
- r.setHeight(m_contentLayer->getHeight());
- paintGraphicsLayerContents(gc, r);
-
- TLOG("(%x) repaint(%.2f,%.2f,%.2f,%.2f) on (%.2f,%.2f) contentlayer(%.2f,%.2f,%.2f,%.2f)paintGraphicsLayer called!",
- this, rect.x(), rect.y(), rect.width(),
- rect.height(), m_size.width(), m_size.height(),
- m_contentLayer->getPosition().fX,
- m_contentLayer->getPosition().fY,
- m_contentLayer->getSize().width(),
- m_contentLayer->getSize().height());
- }
+ PlatformGraphicsContext pgc(recordingCanvas, 0);
+ GraphicsContext gc(&pgc);
+
+ // with SkPicture, we request the entire layer's content.
+ IntRect r(0, 0, m_contentLayer->getWidth(), m_contentLayer->getHeight());
+ paintGraphicsLayerContents(gc, r);
+
+ TLOG("(%x) repaint() on (%.2f,%.2f) contentlayer(%.2f,%.2f,%.2f,%.2f)paintGraphicsLayer called!",
+ this, m_size.width(), m_size.height(),
+ m_contentLayer->getPosition().fX,
+ m_contentLayer->getPosition().fY,
+ m_contentLayer->getSize().width(),
+ m_contentLayer->getSize().height());
+
+ m_needsRepaint = false;
+ m_invalidatedRects.clear();
+
return true;
}
return false;
@@ -911,7 +882,7 @@ void GraphicsLayerAndroid::syncCompositingState()
syncPositionState();
if (!gPaused || WTF::currentTime() >= gPausedDelay)
- repaintAll();
+ repaint();
}
void GraphicsLayerAndroid::notifyClientAnimationStarted()
diff --git a/WebCore/platform/graphics/android/GraphicsLayerAndroid.h b/WebCore/platform/graphics/android/GraphicsLayerAndroid.h
index 25f70b4..b72877b 100644
--- a/WebCore/platform/graphics/android/GraphicsLayerAndroid.h
+++ b/WebCore/platform/graphics/android/GraphicsLayerAndroid.h
@@ -97,7 +97,6 @@ public:
virtual void resumeAnimations();
virtual void setContentsToImage(Image*);
- bool repaintAll();
virtual PlatformLayer* platformLayer() const;
void pauseDisplay(bool state);
@@ -127,7 +126,8 @@ private:
void updateFixedPosition();
- bool repaint(const FloatRect& rect);
+ // with SkPicture, we always repaint the entire layer's content.
+ bool repaint();
void needsNotifyClient();
bool m_needsSyncChildren;