summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
diff options
context:
space:
mode:
authorNicolas Roard <nicolasroard@google.com>2011-12-01 07:43:52 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2011-12-01 07:43:52 -0800
commit931e90d171935ef706b6906c5867a51fc491a83d (patch)
tree4321841ab956b65cfe508bc824e7d0fc6eaaff15 /Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
parent6dd76bd83b84be93653706342d235c4377b40e62 (diff)
parentf1a221194f2b0d5fd82d2e98ced94f0553c45986 (diff)
downloadexternal_webkit-931e90d171935ef706b6906c5867a51fc491a83d.zip
external_webkit-931e90d171935ef706b6906c5867a51fc491a83d.tar.gz
external_webkit-931e90d171935ef706b6906c5867a51fc491a83d.tar.bz2
am f1a22119: Merge "Fix image layer codepath" into ics-mr1
* commit 'f1a221194f2b0d5fd82d2e98ced94f0553c45986': Fix image layer codepath
Diffstat (limited to 'Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp')
-rw-r--r--Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp28
1 files changed, 20 insertions, 8 deletions
diff --git a/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp b/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
index 44c9a2d..de9fcae 100644
--- a/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
@@ -119,8 +119,8 @@ GraphicsLayerAndroid::GraphicsLayerAndroid(GraphicsLayerClient* client) :
m_needsRepaint(false),
m_needsNotifyClient(false),
m_haveContents(false),
- m_haveImage(false),
m_newImage(false),
+ m_image(0),
m_foregroundLayer(0),
m_foregroundClipLayer(0)
{
@@ -132,6 +132,9 @@ GraphicsLayerAndroid::GraphicsLayerAndroid(GraphicsLayerClient* client) :
GraphicsLayerAndroid::~GraphicsLayerAndroid()
{
+ if (m_image)
+ m_image->deref();
+
m_contentLayer->unref();
SkSafeUnref(m_foregroundLayer);
SkSafeUnref(m_foregroundClipLayer);
@@ -557,7 +560,7 @@ bool GraphicsLayerAndroid::repaint()
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) {
+ if (!gPaused && m_haveContents && m_needsRepaint && !m_image) {
// with SkPicture, we request the entire layer's content.
IntRect layerBounds(0, 0, m_size.width(), m_size.height());
@@ -639,7 +642,7 @@ bool GraphicsLayerAndroid::repaint()
return true;
}
- if (m_needsRepaint && m_haveImage && m_newImage) {
+ if (m_needsRepaint && m_image && m_newImage) {
// We need to tell the GL thread that we will need to repaint the
// texture. Only do so if we effectively have a new image!
m_contentLayer->markAsDirty(m_dirtyRegion);
@@ -672,7 +675,7 @@ void GraphicsLayerAndroid::setNeedsDisplayInRect(const FloatRect& rect)
{
// rect is in the render object coordinates
- if (!m_haveImage && !drawsContent()) {
+ if (!m_image && !drawsContent()) {
LOG("(%x) setNeedsDisplay(%.2f,%.2f,%.2f,%.2f) doesn't have content, bypass...",
this, rect.x(), rect.y(), rect.width(), rect.height());
return;
@@ -836,14 +839,23 @@ void GraphicsLayerAndroid::resumeAnimations()
void GraphicsLayerAndroid::setContentsToImage(Image* image)
{
TLOG("(%x) setContentsToImage", this, image);
- if (image) {
+ if (image && image != m_image) {
+ image->ref();
+ if (m_image)
+ m_image->deref();
+ m_image = image;
+
+ SkBitmapRef* bitmap = image->nativeImageForCurrentFrame();
+ m_contentLayer->setContentsImage(bitmap);
+
m_haveContents = true;
- m_haveImage = true;
m_newImage = true;
- m_contentLayer->setContentsImage(image->nativeImageForCurrentFrame());
}
- if (m_haveImage && !image)
+ if (!image && m_image) {
m_contentLayer->setContentsImage(0);
+ m_image->deref();
+ m_image = 0;
+ }
setNeedsDisplay();
askForSync();