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

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

Issue 2523673004: [NOT FOR COMMIT] Fully replace SkCanvas uses.
Patch Set: Support Android build. Created 4 years 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 d4b245403cb3186dd02bb87ab8e624b3e2b36b9d..0e6aecd5af8db361fe31479af229ca8c80c668c5 100644
--- a/third_party/WebKit/Source/platform/graphics/UnacceleratedImageBufferSurface.cpp
+++ b/third_party/WebKit/Source/platform/graphics/UnacceleratedImageBufferSurface.cpp
@@ -31,6 +31,7 @@
#include "platform/graphics/UnacceleratedImageBufferSurface.h"
#include "platform/graphics/skia/SkiaUtils.h"
+#include "skia/ext/cdl_canvas.h"
#include "third_party/skia/include/core/SkSurface.h"
#include "wtf/PassRefPtr.h"
@@ -53,25 +54,28 @@ UnacceleratedImageBufferSurface::UnacceleratedImageBufferSurface(
m_surface =
SkSurface::MakeRaster(info, Opaque == opacityMode ? 0 : &disableLCDProps);
+ if (!m_surface)
+ return;
+
+ m_canvas.reset(new CdlPassThroughCanvas(m_surface->getCanvas()));
+
// Always save an initial frame, to support resetting the top level matrix
// and clip.
- if (m_surface)
- m_surface->getCanvas()->save();
+ canvas()->save();
if (initializationMode == InitializeImagePixels) {
- if (m_surface)
- clear();
+ clear();
}
}
UnacceleratedImageBufferSurface::~UnacceleratedImageBufferSurface() {}
-SkCanvas* UnacceleratedImageBufferSurface::canvas() {
- return m_surface->getCanvas();
+CdlCanvas* UnacceleratedImageBufferSurface::canvas() {
+ return m_canvas.get();
}
bool UnacceleratedImageBufferSurface::isValid() const {
- return m_surface;
+ return m_canvas.get();
}
sk_sp<SkImage> UnacceleratedImageBufferSurface::newImageSnapshot(

Powered by Google App Engine
This is Rietveld 408576698