diff options
author | Mike Reed <> | 2009-03-30 08:35:27 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-30 08:35:27 -0700 |
commit | fb34b333c6e0808e888c8d327875e5369a3809d3 (patch) | |
tree | 62cb82bb430c4e0258f3d2e9cd93220d3506b426 /WebCore | |
parent | 30f71344fb8f892250c0076446399a781b256051 (diff) | |
download | external_webkit-fb34b333c6e0808e888c8d327875e5369a3809d3.zip external_webkit-fb34b333c6e0808e888c8d327875e5369a3809d3.tar.gz external_webkit-fb34b333c6e0808e888c8d327875e5369a3809d3.tar.bz2 |
AI 143477: respect the srcRect parameter in drawPattern, so we can correctly show nineslice images
BUG=1745838
Automated import of CL 143477
Diffstat (limited to 'WebCore')
-rw-r--r-- | WebCore/platform/graphics/android/ImageAndroid.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/WebCore/platform/graphics/android/ImageAndroid.cpp b/WebCore/platform/graphics/android/ImageAndroid.cpp index 6997a9e..f750781 100644 --- a/WebCore/platform/graphics/android/ImageAndroid.cpp +++ b/WebCore/platform/graphics/android/ImageAndroid.cpp @@ -213,7 +213,7 @@ void BitmapImage::setURL(const String& str) /////////////////////////////////////////////////////////////////////////////// -void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& tileRect, +void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& srcRect, const TransformationMatrix& patternTransform, const FloatPoint& phase, CompositeOperator compositeOp, const FloatRect& destRect) @@ -224,8 +224,8 @@ void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& tileRect, } // in case we get called with an incomplete bitmap - const SkBitmap& bitmap = image->bitmap(); - if (bitmap.getPixels() == NULL && bitmap.pixelRef() == NULL) { + const SkBitmap& origBitmap = image->bitmap(); + if (origBitmap.getPixels() == NULL && origBitmap.pixelRef() == NULL) { return; } @@ -234,7 +234,15 @@ void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& tileRect, if (dstR.isEmpty()) { return; } - + + // now extract the proper subset of the src image + SkBitmap bitmap; + SkIRect srcR; + if (!origBitmap.extractSubset(&bitmap, *android_setrect(&srcR, srcRect))) { + SkDebugf("--- Image::drawPattern calling extractSubset failed\n"); + return; + } + SkCanvas* canvas = ctxt->platformContext()->mCanvas; SkPaint paint; |