Add functor support to new reorderer/renderer
bug:22480459
Change-Id: I95df7e0504f62d254e8ffbd8d65ed5d763080b9c
diff --git a/libs/hwui/BakedOpRenderer.cpp b/libs/hwui/BakedOpRenderer.cpp
index 93a9406..f8282dc 100644
--- a/libs/hwui/BakedOpRenderer.cpp
+++ b/libs/hwui/BakedOpRenderer.cpp
@@ -128,7 +128,7 @@
return texture;
}
-void BakedOpRenderer::renderGlop(const Rect* dirtyBounds, const Rect* clip, const Glop& glop) {
+void BakedOpRenderer::prepareRender(const Rect* dirtyBounds, const Rect* clip) {
mRenderState.scissor().setEnabled(clip != nullptr);
if (clip) {
mRenderState.scissor().set(clip->left, mRenderTarget.viewportHeight - clip->bottom,
@@ -140,10 +140,31 @@
dirtyBounds->right, dirtyBounds->bottom);
mRenderTarget.offscreenBuffer->region.orSelf(dirty);
}
+}
+
+void BakedOpRenderer::renderGlop(const Rect* dirtyBounds, const Rect* clip, const Glop& glop) {
+ prepareRender(dirtyBounds, clip);
mRenderState.render(glop, mRenderTarget.orthoMatrix);
if (!mRenderTarget.frameBufferId) mHasDrawn = true;
}
+void BakedOpRenderer::renderFunctor(const FunctorOp& op, const BakedOpState& state) {
+ prepareRender(&state.computedState.clippedBounds, &state.computedState.clipRect);
+
+ DrawGlInfo info;
+ auto&& clip = state.computedState.clipRect;
+ info.clipLeft = clip.left;
+ info.clipTop = clip.top;
+ info.clipRight = clip.right;
+ info.clipBottom = clip.bottom;
+ info.isLayer = offscreenRenderTarget();
+ info.width = mRenderTarget.viewportWidth;
+ info.height = mRenderTarget.viewportHeight;
+ state.computedState.transform.copyTo(&info.transform[0]);
+
+ mRenderState.invokeFunctor(op.functor, DrawGlInfo::kModeDraw, &info);
+}
+
void BakedOpRenderer::dirtyRenderTarget(const Rect& uiDirty) {
if (mRenderTarget.offscreenBuffer) {
android::Rect dirty(uiDirty.left, uiDirty.top, uiDirty.right, uiDirty.bottom);