Merge "Fix a crash in skia pipeline, when empty reorder block is first"

This commit is contained in:
TreeHugger Robot
2016-12-01 21:35:58 +00:00
committed by Android (Google) Code Review
4 changed files with 7 additions and 3 deletions

View File

@@ -40,7 +40,7 @@ void StartReorderBarrierDrawable::onDraw(SkCanvas* canvas) {
//mChildren is allocated and initialized only the first time onDraw is called and cached for
//subsequent calls
mChildren.reserve(mEndChildIndex - mBeginChildIndex + 1);
for (unsigned int i = mBeginChildIndex; i <= mEndChildIndex; i++) {
for (int i = mBeginChildIndex; i <= mEndChildIndex; i++) {
mChildren.push_back(const_cast<RenderNodeDrawable*>(&mDisplayList->mChildNodes[i]));
}
}

View File

@@ -47,8 +47,8 @@ protected:
virtual void onDraw(SkCanvas* canvas) override;
private:
size_t mEndChildIndex;
size_t mBeginChildIndex;
int mEndChildIndex;
int mBeginChildIndex;
FatVector<RenderNodeDrawable*, 16> mChildren;
SkiaDisplayList* mDisplayList;

View File

@@ -1530,6 +1530,8 @@ public:
RENDERTHREAD_TEST(FrameBuilder, zReorder) {
auto parent = TestUtils::createNode<RecordingCanvas>(0, 0, 100, 100,
[](RenderProperties& props, RecordingCanvas& canvas) {
canvas.insertReorderBarrier(true);
canvas.insertReorderBarrier(false);
drawOrderedNode(&canvas, 0, 10.0f); // in reorder=false at this point, so played inorder
drawOrderedRect(&canvas, 1);
canvas.insertReorderBarrier(true);

View File

@@ -102,6 +102,8 @@ TEST(RenderNodeDrawable, zReorder) {
auto parent = TestUtils::createSkiaNode(0, 0, 100, 100,
[](RenderProperties& props, SkiaRecordingCanvas& canvas) {
canvas.insertReorderBarrier(true);
canvas.insertReorderBarrier(false);
drawOrderedNode(&canvas, 0, 10.0f); // in reorder=false at this point, so played inorder
drawOrderedRect(&canvas, 1);
canvas.insertReorderBarrier(true);