Add TextOnPath support to new reorderer/renderer
bug:22480459
Change-Id: I302048ec09901420c15003e21e44a551cc59c7ad
diff --git a/libs/hwui/OpReorderer.cpp b/libs/hwui/OpReorderer.cpp
index 6d90a42..e147211 100644
--- a/libs/hwui/OpReorderer.cpp
+++ b/libs/hwui/OpReorderer.cpp
@@ -90,7 +90,9 @@
}
MergingOpBatch(batchid_t batchId, BakedOpState* op)
- : BatchBase(batchId, op, true) {
+ : BatchBase(batchId, op, true)
+ , mClipSideFlags(op->computedState.clipSideFlags)
+ , mClipRect(op->computedState.clipRect) {
}
/*
@@ -202,11 +204,11 @@
if (newClipSideFlags & OpClipSideFlags::Bottom) mClipRect.bottom = opClip.bottom;
}
- bool getClipSideFlags() const { return mClipSideFlags; }
+ int getClipSideFlags() const { return mClipSideFlags; }
const Rect& getClipRect() const { return mClipRect; }
private:
- int mClipSideFlags = 0;
+ int mClipSideFlags;
Rect mClipRect;
};
@@ -308,12 +310,6 @@
mergingBatch->getClipSideFlags(),
mergingBatch->getClipRect()
};
- if (data.clipSideFlags) {
- // if right or bottom sides aren't used to clip, init them to viewport bounds
- // in the clip rect, so it can be used to scissor
- if (!(data.clipSideFlags & OpClipSideFlags::Right)) data.clip.right = width;
- if (!(data.clipSideFlags & OpClipSideFlags::Bottom)) data.clip.bottom = height;
- }
mergedReceivers[opId](arg, data);
} else {
for (const BakedOpState* op : batch->getOps()) {
@@ -850,14 +846,16 @@
currentLayer().deferUnmergeableOp(mAllocator, bakedState, OpBatchType::Vertices);
}
+static batchid_t textBatchId(const SkPaint& paint) {
+ // TODO: better handling of shader (since we won't care about color then)
+ return paint.getColor() == SK_ColorBLACK ? OpBatchType::Text : OpBatchType::ColorText;
+}
+
void OpReorderer::deferTextOp(const TextOp& op) {
BakedOpState* bakedState = tryBakeOpState(op);
if (!bakedState) return; // quick rejected
- // TODO: better handling of shader (since we won't care about color then)
- batchid_t batchId = op.paint->getColor() == SK_ColorBLACK
- ? OpBatchType::Text : OpBatchType::ColorText;
-
+ batchid_t batchId = textBatchId(*(op.paint));
if (bakedState->computedState.transform.isPureTranslate()
&& PaintUtils::getXfermodeDirect(op.paint) == SkXfermode::kSrcOver_Mode) {
mergeid_t mergeId = reinterpret_cast<mergeid_t>(op.paint->getColor());
@@ -867,6 +865,12 @@
}
}
+void OpReorderer::deferTextOnPathOp(const TextOnPathOp& op) {
+ BakedOpState* bakedState = tryBakeOpState(op);
+ if (!bakedState) return; // quick rejected
+ currentLayer().deferUnmergeableOp(mAllocator, bakedState, textBatchId(*(op.paint)));
+}
+
void OpReorderer::saveForLayer(uint32_t layerWidth, uint32_t layerHeight,
float contentTranslateX, float contentTranslateY,
const Rect& repaintRect,