diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-05-18 14:03:11 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-05-18 14:03:11 +0200 |
commit | 8d473cf9743f1d30a16a27114e93bd5af5648d23 (patch) | |
tree | cdca40d0353886b3ca52f33a2d7b8f1c0011aafc /Source/WebKit/blackberry/Api/BackingStore.cpp | |
parent | 1b914638db989aaa98631a1c1e02c7b2d44805d8 (diff) | |
download | qtwebkit-8d473cf9743f1d30a16a27114e93bd5af5648d23.tar.gz |
Imported WebKit commit 1350e72f7345ced9da2bd9980deeeb5a8d62fab4 (http://svn.webkit.org/repository/webkit/trunk@117578)
Weekly snapshot
Diffstat (limited to 'Source/WebKit/blackberry/Api/BackingStore.cpp')
-rw-r--r-- | Source/WebKit/blackberry/Api/BackingStore.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/Source/WebKit/blackberry/Api/BackingStore.cpp b/Source/WebKit/blackberry/Api/BackingStore.cpp index ddc873fe0..092fe4c78 100644 --- a/Source/WebKit/blackberry/Api/BackingStore.cpp +++ b/Source/WebKit/blackberry/Api/BackingStore.cpp @@ -2214,12 +2214,15 @@ Platform::IntRect BackingStorePrivate::tileRect() return Platform::IntRect(0, 0, tileWidth(), tileHeight()); } -void BackingStorePrivate::renderContents(BlackBerry::Platform::Graphics::Drawable* drawable, - double scale, - const Platform::IntRect& contentsRect) const +void BackingStorePrivate::renderContents(Platform::Graphics::Drawable* drawable, + const Platform::IntRect& contentsRect, + const Platform::IntSize& destinationSize) const { if (!drawable || contentsRect.isEmpty()) return; + + requestLayoutIfNeeded(); + PlatformGraphicsContext* platformGraphicsContext = SurfacePool::globalSurfacePool()->createPlatformGraphicsContext(drawable); GraphicsContext graphicsContext(platformGraphicsContext); @@ -2227,17 +2230,19 @@ void BackingStorePrivate::renderContents(BlackBerry::Platform::Graphics::Drawabl WebCore::IntRect transformedContentsRect(contentsRect.x(), contentsRect.y(), contentsRect.width(), contentsRect.height()); - if (scale != 1.0) { + float widthScale = static_cast<float>(destinationSize.width()) / contentsRect.width(); + float heightScale = static_cast<float>(destinationSize.height()) / contentsRect.height(); + + if (widthScale != 1.0 && heightScale != 1.0) { TransformationMatrix matrix; - matrix.scale(1.0 / scale); + matrix.scaleNonUniform(1.0 / widthScale, 1.0 / heightScale); transformedContentsRect = matrix.mapRect(transformedContentsRect); // We extract from the contentsRect but draw a slightly larger region than // we were told to, in order to avoid pixels being rendered only partially. - const int atLeastOneDevicePixel = static_cast<int>(ceilf(1.0 / scale)); + const int atLeastOneDevicePixel = static_cast<int>(ceilf(std::max(1.0 / widthScale, 1.0 / heightScale))); transformedContentsRect.inflate(atLeastOneDevicePixel); - - graphicsContext.scale(FloatSize(scale, scale)); + graphicsContext.scale(FloatSize(widthScale, heightScale)); } graphicsContext.clip(transformedContentsRect); @@ -2834,9 +2839,9 @@ Platform::Graphics::Buffer* BackingStorePrivate::buffer() const return 0; } -void BackingStore::drawContents(BlackBerry::Platform::Graphics::Drawable* drawable, double scale, const Platform::IntRect& contentsRect) +void BackingStore::drawContents(Platform::Graphics::Drawable* drawable, const Platform::IntRect& contentsRect, const Platform::IntSize& destinationSize) { - d->renderContents(drawable, scale, contentsRect); + d->renderContents(drawable, contentsRect, destinationSize); } } |