Merge "Add an O-release targetAPI check for Canvas.setBitmap. am: d70695ee34" into oc-dev-plus-aosp
am: 172bd07308
Change-Id: Iddc0babe08b2e1a9abe1bebe117fa66832417cff
This commit is contained in:
@@ -49,6 +49,8 @@ import javax.microedition.khronos.opengles.GL;
|
||||
public class Canvas extends BaseCanvas {
|
||||
/** @hide */
|
||||
public static boolean sCompatibilityRestore = false;
|
||||
/** @hide */
|
||||
public static boolean sCompatibilitySetBitmap = false;
|
||||
|
||||
/** @hide */
|
||||
public long getNativeCanvasWrapper() {
|
||||
@@ -172,6 +174,11 @@ public class Canvas extends BaseCanvas {
|
||||
throw new RuntimeException("Can't set a bitmap device on a HW accelerated canvas");
|
||||
}
|
||||
|
||||
Matrix preservedMatrix = null;
|
||||
if (bitmap != null && sCompatibilitySetBitmap) {
|
||||
preservedMatrix = getMatrix();
|
||||
}
|
||||
|
||||
if (bitmap == null) {
|
||||
nSetBitmap(mNativeCanvasWrapper, null);
|
||||
mDensity = Bitmap.DENSITY_NONE;
|
||||
@@ -185,6 +192,10 @@ public class Canvas extends BaseCanvas {
|
||||
mDensity = bitmap.mDensity;
|
||||
}
|
||||
|
||||
if (preservedMatrix != null) {
|
||||
setMatrix(preservedMatrix);
|
||||
}
|
||||
|
||||
mBitmap = bitmap;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user