Changeset 107267 in webkit


Ignore:
Timestamp:
Feb 9, 2012 11:35:18 AM (12 years ago)
Author:
mdelaney@apple.com
Message:

HiDPI: WebKit2's link-dragging images are blurry
https://bugs.webkit.org/show_bug.cgi?id=67779

Reviewed by Beth Dakin.

Teach startDrag about the deviceScaleFactor so that it creates
an appropriately scaled bitmap image to ship over.

  • WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:

(WebKit::WebDragClient::startDrag):
(WebKit::convertImageToBitmap):

Have setDragImage assume that it's receiving a bitmap image scaled
up by the deviceScaleFactor that it sees.

  • UIProcess/API/mac/WKView.mm:

(-[WKView _setDragImage:at:linkDrag:]):

Location:
trunk/Source/WebKit2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r107250 r107267  
     12012-02-09  Matthew Delaney  <mdelaney@apple.com>
     2
     3        HiDPI: WebKit2's link-dragging images are blurry
     4        https://bugs.webkit.org/show_bug.cgi?id=67779
     5
     6        Reviewed by Beth Dakin.
     7
     8        Teach startDrag about the deviceScaleFactor so that it creates
     9        an appropriately scaled bitmap image to ship over.
     10        * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
     11        (WebKit::WebDragClient::startDrag):
     12        (WebKit::convertImageToBitmap):
     13
     14        Have setDragImage assume that it's receiving a bitmap image scaled
     15        up by the deviceScaleFactor that it sees.
     16        * UIProcess/API/mac/WKView.mm:
     17        (-[WKView _setDragImage:at:linkDrag:]):
     18
    1192012-02-09  Carlos Garcia Campos  <cgarcia@igalia.com>
    220
  • trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm

    r107017 r107267  
    25622562   
    25632563    _data->_dragHasStarted = YES;
     2564    IntSize size([image size]);
     2565    size.scale(1.0 / [self _intrinsicDeviceScaleFactor]);
     2566    [image setSize:size];
    25642567   
    25652568    // The call to super could release this WKView.
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm

    r97808 r107267  
    4040#import <WebCore/GraphicsContext.h>
    4141#import <WebCore/LegacyWebArchive.h>
     42#import <WebCore/Page.h>
    4243#import <WebCore/RenderImage.h>
    4344#import <WebCore/ResourceHandle.h>
     
    7879namespace WebKit {
    7980
    80 static PassRefPtr<ShareableBitmap> convertImageToBitmap(NSImage *image)
    81 {
    82     RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(IntSize([image size]), ShareableBitmap::SupportsAlpha);
     81static PassRefPtr<ShareableBitmap> convertImageToBitmap(NSImage *image, const IntSize& size)
     82{
     83    RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(size, ShareableBitmap::SupportsAlpha);
    8384    OwnPtr<GraphicsContext> graphicsContext = bitmap->createGraphicsContext();
    8485
     
    9596void WebDragClient::startDrag(RetainPtr<NSImage> image, const IntPoint& point, const IntPoint&, Clipboard*, Frame* frame, bool linkDrag)
    9697{
    97     RefPtr<ShareableBitmap> bitmap = convertImageToBitmap(image.get());
     98    IntSize bitmapSize([image.get() size]);
     99    bitmapSize.scale(frame->page()->deviceScaleFactor());
     100    RefPtr<ShareableBitmap> bitmap = convertImageToBitmap(image.get(), bitmapSize);
    98101    ShareableBitmap::Handle handle;
    99102    if (!bitmap->createHandle(handle))
Note: See TracChangeset for help on using the changeset viewer.