switch over to SkVertices object, and stop using deprecated methods.
This allows Skia to remove
SK_SUPPORT_LEGACY_CANVAS_VERTICES
SK_SUPPORT_LEGACY_BITMAP_SETPIXELREF
SK_SUPPORT_LEGACY_PIXELREFFACTORY
Test: Existing CTS cover these changes
Running CtsGraphicsTestCases, there were 6 failures w/ and w/o this CL.
None of the 6 seems related to this CL.
Change-Id: I724082357d9f6cb699770df3c0b9ef555b957697
diff --git a/libs/hwui/SkiaCanvasProxy.cpp b/libs/hwui/SkiaCanvasProxy.cpp
index 2e5a45e..34dddd1 100644
--- a/libs/hwui/SkiaCanvasProxy.cpp
+++ b/libs/hwui/SkiaCanvasProxy.cpp
@@ -183,20 +183,10 @@
void SkiaCanvasProxy::onDrawVerticesObject(const SkVertices* vertices, SkBlendMode bmode,
const SkPaint& paint) {
- // TODO: should we pass through blendmode
if (mFilterHwuiCalls) {
return;
}
- // convert the SkPoints into floats
- static_assert(sizeof(SkPoint) == sizeof(float)*2, "SkPoint is no longer two floats");
- const int floatCount = vertices->vertexCount() << 1;
- const float* vArray = (const float*)vertices->positions();
- const float* tArray = (const float*)vertices->texCoords();
- const int* cArray = (const int*)vertices->colors();
- // Can remove this cast after changing to SkVertices::VertexMode
- SkCanvas::VertexMode vmode = static_cast<SkCanvas::VertexMode>(vertices->mode());
- mCanvas->drawVertices(vmode, floatCount, vArray, tArray, cArray,
- vertices->indices(), vertices->indexCount(), paint);
+ mCanvas->drawVertices(vertices, bmode, paint);
}
sk_sp<SkSurface> SkiaCanvasProxy::onNewSurface(const SkImageInfo&, const SkSurfaceProps&) {
@@ -470,19 +460,13 @@
if (mFilterHwuiCalls) {
return;
}
- SkPatchUtils::VertexData data;
-
SkMatrix matrix;
mCanvas->getMatrix(&matrix);
SkISize lod = SkPatchUtils::GetLevelOfDetail(cubics, &matrix);
- // It automatically adjusts lodX and lodY in case it exceeds the number of indices.
- // If it fails to generate the vertices, then we do not draw.
- if (SkPatchUtils::getVertexData(&data, cubics, colors, texCoords, lod.width(), lod.height())) {
- this->drawVertices(SkCanvas::kTriangles_VertexMode, data.fVertexCount, data.fPoints,
- data.fTexCoords, data.fColors, bmode, data.fIndices, data.fIndexCount,
- paint);
- }
+ mCanvas->drawVertices(SkPatchUtils::MakeVertices(cubics, colors, texCoords,
+ lod.width(), lod.height()).get(),
+ bmode, paint);
}
void SkiaCanvasProxy::onClipRect(const SkRect& rect, SkClipOp op, ClipEdgeStyle) {