Chromium Code Reviews| 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 |