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

Commit 96ac8560 authored by Xavier Ducrohet's avatar Xavier Ducrohet Committed by Android Git Automerger
Browse files

am 515a08b0: Merge 59aad78e from master. do not merge.

* commit '515a08b0':
  Merge 59aad78e from master. do not merge.
parents 70c3d1c2 515a08b0
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -73,6 +73,14 @@ public abstract class Shader_Delegate {
    public abstract boolean isSupported();
    public abstract String getSupportMessage();

    public boolean isValid() {
        if (mLocalMatrix != null && mLocalMatrix.getAffineTransform().getDeterminant() == 0) {
            return false;
        }

        return true;
    }

    // ---- native methods ----

    @LayoutlibDelegate
@@ -101,5 +109,4 @@ public abstract class Shader_Delegate {

        return new java.awt.geom.AffineTransform();
    }

}
+28 −18
Original line number Diff line number Diff line
@@ -609,6 +609,7 @@ public class GcSnapshot {
                    createCustomGraphics(originalGraphics, paint, compositeOnly, forceSrcMode) :
                        (Graphics2D) originalGraphics.create();

        if (configuredGraphics2D != null) {
            try {
                drawable.draw(configuredGraphics2D, paint);
                layer.change();
@@ -617,6 +618,7 @@ public class GcSnapshot {
                configuredGraphics2D.dispose();
            }
        }
    }

    private GcSnapshot doRestore() {
        if (mPrevious != null) {
@@ -687,11 +689,13 @@ public class GcSnapshot {
        Graphics2D g = createCustomGraphics(baseGfx, mLocalLayerPaint,
                true /*alphaOnly*/, false /*forceSrcMode*/);

        if (g != null) {
            g.drawImage(mLocalLayer.getImage(),
                    mLayerBounds.left, mLayerBounds.top, mLayerBounds.right, mLayerBounds.bottom,
                    mLayerBounds.left, mLayerBounds.top, mLayerBounds.right, mLayerBounds.bottom,
                    null);
            g.dispose();
        }

        baseGfx.dispose();
    }
@@ -721,12 +725,18 @@ public class GcSnapshot {
            Shader_Delegate shaderDelegate = paint.getShader();
            if (shaderDelegate != null) {
                if (shaderDelegate.isSupported()) {
                    // shader could have a local matrix that's not valid (for instance 0 scaling).
                    if (shaderDelegate.isValid()) {
                        java.awt.Paint shaderPaint = shaderDelegate.getJavaPaint();
                        assert shaderPaint != null;
                        if (shaderPaint != null) {
                            g.setPaint(shaderPaint);
                            customShader = true;
                        }
                    } else {
                        g.dispose();
                        return null;
                    }
                } else {
                    Bridge.getLog().fidelityWarning(LayoutLog.TAG_SHADER,
                            shaderDelegate.getSupportMessage(),
@@ -749,7 +759,7 @@ public class GcSnapshot {

        if (forceSrcMode) {
            g.setComposite(AlphaComposite.getInstance(
                    AlphaComposite.SRC, (float) alpha / 255.f));
                    AlphaComposite.SRC, alpha / 255.f));
        } else {
            boolean customXfermode = false;
            Xfermode_Delegate xfermodeDelegate = paint.getXfermode();
@@ -773,7 +783,7 @@ public class GcSnapshot {
            // that will handle the alpha.
            if (customXfermode == false && alpha != 0xFF) {
                g.setComposite(AlphaComposite.getInstance(
                        AlphaComposite.SRC_OVER, (float) alpha / 255.f));
                        AlphaComposite.SRC_OVER, alpha / 255.f));
            }
        }