Title: [141284] trunk/Source/WebKit/blackberry
Revision
141284
Author
[email protected]
Date
2013-01-30 10:52:42 -0800 (Wed, 30 Jan 2013)

Log Message

[BlackBerry] Screenshot is clipped when content is smaller than the desintation size
https://bugs.webkit.org/show_bug.cgi?id=107735

Patch by Ed Baker <[email protected]> on 2013-01-30
Reviewed by Rob Buis.

Internal PR #284662
Don't scale the transformed content rect when the content is smaller than the destination
size. Scale the graphics context when it has a scale factor that isn't 1.0.

Internally reviewed by Andrew Lo

* Api/BackingStore.cpp:
(BlackBerry::WebKit::BackingStorePrivate::renderContents):

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/Api/BackingStore.cpp (141283 => 141284)


--- trunk/Source/WebKit/blackberry/Api/BackingStore.cpp	2013-01-30 18:52:38 UTC (rev 141283)
+++ trunk/Source/WebKit/blackberry/Api/BackingStore.cpp	2013-01-30 18:52:42 UTC (rev 141284)
@@ -1912,18 +1912,20 @@
     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) {
+    // Don't scale the transformed content rect when the content is smaller than the destination
+    if (widthScale < 1.0 && heightScale < 1.0) {
         TransformationMatrix matrix;
         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(std::max(1.0 / widthScale, 1.0 / heightScale)));
         transformedContentsRect.inflate(atLeastOneDevicePixel);
-        graphicsContext.scale(FloatSize(widthScale, heightScale));
     }
 
+    if (widthScale != 1.0 && heightScale != 1.0)
+        graphicsContext.scale(FloatSize(widthScale, heightScale));
+
     graphicsContext.clip(transformedContentsRect);
     m_client->frame()->view()->paintContents(&graphicsContext, transformedContentsRect);
 

Modified: trunk/Source/WebKit/blackberry/ChangeLog (141283 => 141284)


--- trunk/Source/WebKit/blackberry/ChangeLog	2013-01-30 18:52:38 UTC (rev 141283)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2013-01-30 18:52:42 UTC (rev 141284)
@@ -1,3 +1,19 @@
+2013-01-30  Ed Baker  <[email protected]>
+
+        [BlackBerry] Screenshot is clipped when content is smaller than the desintation size
+        https://bugs.webkit.org/show_bug.cgi?id=107735
+
+        Reviewed by Rob Buis.
+
+        Internal PR #284662
+        Don't scale the transformed content rect when the content is smaller than the destination
+        size. Scale the graphics context when it has a scale factor that isn't 1.0.
+
+        Internally reviewed by Andrew Lo
+
+        * Api/BackingStore.cpp:
+        (BlackBerry::WebKit::BackingStorePrivate::renderContents):
+
 2013-01-30  Xiaobo Wang  <[email protected]>
 
         [BlackBerry] Webpage was cut off after rotating to landscape and then rotating back to portrait on specific website
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to