diff options
author | Kristian Monsen <kristianm@google.com> | 2010-05-21 16:53:46 +0100 |
---|---|---|
committer | Kristian Monsen <kristianm@google.com> | 2010-05-25 10:24:15 +0100 |
commit | 6c2af9490927c3c5959b5cb07461b646f8b32f6c (patch) | |
tree | f7111b9b22befab472616c1d50ec94eb50f1ec8c /WebCore/platform/graphics/skia | |
parent | a149172322a9067c14e8b474a53e63649aa17cad (diff) | |
download | external_webkit-6c2af9490927c3c5959b5cb07461b646f8b32f6c.zip external_webkit-6c2af9490927c3c5959b5cb07461b646f8b32f6c.tar.gz external_webkit-6c2af9490927c3c5959b5cb07461b646f8b32f6c.tar.bz2 |
Merge WebKit at r59636: Initial merge by git
Change-Id: I59b289c4e6b18425f06ce41cc9d34c522515de91
Diffstat (limited to 'WebCore/platform/graphics/skia')
-rw-r--r-- | WebCore/platform/graphics/skia/ImageSkia.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/WebCore/platform/graphics/skia/ImageSkia.cpp b/WebCore/platform/graphics/skia/ImageSkia.cpp index b1bfbdd..21ba934 100644 --- a/WebCore/platform/graphics/skia/ImageSkia.cpp +++ b/WebCore/platform/graphics/skia/ImageSkia.cpp @@ -346,10 +346,19 @@ void Image::drawPattern(GraphicsContext* context, if (resampling == RESAMPLE_AWESOME) { // Do nice resampling. - SkBitmap resampled = skia::ImageOperations::Resize(srcSubset, - skia::ImageOperations::RESIZE_LANCZOS3, - static_cast<int>(destBitmapWidth), - static_cast<int>(destBitmapHeight)); + SkBitmap resampled; + int width = static_cast<int>(destBitmapWidth); + int height = static_cast<int>(destBitmapHeight); + if (!srcRect.fLeft && !srcRect.fTop + && srcRect.fRight == bitmap->width() && srcRect.fBottom == bitmap->height() + && (bitmap->hasResizedBitmap(width, height) + || bitmap->shouldCacheResampling(width, height, width, height))) { + // resizedBitmap() caches resized image. + resampled = bitmap->resizedBitmap(width, height); + } else { + resampled = skia::ImageOperations::Resize(srcSubset, + skia::ImageOperations::RESIZE_LANCZOS3, width, height); + } shader = SkShader::CreateBitmapShader(resampled, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode); // Since we just resized the bitmap, we need to undo the scale set in |