Merge "Replace native crash with IAE when calling picture.draw() w/ a HW canvas" into lmp-dev
This commit is contained in:
@@ -799,28 +799,6 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
// TODO: Implement rendering
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawPicture(Picture picture, Rect dst) {
|
||||
save();
|
||||
translate(dst.left, dst.top);
|
||||
if (picture.getWidth() > 0 && picture.getHeight() > 0) {
|
||||
scale(dst.width() / picture.getWidth(), dst.height() / picture.getHeight());
|
||||
}
|
||||
drawPicture(picture);
|
||||
restore();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawPicture(Picture picture, RectF dst) {
|
||||
save();
|
||||
translate(dst.left, dst.top);
|
||||
if (picture.getWidth() > 0 && picture.getHeight() > 0) {
|
||||
scale(dst.width() / picture.getWidth(), dst.height() / picture.getHeight());
|
||||
}
|
||||
drawPicture(picture);
|
||||
restore();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawPoint(float x, float y, Paint paint) {
|
||||
float[] point = getPointStorage();
|
||||
|
||||
@@ -203,7 +203,7 @@ public class Canvas {
|
||||
*/
|
||||
public void setBitmap(@Nullable Bitmap bitmap) {
|
||||
if (isHardwareAccelerated()) {
|
||||
throw new RuntimeException("Can't set a bitmap device on a GL canvas");
|
||||
throw new RuntimeException("Can't set a bitmap device on a HW accelerated canvas");
|
||||
}
|
||||
|
||||
if (bitmap == null) {
|
||||
|
||||
@@ -122,6 +122,11 @@ public class Picture {
|
||||
* @param canvas The picture is drawn to this canvas
|
||||
*/
|
||||
public void draw(Canvas canvas) {
|
||||
if (canvas.isHardwareAccelerated()) {
|
||||
throw new IllegalArgumentException(
|
||||
"Picture playback is only supported on software canvas.");
|
||||
}
|
||||
|
||||
if (mRecordingCanvas != null) {
|
||||
endRecording();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user