Loading core/api/current.txt +5 −5 Original line number Diff line number Diff line Loading @@ -15011,7 +15011,7 @@ package android.graphics { method public void drawLine(float, float, float, float, @NonNull android.graphics.Paint); method public void drawLines(@NonNull @Size(multiple=4) float[], int, int, @NonNull android.graphics.Paint); method public void drawLines(@NonNull @Size(multiple=4) float[], @NonNull android.graphics.Paint); method public void drawMesh(@NonNull android.graphics.Mesh, android.graphics.BlendMode, @NonNull android.graphics.Paint); method public void drawMesh(@NonNull android.graphics.Mesh, @Nullable android.graphics.BlendMode, @NonNull android.graphics.Paint); method public void drawOval(@NonNull android.graphics.RectF, @NonNull android.graphics.Paint); method public void drawOval(float, float, float, float, @NonNull android.graphics.Paint); method public void drawPaint(@NonNull android.graphics.Paint); Loading Loading @@ -15613,10 +15613,10 @@ package android.graphics { } public class Mesh { method @NonNull public static android.graphics.Mesh make(@NonNull android.graphics.MeshSpecification, int, @NonNull java.nio.Buffer, int, @NonNull android.graphics.Rect); method @NonNull public static android.graphics.Mesh makeIndexed(@NonNull android.graphics.MeshSpecification, int, @NonNull java.nio.Buffer, int, @NonNull java.nio.ShortBuffer, @NonNull android.graphics.Rect); method public void setColorUniform(@NonNull String, int); method public void setColorUniform(@NonNull String, long); 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); 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); method public void setFloatUniform(@NonNull String, float); method public void setFloatUniform(@NonNull String, float, float); graphics/java/android/graphics/BaseCanvas.java +3 −2 Original line number Diff line number Diff line Loading @@ -675,10 +675,11 @@ public abstract class BaseCanvas { * * @param mesh {@link Mesh} object that will be drawn to the screen * @param blendMode {@link BlendMode} used to blend mesh primitives as the destination color * with the Paint color/shader as the source color. * with the Paint color/shader as the source color. This defaults to * {@link BlendMode#MODULATE} if null. * @param paint {@link Paint} used to provide a color/shader/blend mode. */ public void drawMesh(@NonNull Mesh mesh, BlendMode blendMode, @NonNull Paint paint) { public void drawMesh(@NonNull Mesh mesh, @Nullable BlendMode blendMode, @NonNull Paint paint) { if (!isHardwareAccelerated() && onHwFeatureInSwMode()) { throw new RuntimeException("software rendering doesn't support meshes"); } Loading graphics/java/android/graphics/Mesh.java +15 −17 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.graphics; import android.annotation.ColorInt; import android.annotation.ColorLong; import android.annotation.IntDef; import android.annotation.NonNull; Loading @@ -27,10 +29,8 @@ import java.nio.ShortBuffer; /** * Class representing a mesh object. * * This class generates Mesh objects via the * {@link #make(MeshSpecification, int, Buffer, int, Rect)} and * {@link #makeIndexed(MeshSpecification, int, Buffer, int, ShortBuffer, Rect)} methods, * where a {@link MeshSpecification} is required along with various attributes for * This class represents a Mesh object that can optionally be indexed. * A {@link MeshSpecification} is required along with various attributes for * detailing the mesh object, including a mode, vertex buffer, optional index buffer, and bounds * for the mesh. Once generated, a mesh object can be drawn through * {@link Canvas#drawMesh(Mesh, BlendMode, Paint)} Loading Loading @@ -62,7 +62,7 @@ public class Mesh { } /** * Generates a {@link Mesh} object. * Constructor for a non-indexed Mesh. * * @param meshSpec {@link MeshSpecification} used when generating the mesh. * @param mode Determines what mode to draw the mesh in. Must be one of Loading @@ -74,10 +74,8 @@ public class Mesh { * backed buffer generated. * @param vertexCount the number of vertices represented in the vertexBuffer and mesh. * @param bounds bounds of the mesh object. * @return a new Mesh object. */ @NonNull public static Mesh make(@NonNull MeshSpecification meshSpec, @Mode int mode, public Mesh(@NonNull MeshSpecification meshSpec, @Mode int mode, @NonNull Buffer vertexBuffer, int vertexCount, @NonNull Rect bounds) { if (mode != TRIANGLES && mode != TRIANGLE_STRIP) { throw new IllegalArgumentException("Invalid value passed in for mode parameter"); Loading @@ -88,11 +86,12 @@ public class Mesh { if (nativeMesh == 0) { throw new IllegalArgumentException("Mesh construction failed."); } return new Mesh(nativeMesh, false); meshSetup(nativeMesh, false); } /** * Generates a {@link Mesh} object. * Constructor for an indexed Mesh. * * @param meshSpec {@link MeshSpecification} used when generating the mesh. * @param mode Determines what mode to draw the mesh in. Must be one of Loading @@ -108,10 +107,8 @@ public class Mesh { * currently implementation will have a CPU * backed buffer generated. * @param bounds bounds of the mesh object. * @return a new Mesh object. */ @NonNull public static Mesh makeIndexed(@NonNull MeshSpecification meshSpec, @Mode int mode, public Mesh(@NonNull MeshSpecification meshSpec, @Mode int mode, @NonNull Buffer vertexBuffer, int vertexCount, @NonNull ShortBuffer indexBuffer, @NonNull Rect bounds) { if (mode != TRIANGLES && mode != TRIANGLE_STRIP) { Loading @@ -124,7 +121,8 @@ public class Mesh { if (nativeMesh == 0) { throw new IllegalArgumentException("Mesh construction failed."); } return new Mesh(nativeMesh, true); meshSetup(nativeMesh, true); } /** Loading @@ -137,7 +135,7 @@ public class Mesh { * @param color the provided sRGB color will be converted into the shader program's output * colorspace and be available as a vec4 uniform in the program. */ public void setColorUniform(@NonNull String uniformName, int color) { public void setColorUniform(@NonNull String uniformName, @ColorInt int color) { setUniform(uniformName, Color.valueOf(color).getComponents(), true); } Loading @@ -151,7 +149,7 @@ public class Mesh { * @param color the provided sRGB color will be converted into the shader program's output * colorspace and be available as a vec4 uniform in the program. */ public void setColorUniform(@NonNull String uniformName, long color) { public void setColorUniform(@NonNull String uniformName, @ColorLong long color) { Color exSRGB = Color.valueOf(color).convert(ColorSpace.get(ColorSpace.Named.EXTENDED_SRGB)); setUniform(uniformName, exSRGB.getComponents(), true); } Loading Loading @@ -357,7 +355,7 @@ public class Mesh { mNativeMeshWrapper, uniformName, value1, value2, value3, value4, count); } private Mesh(long nativeMeshWrapper, boolean isIndexed) { private void meshSetup(long nativeMeshWrapper, boolean isIndexed) { mNativeMeshWrapper = nativeMeshWrapper; this.mIsIndexed = isIndexed; MeshHolder.MESH_SPECIFICATION_REGISTRY.registerNativeAllocation(this, mNativeMeshWrapper); Loading tests/HwAccelerationTest/src/com/android/test/hwui/MeshActivity.java +2 −2 Original line number Diff line number Diff line Loading @@ -64,7 +64,7 @@ public class MeshActivity extends Activity { vertexBuffer.put(4, 0.0f); vertexBuffer.put(5, 400.0f); vertexBuffer.rewind(); Mesh mesh = Mesh.make( Mesh mesh = new Mesh( meshSpec, Mesh.TRIANGLES, vertexBuffer, 3, new Rect(0, 0, 1000, 1000)); canvas.drawMesh(mesh, BlendMode.COLOR, new Paint()); Loading Loading @@ -98,7 +98,7 @@ public class MeshActivity extends Activity { } iVertexBuffer.rewind(); indexBuffer.rewind(); Mesh mesh2 = Mesh.makeIndexed(meshSpec, Mesh.TRIANGLES, iVertexBuffer, 102, indexBuffer, Mesh mesh2 = new Mesh(meshSpec, Mesh.TRIANGLES, iVertexBuffer, 102, indexBuffer, new Rect(0, 0, 1000, 1000)); Paint paint = new Paint(); paint.setColor(Color.RED); Loading tests/HwAccelerationTest/src/com/android/test/hwui/MeshLargeActivity.java +1 −1 Original line number Diff line number Diff line Loading @@ -109,7 +109,7 @@ public class MeshLargeActivity extends Activity { } vertexBuffer.rewind(); indexBuffer.rewind(); Mesh mesh = Mesh.makeIndexed( Mesh mesh = new Mesh( meshSpec, Mesh.TRIANGLES, vertexBuffer, numTriangles + 2, indexBuffer, new Rect(0, 0, 1000, 1000) ); Loading Loading
core/api/current.txt +5 −5 Original line number Diff line number Diff line Loading @@ -15011,7 +15011,7 @@ package android.graphics { method public void drawLine(float, float, float, float, @NonNull android.graphics.Paint); method public void drawLines(@NonNull @Size(multiple=4) float[], int, int, @NonNull android.graphics.Paint); method public void drawLines(@NonNull @Size(multiple=4) float[], @NonNull android.graphics.Paint); method public void drawMesh(@NonNull android.graphics.Mesh, android.graphics.BlendMode, @NonNull android.graphics.Paint); method public void drawMesh(@NonNull android.graphics.Mesh, @Nullable android.graphics.BlendMode, @NonNull android.graphics.Paint); method public void drawOval(@NonNull android.graphics.RectF, @NonNull android.graphics.Paint); method public void drawOval(float, float, float, float, @NonNull android.graphics.Paint); method public void drawPaint(@NonNull android.graphics.Paint); Loading Loading @@ -15613,10 +15613,10 @@ package android.graphics { } public class Mesh { method @NonNull public static android.graphics.Mesh make(@NonNull android.graphics.MeshSpecification, int, @NonNull java.nio.Buffer, int, @NonNull android.graphics.Rect); method @NonNull public static android.graphics.Mesh makeIndexed(@NonNull android.graphics.MeshSpecification, int, @NonNull java.nio.Buffer, int, @NonNull java.nio.ShortBuffer, @NonNull android.graphics.Rect); method public void setColorUniform(@NonNull String, int); method public void setColorUniform(@NonNull String, long); 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); 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); method public void setFloatUniform(@NonNull String, float); method public void setFloatUniform(@NonNull String, float, float);
graphics/java/android/graphics/BaseCanvas.java +3 −2 Original line number Diff line number Diff line Loading @@ -675,10 +675,11 @@ public abstract class BaseCanvas { * * @param mesh {@link Mesh} object that will be drawn to the screen * @param blendMode {@link BlendMode} used to blend mesh primitives as the destination color * with the Paint color/shader as the source color. * with the Paint color/shader as the source color. This defaults to * {@link BlendMode#MODULATE} if null. * @param paint {@link Paint} used to provide a color/shader/blend mode. */ public void drawMesh(@NonNull Mesh mesh, BlendMode blendMode, @NonNull Paint paint) { public void drawMesh(@NonNull Mesh mesh, @Nullable BlendMode blendMode, @NonNull Paint paint) { if (!isHardwareAccelerated() && onHwFeatureInSwMode()) { throw new RuntimeException("software rendering doesn't support meshes"); } Loading
graphics/java/android/graphics/Mesh.java +15 −17 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.graphics; import android.annotation.ColorInt; import android.annotation.ColorLong; import android.annotation.IntDef; import android.annotation.NonNull; Loading @@ -27,10 +29,8 @@ import java.nio.ShortBuffer; /** * Class representing a mesh object. * * This class generates Mesh objects via the * {@link #make(MeshSpecification, int, Buffer, int, Rect)} and * {@link #makeIndexed(MeshSpecification, int, Buffer, int, ShortBuffer, Rect)} methods, * where a {@link MeshSpecification} is required along with various attributes for * This class represents a Mesh object that can optionally be indexed. * A {@link MeshSpecification} is required along with various attributes for * detailing the mesh object, including a mode, vertex buffer, optional index buffer, and bounds * for the mesh. Once generated, a mesh object can be drawn through * {@link Canvas#drawMesh(Mesh, BlendMode, Paint)} Loading Loading @@ -62,7 +62,7 @@ public class Mesh { } /** * Generates a {@link Mesh} object. * Constructor for a non-indexed Mesh. * * @param meshSpec {@link MeshSpecification} used when generating the mesh. * @param mode Determines what mode to draw the mesh in. Must be one of Loading @@ -74,10 +74,8 @@ public class Mesh { * backed buffer generated. * @param vertexCount the number of vertices represented in the vertexBuffer and mesh. * @param bounds bounds of the mesh object. * @return a new Mesh object. */ @NonNull public static Mesh make(@NonNull MeshSpecification meshSpec, @Mode int mode, public Mesh(@NonNull MeshSpecification meshSpec, @Mode int mode, @NonNull Buffer vertexBuffer, int vertexCount, @NonNull Rect bounds) { if (mode != TRIANGLES && mode != TRIANGLE_STRIP) { throw new IllegalArgumentException("Invalid value passed in for mode parameter"); Loading @@ -88,11 +86,12 @@ public class Mesh { if (nativeMesh == 0) { throw new IllegalArgumentException("Mesh construction failed."); } return new Mesh(nativeMesh, false); meshSetup(nativeMesh, false); } /** * Generates a {@link Mesh} object. * Constructor for an indexed Mesh. * * @param meshSpec {@link MeshSpecification} used when generating the mesh. * @param mode Determines what mode to draw the mesh in. Must be one of Loading @@ -108,10 +107,8 @@ public class Mesh { * currently implementation will have a CPU * backed buffer generated. * @param bounds bounds of the mesh object. * @return a new Mesh object. */ @NonNull public static Mesh makeIndexed(@NonNull MeshSpecification meshSpec, @Mode int mode, public Mesh(@NonNull MeshSpecification meshSpec, @Mode int mode, @NonNull Buffer vertexBuffer, int vertexCount, @NonNull ShortBuffer indexBuffer, @NonNull Rect bounds) { if (mode != TRIANGLES && mode != TRIANGLE_STRIP) { Loading @@ -124,7 +121,8 @@ public class Mesh { if (nativeMesh == 0) { throw new IllegalArgumentException("Mesh construction failed."); } return new Mesh(nativeMesh, true); meshSetup(nativeMesh, true); } /** Loading @@ -137,7 +135,7 @@ public class Mesh { * @param color the provided sRGB color will be converted into the shader program's output * colorspace and be available as a vec4 uniform in the program. */ public void setColorUniform(@NonNull String uniformName, int color) { public void setColorUniform(@NonNull String uniformName, @ColorInt int color) { setUniform(uniformName, Color.valueOf(color).getComponents(), true); } Loading @@ -151,7 +149,7 @@ public class Mesh { * @param color the provided sRGB color will be converted into the shader program's output * colorspace and be available as a vec4 uniform in the program. */ public void setColorUniform(@NonNull String uniformName, long color) { public void setColorUniform(@NonNull String uniformName, @ColorLong long color) { Color exSRGB = Color.valueOf(color).convert(ColorSpace.get(ColorSpace.Named.EXTENDED_SRGB)); setUniform(uniformName, exSRGB.getComponents(), true); } Loading Loading @@ -357,7 +355,7 @@ public class Mesh { mNativeMeshWrapper, uniformName, value1, value2, value3, value4, count); } private Mesh(long nativeMeshWrapper, boolean isIndexed) { private void meshSetup(long nativeMeshWrapper, boolean isIndexed) { mNativeMeshWrapper = nativeMeshWrapper; this.mIsIndexed = isIndexed; MeshHolder.MESH_SPECIFICATION_REGISTRY.registerNativeAllocation(this, mNativeMeshWrapper); Loading
tests/HwAccelerationTest/src/com/android/test/hwui/MeshActivity.java +2 −2 Original line number Diff line number Diff line Loading @@ -64,7 +64,7 @@ public class MeshActivity extends Activity { vertexBuffer.put(4, 0.0f); vertexBuffer.put(5, 400.0f); vertexBuffer.rewind(); Mesh mesh = Mesh.make( Mesh mesh = new Mesh( meshSpec, Mesh.TRIANGLES, vertexBuffer, 3, new Rect(0, 0, 1000, 1000)); canvas.drawMesh(mesh, BlendMode.COLOR, new Paint()); Loading Loading @@ -98,7 +98,7 @@ public class MeshActivity extends Activity { } iVertexBuffer.rewind(); indexBuffer.rewind(); Mesh mesh2 = Mesh.makeIndexed(meshSpec, Mesh.TRIANGLES, iVertexBuffer, 102, indexBuffer, Mesh mesh2 = new Mesh(meshSpec, Mesh.TRIANGLES, iVertexBuffer, 102, indexBuffer, new Rect(0, 0, 1000, 1000)); Paint paint = new Paint(); paint.setColor(Color.RED); Loading
tests/HwAccelerationTest/src/com/android/test/hwui/MeshLargeActivity.java +1 −1 Original line number Diff line number Diff line Loading @@ -109,7 +109,7 @@ public class MeshLargeActivity extends Activity { } vertexBuffer.rewind(); indexBuffer.rewind(); Mesh mesh = Mesh.makeIndexed( Mesh mesh = new Mesh( meshSpec, Mesh.TRIANGLES, vertexBuffer, numTriangles + 2, indexBuffer, new Rect(0, 0, 1000, 1000) ); Loading