summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/android/BaseLayerAndroid.cpp
diff options
context:
space:
mode:
authorNicolas Roard <nicolasroard@google.com>2012-03-09 15:48:14 -0800
committerNicolas Roard <nicolasroard@google.com>2012-03-09 17:25:29 -0800
commitb3f4d3af0b06dc168453641e249d0cb9eec9b570 (patch)
tree860279e3446097a24a3b606ff491300134685afe /Source/WebCore/platform/graphics/android/BaseLayerAndroid.cpp
parent296d05c7bd54360261dedc8d387a7bf9f52ca41b (diff)
downloadexternal_webkit-b3f4d3af0b06dc168453641e249d0cb9eec9b570.zip
external_webkit-b3f4d3af0b06dc168453641e249d0cb9eec9b570.tar.gz
external_webkit-b3f4d3af0b06dc168453641e249d0cb9eec9b570.tar.bz2
Introduce a LayerContent interface
Layers can now use a LayerContent object to draw their content. We currently have two subclasses, one using an SkPicture (currently used for composited layers), the other using a PictureSet (that we use for the base layer). First step toward unification... Change-Id: I5e7fd06a653f02f8721613fd3a39d36fb64a8614
Diffstat (limited to 'Source/WebCore/platform/graphics/android/BaseLayerAndroid.cpp')
-rw-r--r--Source/WebCore/platform/graphics/android/BaseLayerAndroid.cpp23
1 files changed, 8 insertions, 15 deletions
diff --git a/Source/WebCore/platform/graphics/android/BaseLayerAndroid.cpp b/Source/WebCore/platform/graphics/android/BaseLayerAndroid.cpp
index ded25a7..c9a8b9a 100644
--- a/Source/WebCore/platform/graphics/android/BaseLayerAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/BaseLayerAndroid.cpp
@@ -68,6 +68,7 @@ using namespace android;
BaseLayerAndroid::BaseLayerAndroid()
#if USE(ACCELERATED_COMPOSITING)
: m_color(Color::white)
+ , m_content(0)
, m_scrollState(NotScrolling)
#endif
{
@@ -78,23 +79,17 @@ BaseLayerAndroid::BaseLayerAndroid()
BaseLayerAndroid::~BaseLayerAndroid()
{
- m_content.clear();
+ SkSafeUnref(m_content);
#ifdef DEBUG_COUNT
ClassTracker::instance()->decrement("BaseLayerAndroid");
#endif
}
-void BaseLayerAndroid::setContent(const PictureSet& src)
+void BaseLayerAndroid::setContent(LayerContent* content)
{
-#if USE(ACCELERATED_COMPOSITING)
- // FIXME: We lock here because we do not want
- // to paint and change the m_content concurrently.
- // We should instead refactor PictureSet to use
- // an atomic refcounting scheme and use atomic operations
- // to swap PictureSets.
- android::Mutex::Autolock lock(m_drawLock);
-#endif
- m_content.set(src);
+ SkSafeRef(content);
+ SkSafeUnref(m_content);
+ m_content = content;
// FIXME: We cannot set the size of the base layer because it will screw up
// the matrix used. We need to fix matrix computation for the base layer
// and then we can set the size.
@@ -103,11 +98,9 @@ void BaseLayerAndroid::setContent(const PictureSet& src)
bool BaseLayerAndroid::drawCanvas(SkCanvas* canvas)
{
-#if USE(ACCELERATED_COMPOSITING)
android::Mutex::Autolock lock(m_drawLock);
-#endif
- if (!m_content.isEmpty())
- m_content.draw(canvas);
+ if (m_content && !m_content->isEmpty())
+ m_content->draw(canvas);
return true;
}