Chromium Code Reviews| Index: Source/core/platform/DragImage.cpp |
| diff --git a/Source/core/platform/DragImage.cpp b/Source/core/platform/DragImage.cpp |
| index 209d40997143950c1ef5b20b8b1cadeeda143576..1d535e4f1226b1254c793a79786eb9b1f252fcbb 100644 |
| --- a/Source/core/platform/DragImage.cpp |
| +++ b/Source/core/platform/DragImage.cpp |
| @@ -41,6 +41,7 @@ |
| #include "platform/geometry/IntPoint.h" |
| #include "platform/graphics/Color.h" |
| #include "platform/graphics/TextRun.h" |
| +#include "platform/graphics/UnacceleratedImageBufferSurface.h" |
| #include "platform/transforms/AffineTransform.h" |
| #include "platform/weborigin/KURL.h" |
| #include "skia/ext/image_operations.h" |
| @@ -163,15 +164,16 @@ PassOwnPtr<DragImage> DragImage::create(const KURL& url, const String& inLabel, |
| // fill the background |
| IntSize scaledImageSize = imageSize; |
| scaledImageSize.scale(deviceScaleFactor); |
| - OwnPtr<ImageBuffer> buffer(ImageBuffer::create(scaledImageSize, deviceScaleFactor)); |
| - if (!buffer) |
| + OwnPtr<ImageBufferSurface> surface = adoptPtr(new UnacceleratedImageBufferSurface(scaledImageSize, NonOpaque, deviceScaleFactor)); |
| + if (!surface->isValid()) |
|
Stephen White
2013/12/04 21:18:40
Same here.
|
| return nullptr; |
| + ImageBuffer buffer(surface.release()); |
| const float DragLabelRadius = 5; |
| const IntSize radii(DragLabelRadius, DragLabelRadius); |
| IntRect rect(IntPoint(), imageSize); |
| const Color backgroundColor(140, 140, 140); |
| - buffer->context()->fillRoundedRect(rect, radii, radii, radii, radii, backgroundColor); |
| + buffer.context()->fillRoundedRect(rect, radii, radii, radii, radii, backgroundColor); |
| // Draw the text |
| if (drawURLString) { |
| @@ -179,7 +181,7 @@ PassOwnPtr<DragImage> DragImage::create(const KURL& url, const String& inLabel, |
| urlString = StringTruncator::centerTruncate(urlString, imageSize.width() - (kDragLabelBorderX * 2.0f), urlFont, StringTruncator::EnableRoundingHacks); |
| IntPoint textPos(kDragLabelBorderX, imageSize.height() - (kLabelBorderYOffset + urlFont.fontMetrics().descent())); |
| TextRun textRun(urlString); |
| - buffer->context()->drawText(urlFont, TextRunPaintInfo(textRun), textPos); |
| + buffer.context()->drawText(urlFont, TextRunPaintInfo(textRun), textPos); |
| } |
| if (clipLabelString) |
| @@ -187,9 +189,9 @@ PassOwnPtr<DragImage> DragImage::create(const KURL& url, const String& inLabel, |
| IntPoint textPos(kDragLabelBorderX, kDragLabelBorderY + labelFont.pixelSize()); |
| TextRun textRun(label); |
| - buffer->context()->drawText(urlFont, TextRunPaintInfo(textRun), textPos); |
| + buffer.context()->drawText(urlFont, TextRunPaintInfo(textRun), textPos); |
| - RefPtr<Image> image = buffer->copyImage(); |
| + RefPtr<Image> image = buffer.copyImage(); |
| return DragImage::create(image.get()); |
| } |