Loading tests/HwAccelerationTest/res/layout/_lines.xml 0 → 100644 +6 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <com.android.test.hwui.LinesActivity.LinesView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> </com.android.test.hwui.LinesActivity.LinesView> tests/HwAccelerationTest/src/com/android/test/hwui/LinesActivity.java +8 −8 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ public class LinesActivity extends Activity { setContentView(view); } static class LinesView extends View { public static class LinesView extends View { private static final boolean LINE_AA = false; private final Bitmap mBitmap1; Loading @@ -47,7 +47,7 @@ public class LinesActivity extends Activity { private final Paint mAlphaPaint; private final Paint mHairLinePaint; LinesView(Context c) { public LinesView(Context c) { super(c); mBitmap1 = BitmapFactory.decodeResource(c.getResources(), R.drawable.sunset1); Loading tests/HwAccelerationTest/src/com/android/test/hwui/ShadersActivity.java +15 −12 Original line number Diff line number Diff line Loading @@ -52,6 +52,9 @@ public class ShadersActivity extends Activity { private LinearGradient mDiagGradient; private LinearGradient mVertGradient; private Bitmap mTexture; private Matrix mMtx1; private Matrix mMtx2; private Matrix mMtx3; public ShadersView(Context c) { super(c); Loading @@ -67,24 +70,24 @@ public class ShadersActivity extends Activity { mTranslatedShader = new BitmapShader(mTexture, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT); Matrix m1 = new Matrix(); m1.setTranslate(mTexWidth / 2.0f, mTexHeight / 2.0f); m1.postRotate(45, 0, 0); mTranslatedShader.setLocalMatrix(m1); mMtx1 = new Matrix(); mMtx1.setTranslate(mTexWidth / 2.0f, mTexHeight / 2.0f); mMtx1.postRotate(45, 0, 0); mTranslatedShader.setLocalMatrix(mMtx1); mScaledShader = new BitmapShader(mTexture, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR); Matrix m2 = new Matrix(); m2.setScale(0.5f, 0.5f); mScaledShader.setLocalMatrix(m2); mMtx2 = new Matrix(); mMtx2.setScale(0.5f, 0.5f); mScaledShader.setLocalMatrix(mMtx2); mHorGradient = new LinearGradient(0.0f, 0.0f, 1.0f, 0.0f, Color.RED, Color.GREEN, Shader.TileMode.CLAMP); Matrix m3 = new Matrix(); m3.setScale(mDrawHeight, 1.0f); m3.postRotate(-90.0f); m3.postTranslate(0.0f, mDrawHeight); mHorGradient.setLocalMatrix(m3); mMtx3 = new Matrix(); mMtx3.setScale(mDrawHeight, 1.0f); mMtx3.postRotate(-90.0f); mMtx3.postTranslate(0.0f, mDrawHeight); mHorGradient.setLocalMatrix(mMtx3); mDiagGradient = new LinearGradient(0.0f, 0.0f, mDrawWidth / 1.5f, mDrawHeight, Color.BLUE, Color.MAGENTA, Shader.TileMode.CLAMP); Loading tools/layoutlib/bridge/src/android/graphics/AvoidXfermode_Delegate.java +1 −1 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ public class AvoidXfermode_Delegate extends Xfermode_Delegate { // ---- Public Helper methods ---- @Override public Composite getComposite() { public Composite getComposite(int alpha) { // FIXME return null; } Loading tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java +26 −10 Original line number Diff line number Diff line Loading @@ -54,9 +54,11 @@ public final class Bitmap_Delegate { // ---- delegate helper data ---- // ---- delegate data ---- private final Config mConfig; private BufferedImage mImage; private boolean mHasAlpha = true; // ---- Public Helper methods ---- /** Loading Loading @@ -86,7 +88,7 @@ public final class Bitmap_Delegate { public static Bitmap createBitmap(File input, boolean isMutable, ResourceDensity density) throws IOException { // create a delegate with the content of the file. Bitmap_Delegate delegate = new Bitmap_Delegate(ImageIO.read(input)); Bitmap_Delegate delegate = new Bitmap_Delegate(ImageIO.read(input), Config.ARGB_8888); return createBitmap(delegate, isMutable, density.getDpi()); } Loading @@ -104,7 +106,7 @@ public final class Bitmap_Delegate { public static Bitmap createBitmap(InputStream input, boolean isMutable, ResourceDensity density) throws IOException { // create a delegate with the content of the stream. Bitmap_Delegate delegate = new Bitmap_Delegate(ImageIO.read(input)); Bitmap_Delegate delegate = new Bitmap_Delegate(ImageIO.read(input), Config.ARGB_8888); return createBitmap(delegate, isMutable, density.getDpi()); } Loading @@ -122,7 +124,7 @@ public final class Bitmap_Delegate { public static Bitmap createBitmap(BufferedImage image, boolean isMutable, ResourceDensity density) throws IOException { // create a delegate with the given image. Bitmap_Delegate delegate = new Bitmap_Delegate(image); Bitmap_Delegate delegate = new Bitmap_Delegate(image, Config.ARGB_8888); return createBitmap(delegate, isMutable, density.getDpi()); } Loading Loading @@ -163,6 +165,15 @@ public final class Bitmap_Delegate { return mImage; } /** * Returns the Android bitmap config. Note that this not the config of the underlying * Java2D bitmap. */ public Config getConfig() { return mConfig; } // ---- native methods ---- /*package*/ static Bitmap nativeCreate(int[] colors, int offset, int stride, int width, Loading @@ -175,7 +186,7 @@ public final class Bitmap_Delegate { // FIXME fill the bitmap! // create a delegate with the content of the stream. Bitmap_Delegate delegate = new Bitmap_Delegate(image); Bitmap_Delegate delegate = new Bitmap_Delegate(image, Config.sConfigs[nativeConfig]); return createBitmap(delegate, mutable, Bitmap.getDefaultDensity()); } Loading Loading @@ -211,10 +222,7 @@ public final class Bitmap_Delegate { Graphics2D g = image.createGraphics(); try { if (delegate.mHasAlpha == false) { color |= color & 0xFF000000; } g.setColor(new java.awt.Color(color)); g.setColor(new java.awt.Color(color, delegate.mHasAlpha)); g.fillRect(0, 0, image.getWidth(), image.getHeight()); } finally { Loading Loading @@ -256,7 +264,14 @@ public final class Bitmap_Delegate { } /*package*/ static int nativeConfig(int nativeBitmap) { return Config.ARGB_8888.nativeInt; // get the delegate from the native int. Bitmap_Delegate delegate = sManager.getDelegate(nativeBitmap); if (delegate == null) { assert false; return 0; } return delegate.mConfig.nativeInt; } /*package*/ static boolean nativeHasAlpha(int nativeBitmap) { Loading Loading @@ -355,8 +370,9 @@ public final class Bitmap_Delegate { // ---- Private delegate/helper methods ---- private Bitmap_Delegate(BufferedImage image) { private Bitmap_Delegate(BufferedImage image, Config config) { mImage = image; mConfig = config; } private static Bitmap createBitmap(Bitmap_Delegate delegate, boolean isMutable, int density) { Loading Loading
tests/HwAccelerationTest/res/layout/_lines.xml 0 → 100644 +6 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <com.android.test.hwui.LinesActivity.LinesView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> </com.android.test.hwui.LinesActivity.LinesView>
tests/HwAccelerationTest/src/com/android/test/hwui/LinesActivity.java +8 −8 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ public class LinesActivity extends Activity { setContentView(view); } static class LinesView extends View { public static class LinesView extends View { private static final boolean LINE_AA = false; private final Bitmap mBitmap1; Loading @@ -47,7 +47,7 @@ public class LinesActivity extends Activity { private final Paint mAlphaPaint; private final Paint mHairLinePaint; LinesView(Context c) { public LinesView(Context c) { super(c); mBitmap1 = BitmapFactory.decodeResource(c.getResources(), R.drawable.sunset1); Loading
tests/HwAccelerationTest/src/com/android/test/hwui/ShadersActivity.java +15 −12 Original line number Diff line number Diff line Loading @@ -52,6 +52,9 @@ public class ShadersActivity extends Activity { private LinearGradient mDiagGradient; private LinearGradient mVertGradient; private Bitmap mTexture; private Matrix mMtx1; private Matrix mMtx2; private Matrix mMtx3; public ShadersView(Context c) { super(c); Loading @@ -67,24 +70,24 @@ public class ShadersActivity extends Activity { mTranslatedShader = new BitmapShader(mTexture, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT); Matrix m1 = new Matrix(); m1.setTranslate(mTexWidth / 2.0f, mTexHeight / 2.0f); m1.postRotate(45, 0, 0); mTranslatedShader.setLocalMatrix(m1); mMtx1 = new Matrix(); mMtx1.setTranslate(mTexWidth / 2.0f, mTexHeight / 2.0f); mMtx1.postRotate(45, 0, 0); mTranslatedShader.setLocalMatrix(mMtx1); mScaledShader = new BitmapShader(mTexture, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR); Matrix m2 = new Matrix(); m2.setScale(0.5f, 0.5f); mScaledShader.setLocalMatrix(m2); mMtx2 = new Matrix(); mMtx2.setScale(0.5f, 0.5f); mScaledShader.setLocalMatrix(mMtx2); mHorGradient = new LinearGradient(0.0f, 0.0f, 1.0f, 0.0f, Color.RED, Color.GREEN, Shader.TileMode.CLAMP); Matrix m3 = new Matrix(); m3.setScale(mDrawHeight, 1.0f); m3.postRotate(-90.0f); m3.postTranslate(0.0f, mDrawHeight); mHorGradient.setLocalMatrix(m3); mMtx3 = new Matrix(); mMtx3.setScale(mDrawHeight, 1.0f); mMtx3.postRotate(-90.0f); mMtx3.postTranslate(0.0f, mDrawHeight); mHorGradient.setLocalMatrix(mMtx3); mDiagGradient = new LinearGradient(0.0f, 0.0f, mDrawWidth / 1.5f, mDrawHeight, Color.BLUE, Color.MAGENTA, Shader.TileMode.CLAMP); Loading
tools/layoutlib/bridge/src/android/graphics/AvoidXfermode_Delegate.java +1 −1 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ public class AvoidXfermode_Delegate extends Xfermode_Delegate { // ---- Public Helper methods ---- @Override public Composite getComposite() { public Composite getComposite(int alpha) { // FIXME return null; } Loading
tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java +26 −10 Original line number Diff line number Diff line Loading @@ -54,9 +54,11 @@ public final class Bitmap_Delegate { // ---- delegate helper data ---- // ---- delegate data ---- private final Config mConfig; private BufferedImage mImage; private boolean mHasAlpha = true; // ---- Public Helper methods ---- /** Loading Loading @@ -86,7 +88,7 @@ public final class Bitmap_Delegate { public static Bitmap createBitmap(File input, boolean isMutable, ResourceDensity density) throws IOException { // create a delegate with the content of the file. Bitmap_Delegate delegate = new Bitmap_Delegate(ImageIO.read(input)); Bitmap_Delegate delegate = new Bitmap_Delegate(ImageIO.read(input), Config.ARGB_8888); return createBitmap(delegate, isMutable, density.getDpi()); } Loading @@ -104,7 +106,7 @@ public final class Bitmap_Delegate { public static Bitmap createBitmap(InputStream input, boolean isMutable, ResourceDensity density) throws IOException { // create a delegate with the content of the stream. Bitmap_Delegate delegate = new Bitmap_Delegate(ImageIO.read(input)); Bitmap_Delegate delegate = new Bitmap_Delegate(ImageIO.read(input), Config.ARGB_8888); return createBitmap(delegate, isMutable, density.getDpi()); } Loading @@ -122,7 +124,7 @@ public final class Bitmap_Delegate { public static Bitmap createBitmap(BufferedImage image, boolean isMutable, ResourceDensity density) throws IOException { // create a delegate with the given image. Bitmap_Delegate delegate = new Bitmap_Delegate(image); Bitmap_Delegate delegate = new Bitmap_Delegate(image, Config.ARGB_8888); return createBitmap(delegate, isMutable, density.getDpi()); } Loading Loading @@ -163,6 +165,15 @@ public final class Bitmap_Delegate { return mImage; } /** * Returns the Android bitmap config. Note that this not the config of the underlying * Java2D bitmap. */ public Config getConfig() { return mConfig; } // ---- native methods ---- /*package*/ static Bitmap nativeCreate(int[] colors, int offset, int stride, int width, Loading @@ -175,7 +186,7 @@ public final class Bitmap_Delegate { // FIXME fill the bitmap! // create a delegate with the content of the stream. Bitmap_Delegate delegate = new Bitmap_Delegate(image); Bitmap_Delegate delegate = new Bitmap_Delegate(image, Config.sConfigs[nativeConfig]); return createBitmap(delegate, mutable, Bitmap.getDefaultDensity()); } Loading Loading @@ -211,10 +222,7 @@ public final class Bitmap_Delegate { Graphics2D g = image.createGraphics(); try { if (delegate.mHasAlpha == false) { color |= color & 0xFF000000; } g.setColor(new java.awt.Color(color)); g.setColor(new java.awt.Color(color, delegate.mHasAlpha)); g.fillRect(0, 0, image.getWidth(), image.getHeight()); } finally { Loading Loading @@ -256,7 +264,14 @@ public final class Bitmap_Delegate { } /*package*/ static int nativeConfig(int nativeBitmap) { return Config.ARGB_8888.nativeInt; // get the delegate from the native int. Bitmap_Delegate delegate = sManager.getDelegate(nativeBitmap); if (delegate == null) { assert false; return 0; } return delegate.mConfig.nativeInt; } /*package*/ static boolean nativeHasAlpha(int nativeBitmap) { Loading Loading @@ -355,8 +370,9 @@ public final class Bitmap_Delegate { // ---- Private delegate/helper methods ---- private Bitmap_Delegate(BufferedImage image) { private Bitmap_Delegate(BufferedImage image, Config config) { mImage = image; mConfig = config; } private static Bitmap createBitmap(Bitmap_Delegate delegate, boolean isMutable, int density) { Loading