diff options
author | Nicolas Roard <nicolas@android.com> | 2011-02-15 17:48:19 -0800 |
---|---|---|
committer | Nicolas Roard <nicolas@android.com> | 2011-02-15 17:48:19 -0800 |
commit | f18fc03d63334e364d1a1b8e07dafb3fb0650c92 (patch) | |
tree | a96e3d634e643578b109487028ca034e55d137a0 /WebCore/platform/graphics/android/LayerAndroid.cpp | |
parent | e5c90f700f64667817813fbb2e8478ddb7a6927b (diff) | |
download | external_webkit-f18fc03d63334e364d1a1b8e07dafb3fb0650c92.zip external_webkit-f18fc03d63334e364d1a1b8e07dafb3fb0650c92.tar.gz external_webkit-f18fc03d63334e364d1a1b8e07dafb3fb0650c92.tar.bz2 |
Improve layers repaint speed.
Computing the layers texture size is heavy; we delay this
computation if one was done recently.
bug:3375416
Change-Id: I0ce79cdfcaa15cd1521370a1d5b8df5a5e5ea2c5
Diffstat (limited to 'WebCore/platform/graphics/android/LayerAndroid.cpp')
-rw-r--r-- | WebCore/platform/graphics/android/LayerAndroid.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/WebCore/platform/graphics/android/LayerAndroid.cpp b/WebCore/platform/graphics/android/LayerAndroid.cpp index bee423c..7375cba 100644 --- a/WebCore/platform/graphics/android/LayerAndroid.cpp +++ b/WebCore/platform/graphics/android/LayerAndroid.cpp @@ -75,7 +75,8 @@ LayerAndroid::LayerAndroid(bool isRootLayer) : SkLayer(), m_reservedTexture(0), m_pictureUsed(0), m_requestSent(false), - m_scale(1) + m_scale(1), + m_lastComputeTextureSize(0) { m_backgroundColor = 0; @@ -123,6 +124,7 @@ LayerAndroid::LayerAndroid(const LayerAndroid& layer) : SkLayer(layer), m_dirty = layer.m_dirty; m_pictureUsed = layer.m_pictureUsed; m_scale = layer.m_scale; + m_lastComputeTextureSize = 0; for (int i = 0; i < layer.countChildren(); i++) addChild(layer.getChild(i)->copy())->unref(); @@ -147,7 +149,8 @@ LayerAndroid::LayerAndroid(SkPicture* picture) : SkLayer(), m_drawingTexture(0), m_reservedTexture(0), m_requestSent(false), - m_scale(1) + m_scale(1), + m_lastComputeTextureSize(0) { m_backgroundColor = 0; m_dirty = false; @@ -651,8 +654,12 @@ static inline bool compareLayerFullSize(const LayerAndroid* a, const LayerAndroi return sizeA > sizeB; } -void LayerAndroid::computeTextureSize() +void LayerAndroid::computeTextureSize(double time) { + if (m_lastComputeTextureSize + s_computeTextureDelay > time) + return; + m_lastComputeTextureSize = time; + // First, we collect the layers, computing m_layerTextureRect // as being clipped against the viewport Vector <LayerAndroid*> layers; |