Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1262)

Unified Diff: Source/platform/DragImage.cpp

Issue 886323005: Pass InterpolationQuality into DragImage to respect image-rendering:pixelated. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Sync and rebase Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/platform/DragImage.h ('k') | Source/platform/DragImageTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/DragImage.cpp
diff --git a/Source/platform/DragImage.cpp b/Source/platform/DragImage.cpp
index 73442bd4711e2374d364890015f9d89f6cfd5d14..45eff80b33c2b3546de1fba4d0ee6a87ebbb38e5 100644
--- a/Source/platform/DragImage.cpp
+++ b/Source/platform/DragImage.cpp
@@ -70,7 +70,7 @@ const float kMaxDragLabelStringWidth = (kMaxDragLabelWidth - 2 * kDragLabelBorde
const float kDragLinkLabelFontSize = 11;
const float kDragLinkUrlFontSize = 10;
-PassOwnPtr<DragImage> DragImage::create(Image* image, RespectImageOrientationEnum shouldRespectImageOrientation, float deviceScaleFactor)
+PassOwnPtr<DragImage> DragImage::create(Image* image, RespectImageOrientationEnum shouldRespectImageOrientation, float deviceScaleFactor, InterpolationQuality interpolationQuality)
{
if (!image)
return nullptr;
@@ -101,14 +101,14 @@ PassOwnPtr<DragImage> DragImage::create(Image* image, RespectImageOrientationEnu
canvas.concat(affineTransformToSkMatrix(orientation.transformFromDefault(sizeRespectingOrientation)));
canvas.drawBitmapRect(bitmap->bitmap(), 0, destRect);
- return adoptPtr(new DragImage(skBitmap, deviceScaleFactor));
+ return adoptPtr(new DragImage(skBitmap, deviceScaleFactor, interpolationQuality));
}
}
SkBitmap skBitmap;
if (!bitmap->bitmap().copyTo(&skBitmap, kN32_SkColorType))
return nullptr;
- return adoptPtr(new DragImage(skBitmap, deviceScaleFactor));
+ return adoptPtr(new DragImage(skBitmap, deviceScaleFactor, interpolationQuality));
}
static Font deriveDragLabelFont(int size, FontWeight fontWeight, const FontDescription& systemFont)
@@ -223,9 +223,10 @@ PassOwnPtr<DragImage> DragImage::create(const KURL& url, const String& inLabel,
return DragImage::create(image.get(), DoNotRespectImageOrientation, deviceScaleFactor);
}
-DragImage::DragImage(const SkBitmap& bitmap, float resolutionScale)
+DragImage::DragImage(const SkBitmap& bitmap, float resolutionScale, InterpolationQuality interpolationQuality)
: m_bitmap(bitmap)
, m_resolutionScale(resolutionScale)
+ , m_interpolationQuality(interpolationQuality)
{
}
@@ -270,10 +271,10 @@ void DragImage::fitToMaxSize(const IntSize& srcSize, const IntSize& maxSize)
void DragImage::scale(float scaleX, float scaleY)
{
+ skia::ImageOperations::ResizeMethod resizeMethod = m_interpolationQuality == InterpolationNone ? skia::ImageOperations::RESIZE_BOX : skia::ImageOperations::RESIZE_LANCZOS3;
int imageWidth = scaleX * m_bitmap.width();
int imageHeight = scaleY * m_bitmap.height();
- m_bitmap = skia::ImageOperations::Resize(
- m_bitmap, skia::ImageOperations::RESIZE_LANCZOS3, imageWidth, imageHeight);
+ m_bitmap = skia::ImageOperations::Resize(m_bitmap, resizeMethod, imageWidth, imageHeight);
}
void DragImage::dissolveToFraction(float fraction)
« no previous file with comments | « Source/platform/DragImage.h ('k') | Source/platform/DragImageTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698