Loading api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -7605,6 +7605,8 @@ package android.graphics { method public int getHeight(); method public void getMatrix(android.graphics.Matrix); method public final android.graphics.Matrix getMatrix(); method public int getMaximumBitmapHeight(); method public int getMaximumBitmapWidth(); method public int getSaveCount(); method public int getWidth(); method public boolean isHardwareAccelerated(); core/java/android/view/GLES20Canvas.java +13 −0 Original line number Diff line number Diff line Loading @@ -189,6 +189,19 @@ class GLES20Canvas extends HardwareCanvas { return mHeight; } @Override public int getMaximumBitmapWidth() { return nGetMaximumTextureWidth(); } @Override public int getMaximumBitmapHeight() { return nGetMaximumTextureHeight(); } private static native int nGetMaximumTextureWidth(); private static native int nGetMaximumTextureHeight(); /////////////////////////////////////////////////////////////////////////// // Setup /////////////////////////////////////////////////////////////////////////// Loading core/jni/android_view_GLES20Canvas.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -161,6 +161,14 @@ static bool android_view_GLES20Canvas_callDrawGLFunction(JNIEnv* env, jobject cl return renderer->callDrawGLFunction(functor, dirty); } static jint android_view_GLES20Canvas_getMaxTextureWidth(JNIEnv* env, jobject clazz) { return Caches::getInstance().maxTextureSize; } static jint android_view_GLES20Canvas_getMaxTextureHeight(JNIEnv* env, jobject clazz) { return Caches::getInstance().maxTextureSize; } // ---------------------------------------------------------------------------- // State // ---------------------------------------------------------------------------- Loading Loading @@ -803,6 +811,9 @@ static JNINativeMethod gMethods[] = { { "nDrawLayer", "(IIFFI)V", (void*) android_view_GLES20Canvas_drawLayer }, { "nCopyLayer", "(II)Z", (void*) android_view_GLES20Canvas_copyLayer }, { "nGetMaximumTextureWidth", "()I", (void*) android_view_GLES20Canvas_getMaxTextureWidth }, { "nGetMaximumTextureHeight", "()I", (void*) android_view_GLES20Canvas_getMaxTextureHeight }, #endif }; Loading graphics/java/android/graphics/Canvas.java +27 −1 Original line number Diff line number Diff line Loading @@ -74,6 +74,10 @@ public class Canvas { */ public static final int DIRECTION_RTL = 1; // Maximum bitmap size as defined in Skia's native code // (see SkCanvas.cpp, SkDraw.cpp) private static final int MAXMIMUM_BITMAP_SIZE = 32766; // This field is used to finalize the native Canvas properly @SuppressWarnings({"UnusedDeclaration"}) private final CanvasFinalizer mFinalizer; Loading Loading @@ -260,6 +264,28 @@ public class Canvas { mScreenDensity = density; } /** * Returns the maximum allowed width for bitmaps drawn with this canvas. * Attempting to draw with a bitmap wider than this value will result * in an error. * * @see #getMaximumBitmapHeight() */ public int getMaximumBitmapWidth() { return MAXMIMUM_BITMAP_SIZE; } /** * Returns the maximum allowed height for bitmaps drawn with this canvas. * Attempting to draw with a bitmap taller than this value will result * in an error. * * @see #getMaximumBitmapWidth() */ public int getMaximumBitmapHeight() { return MAXMIMUM_BITMAP_SIZE; } // the SAVE_FLAG constants must match their native equivalents /** restore the current matrix when restore() is called */ Loading tests/HwAccelerationTest/AndroidManifest.xml +9 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,15 @@ android:label="HwUi" android:hardwareAccelerated="true"> <activity android:name="MaxBitmapSizeActivity" android:label="_MaxBitmapSize"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="TimeDialogActivity" android:label="_TimeDialog"> Loading Loading
api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -7605,6 +7605,8 @@ package android.graphics { method public int getHeight(); method public void getMatrix(android.graphics.Matrix); method public final android.graphics.Matrix getMatrix(); method public int getMaximumBitmapHeight(); method public int getMaximumBitmapWidth(); method public int getSaveCount(); method public int getWidth(); method public boolean isHardwareAccelerated();
core/java/android/view/GLES20Canvas.java +13 −0 Original line number Diff line number Diff line Loading @@ -189,6 +189,19 @@ class GLES20Canvas extends HardwareCanvas { return mHeight; } @Override public int getMaximumBitmapWidth() { return nGetMaximumTextureWidth(); } @Override public int getMaximumBitmapHeight() { return nGetMaximumTextureHeight(); } private static native int nGetMaximumTextureWidth(); private static native int nGetMaximumTextureHeight(); /////////////////////////////////////////////////////////////////////////// // Setup /////////////////////////////////////////////////////////////////////////// Loading
core/jni/android_view_GLES20Canvas.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -161,6 +161,14 @@ static bool android_view_GLES20Canvas_callDrawGLFunction(JNIEnv* env, jobject cl return renderer->callDrawGLFunction(functor, dirty); } static jint android_view_GLES20Canvas_getMaxTextureWidth(JNIEnv* env, jobject clazz) { return Caches::getInstance().maxTextureSize; } static jint android_view_GLES20Canvas_getMaxTextureHeight(JNIEnv* env, jobject clazz) { return Caches::getInstance().maxTextureSize; } // ---------------------------------------------------------------------------- // State // ---------------------------------------------------------------------------- Loading Loading @@ -803,6 +811,9 @@ static JNINativeMethod gMethods[] = { { "nDrawLayer", "(IIFFI)V", (void*) android_view_GLES20Canvas_drawLayer }, { "nCopyLayer", "(II)Z", (void*) android_view_GLES20Canvas_copyLayer }, { "nGetMaximumTextureWidth", "()I", (void*) android_view_GLES20Canvas_getMaxTextureWidth }, { "nGetMaximumTextureHeight", "()I", (void*) android_view_GLES20Canvas_getMaxTextureHeight }, #endif }; Loading
graphics/java/android/graphics/Canvas.java +27 −1 Original line number Diff line number Diff line Loading @@ -74,6 +74,10 @@ public class Canvas { */ public static final int DIRECTION_RTL = 1; // Maximum bitmap size as defined in Skia's native code // (see SkCanvas.cpp, SkDraw.cpp) private static final int MAXMIMUM_BITMAP_SIZE = 32766; // This field is used to finalize the native Canvas properly @SuppressWarnings({"UnusedDeclaration"}) private final CanvasFinalizer mFinalizer; Loading Loading @@ -260,6 +264,28 @@ public class Canvas { mScreenDensity = density; } /** * Returns the maximum allowed width for bitmaps drawn with this canvas. * Attempting to draw with a bitmap wider than this value will result * in an error. * * @see #getMaximumBitmapHeight() */ public int getMaximumBitmapWidth() { return MAXMIMUM_BITMAP_SIZE; } /** * Returns the maximum allowed height for bitmaps drawn with this canvas. * Attempting to draw with a bitmap taller than this value will result * in an error. * * @see #getMaximumBitmapWidth() */ public int getMaximumBitmapHeight() { return MAXMIMUM_BITMAP_SIZE; } // the SAVE_FLAG constants must match their native equivalents /** restore the current matrix when restore() is called */ Loading
tests/HwAccelerationTest/AndroidManifest.xml +9 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,15 @@ android:label="HwUi" android:hardwareAccelerated="true"> <activity android:name="MaxBitmapSizeActivity" android:label="_MaxBitmapSize"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="TimeDialogActivity" android:label="_TimeDialog"> Loading