Loading libs/hwui/AmbientShadow.cpp +1 −0 Original line number Original line Diff line number Diff line Loading @@ -136,6 +136,7 @@ void AmbientShadow::createAmbientShadow(bool isCasterOpaque, } } } } shadowVertexBuffer.setMode(mode); shadowVertexBuffer.setMode(mode); shadowVertexBuffer.computeBounds<AlphaVertex>(); #if DEBUG_SHADOW #if DEBUG_SHADOW for (int i = 0; i < SHADOW_VERTEX_COUNT; i++) { for (int i = 0; i < SHADOW_VERTEX_COUNT; i++) { Loading libs/hwui/PathTessellator.cpp +3 −13 Original line number Original line Diff line number Diff line Loading @@ -794,16 +794,6 @@ void PathTessellator::tessellatePath(const SkPath &path, const SkPaint* paint, vertexBuffer.setBounds(bounds); vertexBuffer.setBounds(bounds); } } static void expandRectToCoverVertex(Rect& rect, float x, float y) { rect.left = fminf(rect.left, x); rect.top = fminf(rect.top, y); rect.right = fmaxf(rect.right, x); rect.bottom = fmaxf(rect.bottom, y); } static void expandRectToCoverVertex(Rect& rect, const Vertex& vertex) { expandRectToCoverVertex(rect, vertex.x, vertex.y); } template <class TYPE> template <class TYPE> static void instanceVertices(VertexBuffer& srcBuffer, VertexBuffer& dstBuffer, static void instanceVertices(VertexBuffer& srcBuffer, VertexBuffer& dstBuffer, const float* points, int count, Rect& bounds) { const float* points, int count, Rect& bounds) { Loading @@ -814,7 +804,7 @@ static void instanceVertices(VertexBuffer& srcBuffer, VertexBuffer& dstBuffer, dstBuffer.alloc<TYPE>(numPoints * verticesPerPoint + (numPoints - 1) * 2); dstBuffer.alloc<TYPE>(numPoints * verticesPerPoint + (numPoints - 1) * 2); for (int i = 0; i < count; i += 2) { for (int i = 0; i < count; i += 2) { expandRectToCoverVertex(bounds, points[i + 0], points[i + 1]); bounds.expandToCoverVertex(points[i + 0], points[i + 1]); dstBuffer.copyInto<TYPE>(srcBuffer, points[i + 0], points[i + 1]); dstBuffer.copyInto<TYPE>(srcBuffer, points[i + 0], points[i + 1]); } } dstBuffer.createDegenerateSeparators<TYPE>(verticesPerPoint); dstBuffer.createDegenerateSeparators<TYPE>(verticesPerPoint); Loading Loading @@ -896,8 +886,8 @@ void PathTessellator::tessellateLines(const float* points, int count, const SkPa } } // calculate bounds // calculate bounds expandRectToCoverVertex(bounds, tempVerticesData[0]); bounds.expandToCoverVertex(tempVerticesData[0].x, tempVerticesData[0].y); expandRectToCoverVertex(bounds, tempVerticesData[1]); bounds.expandToCoverVertex(tempVerticesData[1].x, tempVerticesData[1].y); } } // since multiple objects tessellated into buffer, separate them with degen tris // since multiple objects tessellated into buffer, separate them with degen tris Loading libs/hwui/Rect.h +7 −0 Original line number Original line Diff line number Diff line Loading @@ -241,6 +241,13 @@ public: bottom = ceilf(bottom); bottom = ceilf(bottom); } } void expandToCoverVertex(float x, float y) { left = fminf(left, x); top = fminf(top, y); right = fmaxf(right, x); bottom = fmaxf(bottom, y); } void dump(const char* label = NULL) const { void dump(const char* label = NULL) const { ALOGD("%s[l=%f t=%f r=%f b=%f]", label ? label : "Rect", left, top, right, bottom); ALOGD("%s[l=%f t=%f r=%f b=%f]", label ? label : "Rect", left, top, right, bottom); } } Loading libs/hwui/SpotShadow.cpp +1 −0 Original line number Original line Diff line number Diff line Loading @@ -508,6 +508,7 @@ void SpotShadow::createSpotShadow(bool isCasterOpaque, const Vector3* poly, computeSpotShadow(isCasterOpaque, light, lightVertexCount, lightCenter, poly, computeSpotShadow(isCasterOpaque, light, lightVertexCount, lightCenter, poly, polyLength, retStrips); polyLength, retStrips); retStrips.setMode(VertexBuffer::kTwoPolyRingShadow); retStrips.setMode(VertexBuffer::kTwoPolyRingShadow); retStrips.computeBounds<AlphaVertex>(); } } /** /** Loading libs/hwui/TessellationCache.cpp +0 −2 Original line number Original line Diff line number Diff line Loading @@ -273,8 +273,6 @@ static void tessellateShadows( isCasterOpaque, casterPolygon, casterVertexCount, isCasterOpaque, casterPolygon, casterVertexCount, *drawTransform, lightCenter, lightRadius, casterBounds, *localClip, *drawTransform, lightCenter, lightRadius, casterBounds, *localClip, spotBuffer); spotBuffer); // TODO: set ambientBuffer & spotBuffer's bounds for correct layer damage } } class ShadowProcessor : public TaskProcessor<TessellationCache::vertexBuffer_pair_t*> { class ShadowProcessor : public TaskProcessor<TessellationCache::vertexBuffer_pair_t*> { Loading Loading
libs/hwui/AmbientShadow.cpp +1 −0 Original line number Original line Diff line number Diff line Loading @@ -136,6 +136,7 @@ void AmbientShadow::createAmbientShadow(bool isCasterOpaque, } } } } shadowVertexBuffer.setMode(mode); shadowVertexBuffer.setMode(mode); shadowVertexBuffer.computeBounds<AlphaVertex>(); #if DEBUG_SHADOW #if DEBUG_SHADOW for (int i = 0; i < SHADOW_VERTEX_COUNT; i++) { for (int i = 0; i < SHADOW_VERTEX_COUNT; i++) { Loading
libs/hwui/PathTessellator.cpp +3 −13 Original line number Original line Diff line number Diff line Loading @@ -794,16 +794,6 @@ void PathTessellator::tessellatePath(const SkPath &path, const SkPaint* paint, vertexBuffer.setBounds(bounds); vertexBuffer.setBounds(bounds); } } static void expandRectToCoverVertex(Rect& rect, float x, float y) { rect.left = fminf(rect.left, x); rect.top = fminf(rect.top, y); rect.right = fmaxf(rect.right, x); rect.bottom = fmaxf(rect.bottom, y); } static void expandRectToCoverVertex(Rect& rect, const Vertex& vertex) { expandRectToCoverVertex(rect, vertex.x, vertex.y); } template <class TYPE> template <class TYPE> static void instanceVertices(VertexBuffer& srcBuffer, VertexBuffer& dstBuffer, static void instanceVertices(VertexBuffer& srcBuffer, VertexBuffer& dstBuffer, const float* points, int count, Rect& bounds) { const float* points, int count, Rect& bounds) { Loading @@ -814,7 +804,7 @@ static void instanceVertices(VertexBuffer& srcBuffer, VertexBuffer& dstBuffer, dstBuffer.alloc<TYPE>(numPoints * verticesPerPoint + (numPoints - 1) * 2); dstBuffer.alloc<TYPE>(numPoints * verticesPerPoint + (numPoints - 1) * 2); for (int i = 0; i < count; i += 2) { for (int i = 0; i < count; i += 2) { expandRectToCoverVertex(bounds, points[i + 0], points[i + 1]); bounds.expandToCoverVertex(points[i + 0], points[i + 1]); dstBuffer.copyInto<TYPE>(srcBuffer, points[i + 0], points[i + 1]); dstBuffer.copyInto<TYPE>(srcBuffer, points[i + 0], points[i + 1]); } } dstBuffer.createDegenerateSeparators<TYPE>(verticesPerPoint); dstBuffer.createDegenerateSeparators<TYPE>(verticesPerPoint); Loading Loading @@ -896,8 +886,8 @@ void PathTessellator::tessellateLines(const float* points, int count, const SkPa } } // calculate bounds // calculate bounds expandRectToCoverVertex(bounds, tempVerticesData[0]); bounds.expandToCoverVertex(tempVerticesData[0].x, tempVerticesData[0].y); expandRectToCoverVertex(bounds, tempVerticesData[1]); bounds.expandToCoverVertex(tempVerticesData[1].x, tempVerticesData[1].y); } } // since multiple objects tessellated into buffer, separate them with degen tris // since multiple objects tessellated into buffer, separate them with degen tris Loading
libs/hwui/Rect.h +7 −0 Original line number Original line Diff line number Diff line Loading @@ -241,6 +241,13 @@ public: bottom = ceilf(bottom); bottom = ceilf(bottom); } } void expandToCoverVertex(float x, float y) { left = fminf(left, x); top = fminf(top, y); right = fmaxf(right, x); bottom = fmaxf(bottom, y); } void dump(const char* label = NULL) const { void dump(const char* label = NULL) const { ALOGD("%s[l=%f t=%f r=%f b=%f]", label ? label : "Rect", left, top, right, bottom); ALOGD("%s[l=%f t=%f r=%f b=%f]", label ? label : "Rect", left, top, right, bottom); } } Loading
libs/hwui/SpotShadow.cpp +1 −0 Original line number Original line Diff line number Diff line Loading @@ -508,6 +508,7 @@ void SpotShadow::createSpotShadow(bool isCasterOpaque, const Vector3* poly, computeSpotShadow(isCasterOpaque, light, lightVertexCount, lightCenter, poly, computeSpotShadow(isCasterOpaque, light, lightVertexCount, lightCenter, poly, polyLength, retStrips); polyLength, retStrips); retStrips.setMode(VertexBuffer::kTwoPolyRingShadow); retStrips.setMode(VertexBuffer::kTwoPolyRingShadow); retStrips.computeBounds<AlphaVertex>(); } } /** /** Loading
libs/hwui/TessellationCache.cpp +0 −2 Original line number Original line Diff line number Diff line Loading @@ -273,8 +273,6 @@ static void tessellateShadows( isCasterOpaque, casterPolygon, casterVertexCount, isCasterOpaque, casterPolygon, casterVertexCount, *drawTransform, lightCenter, lightRadius, casterBounds, *localClip, *drawTransform, lightCenter, lightRadius, casterBounds, *localClip, spotBuffer); spotBuffer); // TODO: set ambientBuffer & spotBuffer's bounds for correct layer damage } } class ShadowProcessor : public TaskProcessor<TessellationCache::vertexBuffer_pair_t*> { class ShadowProcessor : public TaskProcessor<TessellationCache::vertexBuffer_pair_t*> { Loading