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

Unified Diff: Source/platform/DragImage.cpp

Issue 1170523002: Removing GraphicsContext from ImageBuffer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix unit test crashes Created 5 years, 6 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
Index: Source/platform/DragImage.cpp
diff --git a/Source/platform/DragImage.cpp b/Source/platform/DragImage.cpp
index d02cfe2e8d7f9981b3363abfdf31347f891a2f2b..63f4e3adf07d114d075b39e29555dbdf45ca2f73 100644
--- a/Source/platform/DragImage.cpp
+++ b/Source/platform/DragImage.cpp
@@ -39,8 +39,8 @@
#include "platform/graphics/GraphicsContext.h"
#include "platform/graphics/Image.h"
#include "platform/graphics/ImageBuffer.h"
-#include "platform/graphics/paint/DisplayItemListContextRecorder.h"
#include "platform/graphics/paint/DrawingRecorder.h"
+#include "platform/graphics/paint/SkPictureBuilder.h"
#include "platform/text/BidiTextRun.h"
#include "platform/text/StringTruncator.h"
#include "platform/text/TextRun.h"
@@ -170,9 +170,9 @@ PassOwnPtr<DragImage> DragImage::create(const KURL& url, const String& inLabel,
if (!buffer)
return nullptr;
+ SkPictureBuilder pictureBuilder(FloatRect(0, 0, scaledImageSize.width(), scaledImageSize.height()));
{
- DisplayItemListContextRecorder contextRecorder(*buffer->context());
- GraphicsContext& paintContext = contextRecorder.context();
+ GraphicsContext& paintContext = pictureBuilder.context();
IntRect rect(IntPoint(), imageSize);
DrawingRecorder drawingRecorder(paintContext, *buffer, DisplayItem::DragImage, rect);
@@ -208,6 +208,8 @@ PassOwnPtr<DragImage> DragImage::create(const KURL& url, const String& inLabel,
paintContext.drawBidiText(labelFont, TextRunPaintInfo(textRun), FloatPoint(textPos));
}
}
+ RefPtr<const SkPicture> recording = pictureBuilder.endRecording();
+ buffer->canvas()->drawPicture(recording.get());
RefPtr<Image> image = buffer->copyImage();
return DragImage::create(image.get(), DoNotRespectImageOrientation, deviceScaleFactor);

Powered by Google App Engine
This is Rietveld 408576698