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

Commit f2043a00 authored by Leon Scroggins's avatar Leon Scroggins Committed by Android (Google) Code Review
Browse files

Merge "Cleanup/document Shaders for UI rendering module"

parents 59e0ef91 fa2e9202
Loading
Loading
Loading
Loading
+3 −11
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package android.graphics;

import android.annotation.NonNull;
import android.compat.annotation.UnsupportedAppUsage;

/**
 * Shader used to draw a bitmap as a texture. The bitmap can be repeated or
@@ -26,15 +25,10 @@ import android.compat.annotation.UnsupportedAppUsage;
public class BitmapShader extends Shader {
    /**
     * Prevent garbage collection.
     * @hide
     */
    @SuppressWarnings({"FieldCanBeLocal", "UnusedDeclaration"})
    @UnsupportedAppUsage
    public Bitmap mBitmap;
    /*package*/ Bitmap mBitmap;

    @UnsupportedAppUsage
    private int mTileX;
    @UnsupportedAppUsage
    private int mTileY;

    /**
@@ -52,16 +46,14 @@ public class BitmapShader extends Shader {
        if (bitmap == null) {
            throw new IllegalArgumentException("Bitmap must be non-null");
        }
        if (bitmap == mBitmap && tileX == mTileX && tileY == mTileY) {
            return;
        }
        mBitmap = bitmap;
        mTileX = tileX;
        mTileY = tileY;
    }

    /** @hide */
    @Override
    long createNativeInstance(long nativeMatrix) {
    protected long createNativeInstance(long nativeMatrix) {
        return nativeCreate(nativeMatrix, mBitmap.getNativeInstance(), mTileX, mTileY);
    }

+2 −1
Original line number Diff line number Diff line
@@ -84,8 +84,9 @@ public class ComposeShader extends Shader {
        mPorterDuffMode = nativeMode;
    }

    /** @hide */
    @Override
    long createNativeInstance(long nativeMatrix) {
    protected long createNativeInstance(long nativeMatrix) {
        mNativeInstanceShaderA = mShaderA.getNativeInstance();
        mNativeInstanceShaderB = mShaderB.getNativeInstance();
        return nativeCreate(nativeMatrix,
+2 −1
Original line number Diff line number Diff line
@@ -151,8 +151,9 @@ public class LinearGradient extends Shader {
        this(x0, y0, x1, y1, new long[] {color0, color1}, null, tile);
    }

    /** @hide */
    @Override
    long createNativeInstance(long nativeMatrix) {
    protected long createNativeInstance(long nativeMatrix) {
        return nativeCreate(nativeMatrix, mX0, mY0, mX1, mY1,
                mColorLongs, mPositions, mTileMode.nativeInt,
                colorSpace().getNativeInstance());
+2 −1
Original line number Diff line number Diff line
@@ -147,8 +147,9 @@ public class RadialGradient extends Shader {
        this(centerX, centerY, radius, new long[] {centerColor, edgeColor}, null, tileMode);
    }

    /** @hide */
    @Override
    long createNativeInstance(long nativeMatrix) {
    protected long createNativeInstance(long nativeMatrix) {
        return nativeCreate(nativeMatrix, mX, mY, mRadius,
                mColorLongs, mPositions, mTileMode.nativeInt,
                colorSpace().getNativeInstance());
+2 −1
Original line number Diff line number Diff line
@@ -74,8 +74,9 @@ public class RuntimeShader extends Shader {
        discardNativeInstance();
    }

    /** @hide */
    @Override
    long createNativeInstance(long nativeMatrix) {
    protected long createNativeInstance(long nativeMatrix) {
        return nativeCreate(mNativeInstanceRuntimeShaderFactory, nativeMatrix, mUniforms,
                colorSpace().getNativeInstance(), mIsOpaque);
    }
Loading