summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2014-08-20 10:08:39 -0700
committerJohn Reck <jreck@google.com>2014-08-20 15:54:07 -0700
commit3e8249568cc428296ac76c7ddce3f0382d40fe5b (patch)
tree24dee065901ece0b80bac18a03665607031ab012 /libs
parent730e9bceb746e6c50b87cc5a695eb73fea27686e (diff)
downloadframeworks_base-3e8249568cc428296ac76c7ddce3f0382d40fe5b.zip
frameworks_base-3e8249568cc428296ac76c7ddce3f0382d40fe5b.tar.gz
frameworks_base-3e8249568cc428296ac76c7ddce3f0382d40fe5b.tar.bz2
Implement full View.buildLayer
Bug: 17152292 Change-Id: Ia3cc2aadf72fe14517f50762fc634794df51ad5a
Diffstat (limited to 'libs')
-rw-r--r--libs/hwui/renderthread/CanvasContext.cpp23
-rw-r--r--libs/hwui/renderthread/CanvasContext.h1
-rw-r--r--libs/hwui/renderthread/RenderProxy.cpp12
-rw-r--r--libs/hwui/renderthread/RenderProxy.h1
4 files changed, 37 insertions, 0 deletions
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index e673b0d..5922135 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -244,6 +244,29 @@ void CanvasContext::invokeFunctor(RenderThread& thread, Functor* functor) {
thread.renderState().invokeFunctor(functor, mode, NULL);
}
+void CanvasContext::buildLayer(RenderNode* node) {
+ ATRACE_CALL();
+ if (!mEglManager.hasEglContext() || !mCanvas) {
+ return;
+ }
+ requireGlContext();
+ // buildLayer() will leave the tree in an unknown state, so we must stop drawing
+ stopDrawing();
+
+ TreeInfo info(TreeInfo::MODE_FULL, mRenderThread.renderState());
+ info.frameTimeMs = mRenderThread.timeLord().frameTimeMs();
+ info.damageAccumulator = &mDamageAccumulator;
+ info.renderer = mCanvas;
+ node->prepareTree(info);
+ SkRect ignore;
+ mDamageAccumulator.finish(&ignore);
+ // Tickle the GENERIC property on node to mark it as dirty for damaging
+ // purposes when the frame is actually drawn
+ node->setPropertyFieldsDirty(RenderNode::GENERIC);
+
+ mCanvas->flushLayerUpdates();
+}
+
bool CanvasContext::copyLayerInto(DeferredLayerUpdater* layer, SkBitmap* bitmap) {
requireGlContext();
layer->apply();
diff --git a/libs/hwui/renderthread/CanvasContext.h b/libs/hwui/renderthread/CanvasContext.h
index 2a01027..0cbed6f 100644
--- a/libs/hwui/renderthread/CanvasContext.h
+++ b/libs/hwui/renderthread/CanvasContext.h
@@ -65,6 +65,7 @@ public:
// IFrameCallback, Chroreographer-driven frame callback entry point
virtual void doFrame();
+ void buildLayer(RenderNode* node);
bool copyLayerInto(DeferredLayerUpdater* layer, SkBitmap* bitmap);
void destroyHardwareResources();
diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp
index d9b96f6..405ce24 100644
--- a/libs/hwui/renderthread/RenderProxy.cpp
+++ b/libs/hwui/renderthread/RenderProxy.cpp
@@ -284,6 +284,18 @@ DeferredLayerUpdater* RenderProxy::createTextureLayer() {
return layer;
}
+CREATE_BRIDGE2(buildLayer, CanvasContext* context, RenderNode* node) {
+ args->context->buildLayer(args->node);
+ return NULL;
+}
+
+void RenderProxy::buildLayer(RenderNode* node) {
+ SETUP_TASK(buildLayer);
+ args->context = mContext;
+ args->node = node;
+ postAndWait(task);
+}
+
CREATE_BRIDGE3(copyLayerInto, CanvasContext* context, DeferredLayerUpdater* layer,
SkBitmap* bitmap) {
bool success = args->context->copyLayerInto(args->layer, args->bitmap);
diff --git a/libs/hwui/renderthread/RenderProxy.h b/libs/hwui/renderthread/RenderProxy.h
index 28d0173..eea3674 100644
--- a/libs/hwui/renderthread/RenderProxy.h
+++ b/libs/hwui/renderthread/RenderProxy.h
@@ -81,6 +81,7 @@ public:
static void enqueueDestroyLayer(Layer* layer);
ANDROID_API DeferredLayerUpdater* createDisplayListLayer(int width, int height);
ANDROID_API DeferredLayerUpdater* createTextureLayer();
+ ANDROID_API void buildLayer(RenderNode* node);
ANDROID_API bool copyLayerInto(DeferredLayerUpdater* layer, SkBitmap* bitmap);
ANDROID_API void pushLayerUpdate(DeferredLayerUpdater* layer);
ANDROID_API void cancelLayerUpdate(DeferredLayerUpdater* layer);