summaryrefslogtreecommitdiff
path: root/libs/hwui/renderthread/DrawFrameTask.cpp
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2014-04-15 09:50:16 -0700
committerJohn Reck <jreck@google.com>2014-04-29 10:42:11 -0700
commite45b1fd03b524d2b57cc6c222d89076a31a08bea (patch)
tree31ad10387f2b59b3ee9d4396be44fce67228ca75 /libs/hwui/renderthread/DrawFrameTask.cpp
parent627aad9c200cb19aa505504dcd232a3710e96a25 (diff)
RenderThread animator support
Change-Id: Icf29098edfdaf7ed550bbe9d49e9eaefb4167084
Diffstat (limited to 'libs/hwui/renderthread/DrawFrameTask.cpp')
-rw-r--r--libs/hwui/renderthread/DrawFrameTask.cpp36
1 files changed, 11 insertions, 25 deletions
diff --git a/libs/hwui/renderthread/DrawFrameTask.cpp b/libs/hwui/renderthread/DrawFrameTask.cpp
index f542d4396cfe..ff4be715808c 100644
--- a/libs/hwui/renderthread/DrawFrameTask.cpp
+++ b/libs/hwui/renderthread/DrawFrameTask.cpp
@@ -30,7 +30,7 @@ namespace android {
namespace uirenderer {
namespace renderthread {
-DrawFrameTask::DrawFrameTask() : mContext(0), mRenderNode(0) {
+DrawFrameTask::DrawFrameTask() : mContext(0) {
}
DrawFrameTask::~DrawFrameTask() {
@@ -55,25 +55,17 @@ void DrawFrameTask::removeLayer(DeferredLayerUpdater* layer) {
}
}
-void DrawFrameTask::setRenderNode(RenderNode* renderNode) {
- LOG_ALWAYS_FATAL_IF(!mContext, "Lifecycle violation, there's no context to setRenderNode with!");
-
- mRenderNode = renderNode;
-}
-
void DrawFrameTask::setDirty(int left, int top, int right, int bottom) {
mDirty.set(left, top, right, bottom);
}
void DrawFrameTask::drawFrame(RenderThread* renderThread) {
- LOG_ALWAYS_FATAL_IF(!mRenderNode.get(), "Cannot drawFrame with no render node!");
LOG_ALWAYS_FATAL_IF(!mContext, "Cannot drawFrame with no CanvasContext!");
postAndWait(renderThread);
// Reset the single-frame data
mDirty.setEmpty();
- mRenderNode = 0;
}
void DrawFrameTask::postAndWait(RenderThread* renderThread) {
@@ -88,8 +80,7 @@ void DrawFrameTask::run() {
bool canUnblockUiThread = syncFrameState();
// Grab a copy of everything we need
- Rect dirtyCopy(mDirty);
- sp<RenderNode> renderNode = mRenderNode;
+ Rect dirty(mDirty);
CanvasContext* context = mContext;
// From this point on anything in "this" is *UNSAFE TO ACCESS*
@@ -97,15 +88,20 @@ void DrawFrameTask::run() {
unblockUiThread();
}
- drawRenderNode(context, renderNode.get(), &dirtyCopy);
+ context->draw(&dirty);
if (!canUnblockUiThread) {
unblockUiThread();
}
}
-static void prepareTreeInfo(TreeInfo& info) {
+static void initTreeInfo(TreeInfo& info) {
info.prepareTextures = true;
+ info.performStagingPush = true;
+ info.evaluateAnimations = true;
+ // TODO: Get this from Choreographer
+ nsecs_t frameTimeNs = systemTime(CLOCK_MONOTONIC);
+ info.frameTimeMs = nanoseconds_to_milliseconds(frameTimeNs);
}
bool DrawFrameTask::syncFrameState() {
@@ -113,9 +109,9 @@ bool DrawFrameTask::syncFrameState() {
mContext->makeCurrent();
Caches::getInstance().textureCache.resetMarkInUse();
TreeInfo info;
- prepareTreeInfo(info);
+ initTreeInfo(info);
mContext->processLayerUpdates(&mLayers, info);
- mRenderNode->prepareTree(info);
+ mContext->prepareTree(info);
// If prepareTextures is false, we ran out of texture cache space
return !info.hasFunctors && info.prepareTextures;
}
@@ -125,16 +121,6 @@ void DrawFrameTask::unblockUiThread() {
mSignal.signal();
}
-void DrawFrameTask::drawRenderNode(CanvasContext* context, RenderNode* renderNode, Rect* dirty) {
- ATRACE_CALL();
-
- if (dirty->bottom == -1 && dirty->left == -1
- && dirty->top == -1 && dirty->right == -1) {
- dirty = 0;
- }
- context->drawDisplayList(renderNode, dirty);
-}
-
} /* namespace renderthread */
} /* namespace uirenderer */
} /* namespace android */