Changeset 97191 in webkit
- Timestamp:
- Oct 11, 2011, 4:05:33 PM (15 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
WebProcess/WebPage/WebPage.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r97188 r97191 1 2011-10-11 Beth Dakin <bdakin@apple.com> 2 3 https://bugs.webkit.org/show_bug.cgi?id=69874 4 WebKit2 snapshot APIs should take the device scale factor into account 5 -and corresponding- 6 <rdar://problem/10269112> 7 8 Reviewed by Darin Adler. 9 10 Add the deviceScaleFactor as a scale on the snapshot's context to create a 11 snapshot of the appropriate resolution. This matches the manner in which we scale 12 the context in DrawingAreaImpl::display(). 13 * WebProcess/WebPage/WebPage.cpp: 14 (WebKit::WebPage::snapshotInViewCoordinates): 15 (WebKit::WebPage::scaledSnapshotInDocumentCoordinates): 16 1 17 2011-10-11 W. James MacLean <wjmaclean@chromium.org> 2 18 -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r97167 r97191 916 916 return 0; 917 917 918 RefPtr<WebImage> snapshot = WebImage::create(rect.size(), options); 918 IntSize bitmapSize = rect.size(); 919 float deviceScaleFactor = corePage()->deviceScaleFactor(); 920 bitmapSize.scale(deviceScaleFactor); 921 922 RefPtr<WebImage> snapshot = WebImage::create(bitmapSize, options); 919 923 if (!snapshot->bitmap()) 920 924 return 0; 921 925 922 926 OwnPtr<WebCore::GraphicsContext> graphicsContext = snapshot->bitmap()->createGraphicsContext(); 927 graphicsContext->scale(FloatSize(deviceScaleFactor, deviceScaleFactor)); 923 928 graphicsContext->translate(-rect.x(), -rect.y()); 924 929 … … 939 944 return 0; 940 945 941 IntSize size(ceil(rect.width() * scaleFactor), ceil(rect.height() * scaleFactor)); 946 float combinedScaleFactor = scaleFactor * corePage()->deviceScaleFactor(); 947 IntSize size(ceil(rect.width() * combinedScaleFactor), ceil(rect.height() * combinedScaleFactor)); 942 948 RefPtr<WebImage> snapshot = WebImage::create(size, options); 943 949 if (!snapshot->bitmap()) … … 945 951 946 952 OwnPtr<WebCore::GraphicsContext> graphicsContext = snapshot->bitmap()->createGraphicsContext(); 947 graphicsContext->scale(FloatSize( scaleFactor, scaleFactor));953 graphicsContext->scale(FloatSize(combinedScaleFactor, combinedScaleFactor)); 948 954 graphicsContext->translate(-rect.x(), -rect.y()); 949 955
Note:
See TracChangeset
for help on using the changeset viewer.