Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d51e9947 authored by John Reck's avatar John Reck
Browse files

Fix drawVertices in HW accel

Also fix a wrong array length

Test: CtsUiRenderingTestCases#testBlackTriangleVertices
Change-Id: I9325febb63fdaf979325b202bfafac6dd70bfeaf
parent 209d21be
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -536,9 +536,6 @@ public class RecordingCanvas extends Canvas {
            @Nullable int[] colors, int colorOffset, @Nullable short[] indices, int indexOffset,
            int indexCount, @NonNull Paint paint) {
        checkRange(verts.length, vertOffset, vertexCount);
        if (isHardwareAccelerated()) {
            return;
        }
        if (texs != null) {
            checkRange(texs.length, texOffset, vertexCount);
        }
+4 −2
Original line number Diff line number Diff line
@@ -320,9 +320,12 @@ static void drawVertices(JNIEnv* env, jobject, jlong canvasHandle,
                         jintArray jcolors, jint colorIndex,
                         jshortArray jindices, jint indexIndex,
                         jint indexCount, jlong paintHandle) {

    const int vertexCount = floatCount >> 1;  // 2 floats per SkPoint

    AutoJavaFloatArray  vertA(env, jverts, vertIndex + floatCount);
    AutoJavaFloatArray  texA(env, jtexs, texIndex + floatCount);
    AutoJavaIntArray    colorA(env, jcolors, colorIndex + floatCount);
    AutoJavaIntArray    colorA(env, jcolors, colorIndex + vertexCount);
    AutoJavaShortArray  indexA(env, jindices, indexIndex + indexCount);

    const float* verts = vertA.ptr() + vertIndex;
@@ -337,7 +340,6 @@ static void drawVertices(JNIEnv* env, jobject, jlong canvasHandle,
        indices = (const uint16_t*)(indexA.ptr() + indexIndex);
    }

    int vertexCount = floatCount >> 1;  // 2 floats per SkPoint
    SkVertices::VertexMode mode = static_cast<SkVertices::VertexMode>(modeHandle);
    const Paint* paint = reinterpret_cast<Paint*>(paintHandle);
    get_canvas(canvasHandle)->drawVertices(SkVertices::MakeCopy(mode, vertexCount,