summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp')
-rw-r--r--Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp45
1 files changed, 18 insertions, 27 deletions
diff --git a/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp b/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
index 779dba5..25441f4 100644
--- a/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
@@ -41,6 +41,7 @@
#include "Length.h"
#include "MediaLayer.h"
#include "PictureLayerContent.h"
+#include "PicturePileLayerContent.h"
#include "PlatformBridge.h"
#include "PlatformGraphicsContextSkia.h"
#include "RenderLayerBacking.h"
@@ -828,22 +829,9 @@ bool GraphicsLayerAndroid::repaint()
return false;
}
-SkPicture* GraphicsLayerAndroid::paintPicture(const IntRect& rect)
+void GraphicsLayerAndroid::paintContents(GraphicsContext* gc, IntRect& dirty)
{
- SkPicture* picture = new SkPicture();
- SkCanvas* canvas = picture->beginRecording(rect.width(), rect.height(), 0);
- if (!canvas) {
- picture->endRecording();
- SkSafeUnref(picture);
- return 0;
- }
-
- PlatformGraphicsContextSkia platformContext(canvas);
- GraphicsContext graphicsContext(&platformContext);
-
- paintGraphicsLayerContents(graphicsContext, rect);
-
- return picture;
+ paintGraphicsLayerContents(*gc, dirty);
}
bool GraphicsLayerAndroid::paintContext(LayerAndroid* layer,
@@ -853,19 +841,22 @@ bool GraphicsLayerAndroid::paintContext(LayerAndroid* layer,
if (!layer)
return false;
- SkPicture* picture = paintPicture(rect);
- if (!picture)
- return false;
- picture->endRecording();
+ TRACE_METHOD();
+
+ // TODO: we might be able to reuse an existing picture instead of recreating it.
+ // we can't do that because of transparency -- for now, we just create
+ // a new picture every time.
+ WebCore::PicturePile picture;
+ picture.setSize(IntSize(m_size.width(), m_size.height()));
+
+ // TODO: add content checks (text, opacity, etc.)
+ picture.updatePicturesIfNeeded(this);
+
+ // store the newly painted content in the layer if it's not empty
+ PicturePileLayerContent* content = new PicturePileLayerContent(picture);
+ layer->setContent(content->isEmpty() ? 0 : content);
+ SkSafeUnref(content);
- PictureLayerContent* layerContent = new PictureLayerContent(picture);
- if (checkOptimisations)
- layerContent->checkForOptimisations();
- else
- layerContent->setCheckForOptimisations(false);
- layer->setContent(layerContent);
- SkSafeUnref(layerContent);
- SkSafeUnref(picture);
return true;
}