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

Commit 9c13c8de authored by Diego Perez's avatar Diego Perez Committed by Android Git Automerger
Browse files

am bc47abe4: Merge "Make sure shaders use a color model compatible with the...

am bc47abe4: Merge "Make sure shaders use a color model compatible with the destination." into lmp-mr1-dev

* commit 'bc47abe4':
  Make sure shaders use a color model compatible with the destination.
parents 872e9950 bc47abe4
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@ import com.android.tools.layoutlib.annotations.LayoutlibDelegate;

import android.graphics.Shader.TileMode;

import java.awt.image.ColorModel;

/**
 * Delegate implementing the native methods of android.graphics.BitmapShader
 *
@@ -124,6 +126,11 @@ public class BitmapShader_Delegate extends Shader_Delegate {
                localMatrix = new java.awt.geom.AffineTransform();
            }

            if (!colorModel.isCompatibleRaster(mImage.getRaster())) {
                // Fallback to the default ARGB color model
                colorModel = ColorModel.getRGBdefault();
            }

            return new BitmapShaderContext(canvasMatrix, localMatrix, colorModel);
        }

@@ -153,8 +160,9 @@ public class BitmapShader_Delegate extends Shader_Delegate {

            @Override
            public java.awt.image.Raster getRaster(int x, int y, int w, int h) {
                java.awt.image.BufferedImage image = new java.awt.image.BufferedImage(w, h,
                        java.awt.image.BufferedImage.TYPE_INT_ARGB);
                java.awt.image.BufferedImage image = new java.awt.image.BufferedImage(
                    mColorModel, mColorModel.createCompatibleWritableRaster(w, h),
                    mColorModel.isAlphaPremultiplied(), null);

                int[] data = new int[w*h];

+3 −2
Original line number Diff line number Diff line
@@ -172,8 +172,9 @@ public final class LinearGradient_Delegate extends Gradient_Delegate {

            @Override
            public java.awt.image.Raster getRaster(int x, int y, int w, int h) {
                java.awt.image.BufferedImage image = new java.awt.image.BufferedImage(w, h,
                        java.awt.image.BufferedImage.TYPE_INT_ARGB);
                java.awt.image.BufferedImage image = new java.awt.image.BufferedImage(
                    mColorModel, mColorModel.createCompatibleWritableRaster(w, h),
                    mColorModel.isAlphaPremultiplied(), null);

                int[] data = new int[w*h];

+3 −2
Original line number Diff line number Diff line
@@ -160,8 +160,9 @@ public class RadialGradient_Delegate extends Gradient_Delegate {

            @Override
            public java.awt.image.Raster getRaster(int x, int y, int w, int h) {
                java.awt.image.BufferedImage image = new java.awt.image.BufferedImage(w, h,
                        java.awt.image.BufferedImage.TYPE_INT_ARGB);
                java.awt.image.BufferedImage image = new java.awt.image.BufferedImage(
                    mColorModel, mColorModel.createCompatibleWritableRaster(w, h),
                    mColorModel.isAlphaPremultiplied(), null);

                int[] data = new int[w*h];

+3 −2
Original line number Diff line number Diff line
@@ -152,8 +152,9 @@ public class SweepGradient_Delegate extends Gradient_Delegate {

            @Override
            public java.awt.image.Raster getRaster(int x, int y, int w, int h) {
                java.awt.image.BufferedImage image = new java.awt.image.BufferedImage(w, h,
                        java.awt.image.BufferedImage.TYPE_INT_ARGB);
                java.awt.image.BufferedImage image = new java.awt.image.BufferedImage(
                    mColorModel, mColorModel.createCompatibleWritableRaster(w, h),
                    mColorModel.isAlphaPremultiplied(), null);

                int[] data = new int[w*h];