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

Commit 4f291d33 authored by Xavier Ducrohet's avatar Xavier Ducrohet
Browse files

Reimplement the native matrix method using the new delegate way.

Instead of renaming the old Matrix class into _Original_Matrix
and have layoutlib provide a full new implementation of Matrix,
we keep the old one by only modifying it to implement the native
methods which calls out to a new Matrix_Delegate class.

The goal is to not have to maintain the java portion in
sync between the framework and the layoutlib version.

Change-Id: I3e1aefffbae45e91b75331c0c6ff2260323deacd
parent 5da5438e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@
	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
	<classpathentry kind="var" path="ANDROID_SRC/prebuilt/common/layoutlib_api/layoutlib_api-prebuilt.jar"/>
	<classpathentry kind="var" path="ANDROID_SRC/prebuilt/common/kxml2/kxml2-2.3.0.jar" sourcepath="/ANDROID_SRC/dalvik/libcore/xml/src/main/java"/>
	<classpathentry kind="var" path="ANDROID_OUT_FRAMEWORK/layoutlib.jar" sourcepath="/ANDROID_SRC/frameworks/base/core/java"/>
	<classpathentry kind="var" path="ANDROID_PLAT_OUT_FRAMEWORK/layoutlib.jar" sourcepath="/ANDROID_PLAT_SRC/frameworks/base"/>
	<classpathentry kind="var" path="ANDROID_OUT_FRAMEWORK/ninepatch.jar" sourcepath="/ANDROID_SRC/development/tools/ninepatch/src"/>
	<classpathentry kind="output" path="bin"/>
</classpath>
+4 −13
Original line number Diff line number Diff line
@@ -18,13 +18,6 @@ package android.graphics;

import com.android.layoutlib.api.ILayoutLog;

import android.graphics.DrawFilter;
import android.graphics.Picture;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Region;
import android.graphics.Xfermode;
import android.graphics.Paint.Align;
import android.graphics.Paint.FontInfo;
import android.graphics.Paint.Style;
@@ -42,8 +35,6 @@ import java.awt.image.BufferedImage;
import java.util.List;
import java.util.Stack;

import javax.microedition.khronos.opengles.GL;

/**
 * Re-implementation of the Canvas, 100% in java on top of a BufferedImage.
 */
@@ -509,7 +500,7 @@ public class Canvas extends _Original_Canvas {
            // get the Graphics2D current matrix
            AffineTransform currentTx = g.getTransform();
            // get the AffineTransform from the matrix
            AffineTransform matrixTx = matrix.getTransform();
            AffineTransform matrixTx = Matrix_Delegate.getAffineTransform(matrix);

            // combine them so that the matrix is applied after.
            currentTx.preConcatenate(matrixTx);
@@ -969,9 +960,9 @@ public class Canvas extends _Original_Canvas {
        Graphics2D g = getGraphics2d();

        // and apply the matrix
        g.setTransform(matrix.getTransform());
        g.setTransform(Matrix_Delegate.getAffineTransform(matrix));

        if (mLogger != null && matrix.hasPerspective()) {
        if (mLogger != null && Matrix_Delegate.hasPerspective(matrix)) {
            mLogger.warning("android.graphics.Canvas#setMatrix(android.graphics.Matrix) only supports affine transformations in the Layout Editor.");
        }
    }
@@ -987,7 +978,7 @@ public class Canvas extends _Original_Canvas {
        // get its current matrix
        AffineTransform currentTx = g.getTransform();
        // get the AffineTransform of the given matrix
        AffineTransform matrixTx = matrix.getTransform();
        AffineTransform matrixTx = Matrix_Delegate.getAffineTransform(matrix);

        // combine them so that the given matrix is applied after.
        currentTx.preConcatenate(matrixTx);
Loading