From 285c0572401578498b0ccb0c3da0828544f2d085 Mon Sep 17 00:00:00 2001 From: Chris Craik Date: Tue, 16 Oct 2012 14:40:03 -0700 Subject: Add src rect ptr null check bug:7339156 Also fix compilation issue for USE_RECORDING_CONTEXT = false, a flag used in debugging. Change-Id: I63924c7551c82a10b0c67cbb44b9b8961551decd --- .../graphics/android/context/PlatformGraphicsContextRecording.cpp | 6 ++++-- .../graphics/android/context/PlatformGraphicsContextRecording.h | 2 +- Source/WebKit/android/jni/PicturePile.cpp | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp index a410ba9..10bf363 100644 --- a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp +++ b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp @@ -776,13 +776,15 @@ void PlatformGraphicsContextRecording::drawBitmapPattern( } void PlatformGraphicsContextRecording::drawBitmapRect(const SkBitmap& bitmap, - const SkIRect* src, const SkRect& dst, + const SkIRect* srcPtr, const SkRect& dst, CompositeOperator op) { float widthScale = dst.width() == 0 ? 1 : bitmap.width() / dst.width(); float heightScale = dst.height() == 0 ? 1 : bitmap.height() / dst.height(); m_maxZoomScale = std::max(m_maxZoomScale, std::max(widthScale, heightScale)); - appendDrawingOperation(NEW_OP(DrawBitmapRect)(bitmap, *src, dst, op), dst); + // null src implies full bitmap as source rect + SkIRect src = srcPtr ? *srcPtr : SkIRect::MakeWH(bitmap.width(), bitmap.height()); + appendDrawingOperation(NEW_OP(DrawBitmapRect)(bitmap, src, dst, op), dst); } void PlatformGraphicsContextRecording::drawConvexPolygon(size_t numPoints, diff --git a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.h b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.h index a8e69f5..eefd270 100644 --- a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.h +++ b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.h @@ -112,7 +112,7 @@ public: virtual void clearRect(const FloatRect& rect); virtual void drawBitmapPattern(const SkBitmap& bitmap, const SkMatrix& matrix, CompositeOperator compositeOp, const FloatRect& destRect); - virtual void drawBitmapRect(const SkBitmap& bitmap, const SkIRect* src, + virtual void drawBitmapRect(const SkBitmap& bitmap, const SkIRect* srcPtr, const SkRect& dst, CompositeOperator op = CompositeSourceOver); virtual void drawConvexPolygon(size_t numPoints, const FloatPoint* points, bool shouldAntialias); diff --git a/Source/WebKit/android/jni/PicturePile.cpp b/Source/WebKit/android/jni/PicturePile.cpp index 174980a..44cfccb 100644 --- a/Source/WebKit/android/jni/PicturePile.cpp +++ b/Source/WebKit/android/jni/PicturePile.cpp @@ -365,7 +365,7 @@ Picture* PicturePile::recordPicture(PicturePainter* painter, PictureContainer& p painter->paintContents(&gc, drawArea); // TODO: consider paint-time checking for these with SkPicture painting? - pc.maxZoomScale = FLOAT_MAX; + pc.maxZoomScale = 1e6; SkSafeUnref(canvas); picture->endRecording(); -- cgit v1.1