Loading tools/layoutlib/bridge/src/android/graphics/Canvas.java +28 −16 Original line number Diff line number Diff line Loading @@ -236,10 +236,15 @@ public class Canvas extends _Original_Canvas { */ @Override public int save() { // get the current save count int count = mGraphicsStack.size(); // create a new graphics and add it to the stack Graphics2D g = (Graphics2D)getGraphics2d().create(); mGraphicsStack.push(g); return mGraphicsStack.size() - 1; // return the old save count return count; } /* (non-Javadoc) Loading Loading @@ -274,10 +279,9 @@ public class Canvas extends _Original_Canvas { */ @Override public int getSaveCount() { return mGraphicsStack.size() - 1; return mGraphicsStack.size(); } /* (non-Javadoc) * @see android.graphics.Canvas#clipRect(float, float, float, float, android.graphics.Region.Op) */ Loading Loading @@ -953,10 +957,6 @@ public class Canvas extends _Original_Canvas { */ @Override public void setMatrix(Matrix matrix) { // since SetMatrix *replaces* all the other transformation, we have to restore/save restore(); save(); // get the new current graphics Graphics2D g = getGraphics2d(); Loading @@ -968,6 +968,27 @@ public class Canvas extends _Original_Canvas { } } /* (non-Javadoc) * @see android.graphics.Canvas#concat(android.graphics.Matrix) */ @Override public void concat(Matrix matrix) { // get the current top graphics2D object. Graphics2D g = getGraphics2d(); // get its current matrix AffineTransform currentTx = g.getTransform(); // get the AffineTransform of the given matrix AffineTransform matrixTx = matrix.getTransform(); // combine them so that the given matrix is applied after. currentTx.preConcatenate(matrixTx); // give it to the graphics2D as a new matrix replacing all previous transform g.setTransform(currentTx); } // -------------------- /* (non-Javadoc) Loading Loading @@ -1007,15 +1028,6 @@ public class Canvas extends _Original_Canvas { return super.clipRegion(region); } /* (non-Javadoc) * @see android.graphics.Canvas#concat(android.graphics.Matrix) */ @Override public void concat(Matrix matrix) { // TODO Auto-generated method stub super.concat(matrix); } /* (non-Javadoc) * @see android.graphics.Canvas#drawArc(android.graphics.RectF, float, float, boolean, android.graphics.Paint) */ Loading tools/layoutlib/bridge/src/android/graphics/Matrix.java +6 −2 Original line number Diff line number Diff line Loading @@ -87,8 +87,12 @@ public class Matrix extends _Original_Matrix { } public AffineTransform getTransform() { return new AffineTransform(mValues[0], mValues[1], mValues[2], mValues[3], mValues[4], mValues[5]); // the AffineTransform constructor takes the value in a different order // for a matrix [ 0 1 2 ] // [ 3 4 5 ] // the order is 0, 3, 1, 4, 2, 5... return new AffineTransform(mValues[0], mValues[3], mValues[1], mValues[4], mValues[2], mValues[5]); } public boolean hasPerspective() { Loading Loading
tools/layoutlib/bridge/src/android/graphics/Canvas.java +28 −16 Original line number Diff line number Diff line Loading @@ -236,10 +236,15 @@ public class Canvas extends _Original_Canvas { */ @Override public int save() { // get the current save count int count = mGraphicsStack.size(); // create a new graphics and add it to the stack Graphics2D g = (Graphics2D)getGraphics2d().create(); mGraphicsStack.push(g); return mGraphicsStack.size() - 1; // return the old save count return count; } /* (non-Javadoc) Loading Loading @@ -274,10 +279,9 @@ public class Canvas extends _Original_Canvas { */ @Override public int getSaveCount() { return mGraphicsStack.size() - 1; return mGraphicsStack.size(); } /* (non-Javadoc) * @see android.graphics.Canvas#clipRect(float, float, float, float, android.graphics.Region.Op) */ Loading Loading @@ -953,10 +957,6 @@ public class Canvas extends _Original_Canvas { */ @Override public void setMatrix(Matrix matrix) { // since SetMatrix *replaces* all the other transformation, we have to restore/save restore(); save(); // get the new current graphics Graphics2D g = getGraphics2d(); Loading @@ -968,6 +968,27 @@ public class Canvas extends _Original_Canvas { } } /* (non-Javadoc) * @see android.graphics.Canvas#concat(android.graphics.Matrix) */ @Override public void concat(Matrix matrix) { // get the current top graphics2D object. Graphics2D g = getGraphics2d(); // get its current matrix AffineTransform currentTx = g.getTransform(); // get the AffineTransform of the given matrix AffineTransform matrixTx = matrix.getTransform(); // combine them so that the given matrix is applied after. currentTx.preConcatenate(matrixTx); // give it to the graphics2D as a new matrix replacing all previous transform g.setTransform(currentTx); } // -------------------- /* (non-Javadoc) Loading Loading @@ -1007,15 +1028,6 @@ public class Canvas extends _Original_Canvas { return super.clipRegion(region); } /* (non-Javadoc) * @see android.graphics.Canvas#concat(android.graphics.Matrix) */ @Override public void concat(Matrix matrix) { // TODO Auto-generated method stub super.concat(matrix); } /* (non-Javadoc) * @see android.graphics.Canvas#drawArc(android.graphics.RectF, float, float, boolean, android.graphics.Paint) */ Loading
tools/layoutlib/bridge/src/android/graphics/Matrix.java +6 −2 Original line number Diff line number Diff line Loading @@ -87,8 +87,12 @@ public class Matrix extends _Original_Matrix { } public AffineTransform getTransform() { return new AffineTransform(mValues[0], mValues[1], mValues[2], mValues[3], mValues[4], mValues[5]); // the AffineTransform constructor takes the value in a different order // for a matrix [ 0 1 2 ] // [ 3 4 5 ] // the order is 0, 3, 1, 4, 2, 5... return new AffineTransform(mValues[0], mValues[3], mValues[1], mValues[4], mValues[2], mValues[5]); } public boolean hasPerspective() { Loading