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

Unified Diff: third_party/WebKit/Source/platform/graphics/UnacceleratedImageBufferSurface.cpp

Issue 1432443004: Remove SkDevice and SkBaseDevice outside skia/ext/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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: third_party/WebKit/Source/platform/graphics/UnacceleratedImageBufferSurface.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/UnacceleratedImageBufferSurface.cpp b/third_party/WebKit/Source/platform/graphics/UnacceleratedImageBufferSurface.cpp
index eaf78c12c13e60516caa657c7c8b9c57bc268a94..5502bd152bf4b9d2860dcc7b7e74ccf95d247c8a 100644
--- a/third_party/WebKit/Source/platform/graphics/UnacceleratedImageBufferSurface.cpp
+++ b/third_party/WebKit/Source/platform/graphics/UnacceleratedImageBufferSurface.cpp
@@ -31,11 +31,25 @@
#include "config.h"
#include "platform/graphics/UnacceleratedImageBufferSurface.h"
+#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkCanvas.h"
-#include "third_party/skia/include/core/SkDevice.h"
#include "third_party/skia/include/core/SkSurface.h"
#include "wtf/PassRefPtr.h"
+class SkCanvas;
+
+namespace {
+
+SkBitmap ReadPixels(SkCanvas* canvas)
Justin Novosad 2015/11/04 16:29:36 This is copied in two places, perhaps it should go
+{
+ SkBitmap bitmap;
+ bitmap.setInfo(canvas->imageInfo());
+ canvas->readPixels(&bitmap, 0, 0);
+ return bitmap;
+}
+
+}
+
namespace blink {
UnacceleratedImageBufferSurface::UnacceleratedImageBufferSurface(const IntSize& size, OpacityMode opacityMode, ImageInitializationMode initializationMode)
@@ -59,10 +73,10 @@ SkCanvas* UnacceleratedImageBufferSurface::canvas()
return m_surface->getCanvas();
}
-const SkBitmap& UnacceleratedImageBufferSurface::deprecatedBitmapForOverwrite()
+const SkBitmap UnacceleratedImageBufferSurface::deprecatedBitmapForOverwrite()
{
m_surface->notifyContentWillChange(SkSurface::kDiscard_ContentChangeMode);
- return m_surface->getCanvas()->getDevice()->accessBitmap(false);
+ return ReadPixels(m_surface->getCanvas());
Justin Novosad 2015/11/04 16:29:36 I am surprised this does not break any layout test
f(malita) 2015/11/05 13:53:26 I was just about to suggest returning a SkSurface
}
bool UnacceleratedImageBufferSurface::isValid() const

Powered by Google App Engine
This is Rietveld 408576698