X-Git-Url: http://git.webkit.org/?p=WebKit-https.git;a=blobdiff_plain;f=Source%2FWebCore%2Fplatform%2Fchromium%2FDragImageChromiumSkia.cpp;h=dd8ace385c248308fb6b301a42efa89e7364f325;hp=40f8925a540f5a4a6d4289fd921f59f22e5cad87;hb=5feae4f56a8f3e3a7242cb565faf35a6b014d690;hpb=3b882e1702d8deb007a35b2d545925a4e4959e31;ds=sidebyside diff --git a/Source/WebCore/platform/chromium/DragImageChromiumSkia.cpp b/Source/WebCore/platform/chromium/DragImageChromiumSkia.cpp index 40f8925a540f..dd8ace385c24 100644 --- a/Source/WebCore/platform/chromium/DragImageChromiumSkia.cpp +++ b/Source/WebCore/platform/chromium/DragImageChromiumSkia.cpp @@ -47,11 +47,13 @@ IntSize dragImageSize(DragImageRef image) if (!image) return IntSize(); - return IntSize(image->width(), image->height()); + return IntSize(image->bitmap->width(), image->bitmap->height()); } void deleteDragImage(DragImageRef image) { + if (image) + delete image->bitmap; delete image; } @@ -60,13 +62,14 @@ DragImageRef scaleDragImage(DragImageRef image, FloatSize scale) if (!image) return 0; - int imageWidth = scale.width() * image->width(); - int imageHeight = scale.height() * image->height(); - DragImageRef scaledImage = new SkBitmap( - skia::ImageOperations::Resize(*image, skia::ImageOperations::RESIZE_LANCZOS3, + int imageWidth = scale.width() * image->bitmap->width(); + int imageHeight = scale.height() * image->bitmap->height(); + SkBitmap* scaledImage = new SkBitmap( + skia::ImageOperations::Resize(*image->bitmap, skia::ImageOperations::RESIZE_LANCZOS3, imageWidth, imageHeight)); - delete image; - return scaledImage; + delete image->bitmap; + image->bitmap = scaledImage; + return image; } DragImageRef dissolveDragImageToFraction(DragImageRef image, float fraction) @@ -74,12 +77,12 @@ DragImageRef dissolveDragImageToFraction(DragImageRef image, float fraction) if (!image) return 0; - image->setIsOpaque(false); - image->lockPixels(); + image->bitmap->setIsOpaque(false); + image->bitmap->lockPixels(); - for (int row = 0; row < image->height(); ++row) { - for (int column = 0; column < image->width(); ++column) { - uint32_t* pixel = image->getAddr32(column, row); + for (int row = 0; row < image->bitmap->height(); ++row) { + for (int column = 0; column < image->bitmap->width(); ++column) { + uint32_t* pixel = image->bitmap->getAddr32(column, row); *pixel = SkPreMultiplyARGB(SkColorGetA(*pixel) * fraction, SkColorGetR(*pixel), SkColorGetG(*pixel), @@ -87,7 +90,7 @@ DragImageRef dissolveDragImageToFraction(DragImageRef image, float fraction) } } - image->unlockPixels(); + image->bitmap->unlockPixels(); return image; } @@ -103,7 +106,10 @@ DragImageRef createDragImageFromImage(Image* image, RespectImageOrientationEnum) SkBitmap* dragImage = new SkBitmap(); bitmap->bitmap().copyTo(dragImage, SkBitmap::kARGB_8888_Config); - return dragImage; + DragImageChromium* dragImageChromium = new DragImageChromium; + dragImageChromium->bitmap = dragImage; + dragImageChromium->resolutionScale = bitmap->resolutionScale(); + return dragImageChromium; } DragImageRef createDragImageIconForCachedImage(CachedImage*)