⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 102198 in webkit


Ignore:
Timestamp:
Dec 6, 2011, 5:23:39 PM (15 years ago)
Author:
Lucas Forschler
Message:

Merged r97191.

Location:
branches/safari-534.53-branch/Source/WebKit2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-534.53-branch/Source/WebKit2/ChangeLog

    r102197 r102198  
     12011-12-06  Lucas Forschler  <lforschler@apple.com>
     2
     3    Merge 97191
     4
     5    2011-10-11  Beth Dakin  <bdakin@apple.com>
     6
     7            https://bugs.webkit.org/show_bug.cgi?id=69874
     8            WebKit2 snapshot APIs should take the device scale factor into account
     9            -and corresponding-
     10            <rdar://problem/10269112>
     11
     12            Reviewed by Darin Adler.
     13
     14            Add the deviceScaleFactor as a scale on the snapshot's context to create a
     15            snapshot of the appropriate resolution. This matches the manner in which we scale
     16            the context in DrawingAreaImpl::display().
     17            * WebProcess/WebPage/WebPage.cpp:
     18            (WebKit::WebPage::snapshotInViewCoordinates):
     19            (WebKit::WebPage::scaledSnapshotInDocumentCoordinates):
     20
    1212011-12-06  Lucas Forschler  <lforschler@apple.com>
    222
  • branches/safari-534.53-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r102197 r102198  
    871871        return 0;
    872872
    873     RefPtr<WebImage> snapshot = WebImage::create(rect.size(), options);
     873    IntSize bitmapSize = rect.size();
     874    float deviceScaleFactor = corePage()->deviceScaleFactor();
     875    bitmapSize.scale(deviceScaleFactor);
     876
     877    RefPtr<WebImage> snapshot = WebImage::create(bitmapSize, options);
    874878    if (!snapshot->bitmap())
    875879        return 0;
    876880   
    877881    OwnPtr<WebCore::GraphicsContext> graphicsContext = snapshot->bitmap()->createGraphicsContext();
     882    graphicsContext->scale(FloatSize(deviceScaleFactor, deviceScaleFactor));
    878883    graphicsContext->translate(-rect.x(), -rect.y());
    879884
     
    894899        return 0;
    895900
    896     IntSize size(ceil(rect.width() * scaleFactor), ceil(rect.height() * scaleFactor));
     901    float combinedScaleFactor = scaleFactor * corePage()->deviceScaleFactor();
     902    IntSize size(ceil(rect.width() * combinedScaleFactor), ceil(rect.height() * combinedScaleFactor));
    897903    RefPtr<WebImage> snapshot = WebImage::create(size, options);
    898904    if (!snapshot->bitmap())
     
    900906
    901907    OwnPtr<WebCore::GraphicsContext> graphicsContext = snapshot->bitmap()->createGraphicsContext();
    902     graphicsContext->scale(FloatSize(scaleFactor, scaleFactor));
     908    graphicsContext->scale(FloatSize(combinedScaleFactor, combinedScaleFactor));
    903909    graphicsContext->translate(-rect.x(), -rect.y());
    904910
Note: See TracChangeset for help on using the changeset viewer.