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

Commit baba636b authored by John Reck's avatar John Reck Committed by Android (Google) Code Review
Browse files

Merge "Mesh Rect -> RectF"

parents 84eeb064 bfffc36c
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -15613,8 +15613,8 @@ package android.graphics {
  }
  public class Mesh {
    ctor public Mesh(@NonNull android.graphics.MeshSpecification, int, @NonNull java.nio.Buffer, int, @NonNull android.graphics.Rect);
    ctor public Mesh(@NonNull android.graphics.MeshSpecification, int, @NonNull java.nio.Buffer, int, @NonNull java.nio.ShortBuffer, @NonNull android.graphics.Rect);
    ctor public Mesh(@NonNull android.graphics.MeshSpecification, int, @NonNull java.nio.Buffer, int, @NonNull android.graphics.RectF);
    ctor public Mesh(@NonNull android.graphics.MeshSpecification, int, @NonNull java.nio.Buffer, int, @NonNull java.nio.ShortBuffer, @NonNull android.graphics.RectF);
    method public void setColorUniform(@NonNull String, @ColorInt int);
    method public void setColorUniform(@NonNull String, @ColorLong long);
    method public void setColorUniform(@NonNull String, @NonNull android.graphics.Color);
+6 −6
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ public class Mesh {
     * @param bounds       bounds of the mesh object.
     */
    public Mesh(@NonNull MeshSpecification meshSpec, @Mode int mode,
            @NonNull Buffer vertexBuffer, int vertexCount, @NonNull Rect bounds) {
            @NonNull Buffer vertexBuffer, int vertexCount, @NonNull RectF bounds) {
        if (mode != TRIANGLES && mode != TRIANGLE_STRIP) {
            throw new IllegalArgumentException("Invalid value passed in for mode parameter");
        }
@@ -110,7 +110,7 @@ public class Mesh {
     */
    public Mesh(@NonNull MeshSpecification meshSpec, @Mode int mode,
            @NonNull Buffer vertexBuffer, int vertexCount, @NonNull ShortBuffer indexBuffer,
            @NonNull Rect bounds) {
            @NonNull RectF bounds) {
        if (mode != TRIANGLES && mode != TRIANGLE_STRIP) {
            throw new IllegalArgumentException("Invalid value passed in for mode parameter");
        }
@@ -364,13 +364,13 @@ public class Mesh {
    private static native long nativeGetFinalizer();

    private static native long nativeMake(long meshSpec, int mode, Buffer vertexBuffer,
            boolean isDirect, int vertexCount, int vertexOffset, int left, int top, int right,
            int bottom);
            boolean isDirect, int vertexCount, int vertexOffset, float left, float top, float right,
            float bottom);

    private static native long nativeMakeIndexed(long meshSpec, int mode, Buffer vertexBuffer,
            boolean isVertexDirect, int vertexCount, int vertexOffset, ShortBuffer indexBuffer,
            boolean isIndexDirect, int indexCount, int indexOffset, int left, int top, int right,
            int bottom);
            boolean isIndexDirect, int indexCount, int indexOffset, float left, float top,
            float right, float bottom);

    private static native void nativeUpdateUniforms(long builder, String uniformName, float value1,
            float value2, float value3, float value4, int count);
+5 −5
Original line number Diff line number Diff line
@@ -38,8 +38,8 @@ sk_sp<SkMesh::IndexBuffer> genIndexBuffer(JNIEnv* env, jobject buffer, int size,
}

static jlong make(JNIEnv* env, jobject, jlong meshSpec, jint mode, jobject vertexBuffer,
                  jboolean isDirect, jint vertexCount, jint vertexOffset, jint left, jint top,
                  jint right, jint bottom) {
                  jboolean isDirect, jint vertexCount, jint vertexOffset, jfloat left, jfloat top,
                  jfloat right, jfloat bottom) {
    auto skMeshSpec = sk_ref_sp(reinterpret_cast<SkMeshSpecification*>(meshSpec));
    sk_sp<SkMesh::VertexBuffer> skVertexBuffer =
            genVertexBuffer(env, vertexBuffer, vertexCount * skMeshSpec->stride(), isDirect);
@@ -60,7 +60,7 @@ static jlong make(JNIEnv* env, jobject, jlong meshSpec, jint mode, jobject verte
static jlong makeIndexed(JNIEnv* env, jobject, jlong meshSpec, jint mode, jobject vertexBuffer,
                         jboolean isVertexDirect, jint vertexCount, jint vertexOffset,
                         jobject indexBuffer, jboolean isIndexDirect, jint indexCount,
                         jint indexOffset, jint left, jint top, jint right, jint bottom) {
                         jint indexOffset, jfloat left, jfloat top, jfloat right, jfloat bottom) {
    auto skMeshSpec = sk_ref_sp(reinterpret_cast<SkMeshSpecification*>(meshSpec));
    sk_sp<SkMesh::VertexBuffer> skVertexBuffer =
            genVertexBuffer(env, vertexBuffer, vertexCount * skMeshSpec->stride(), isVertexDirect);
@@ -210,8 +210,8 @@ static jlong getMeshFinalizer(JNIEnv*, jobject) {

static const JNINativeMethod gMeshMethods[] = {
        {"nativeGetFinalizer", "()J", (void*)getMeshFinalizer},
        {"nativeMake", "(JILjava/nio/Buffer;ZIIIIII)J", (void*)make},
        {"nativeMakeIndexed", "(JILjava/nio/Buffer;ZIILjava/nio/ShortBuffer;ZIIIIII)J",
        {"nativeMake", "(JILjava/nio/Buffer;ZIIFFFF)J", (void*)make},
        {"nativeMakeIndexed", "(JILjava/nio/Buffer;ZIILjava/nio/ShortBuffer;ZIIFFFF)J",
         (void*)makeIndexed},
        {"nativeUpdateMesh", "(JZ)V", (void*)updateMesh},
        {"nativeUpdateUniforms", "(JLjava/lang/String;[FZ)V", (void*)updateFloatArrayUniforms},
+3 −3
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ import android.graphics.MeshSpecification;
import android.graphics.MeshSpecification.Attribute;
import android.graphics.MeshSpecification.Varying;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.RectF;
import android.os.Bundle;
import android.view.View;

@@ -65,7 +65,7 @@ public class MeshActivity extends Activity {
            vertexBuffer.put(5, 400.0f);
            vertexBuffer.rewind();
            Mesh mesh = new Mesh(
                    meshSpec, Mesh.TRIANGLES, vertexBuffer, 3, new Rect(0, 0, 1000, 1000));
                    meshSpec, Mesh.TRIANGLES, vertexBuffer, 3, new RectF(0, 0, 1000, 1000));

            canvas.drawMesh(mesh, BlendMode.COLOR, new Paint());

@@ -99,7 +99,7 @@ public class MeshActivity extends Activity {
            iVertexBuffer.rewind();
            indexBuffer.rewind();
            Mesh mesh2 = new Mesh(meshSpec, Mesh.TRIANGLES, iVertexBuffer, 102, indexBuffer,
                    new Rect(0, 0, 1000, 1000));
                    new RectF(0, 0, 1000, 1000));
            Paint paint = new Paint();
            paint.setColor(Color.RED);
            canvas.drawMesh(mesh2, BlendMode.COLOR, paint);
+2 −2
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ import android.graphics.MeshSpecification;
import android.graphics.MeshSpecification.Attribute;
import android.graphics.MeshSpecification.Varying;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.RectF;
import android.os.Bundle;
import android.view.View;

@@ -111,7 +111,7 @@ public class MeshLargeActivity extends Activity {
            indexBuffer.rewind();
            Mesh mesh = new Mesh(
                    meshSpec, Mesh.TRIANGLES, vertexBuffer, numTriangles + 2, indexBuffer,
                    new Rect(0, 0, 1000, 1000)
                    new RectF(0, 0, 1000, 1000)
            );
            mesh.setFloatUniform("test", 1.0f, 2.0f);
            Paint paint = new Paint();