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

Unified Diff: cc/paint/skia_paint_canvas.cc

Issue 2764633002: cc/paint: Remove cc::PaintSurface. (Closed)
Patch Set: more stuff Created 3 years, 9 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: cc/paint/skia_paint_canvas.cc
diff --git a/cc/paint/skia_paint_canvas.cc b/cc/paint/skia_paint_canvas.cc
index fa90ec0f01c7b34630943a0c1c0d9a11b0c0828f..227389b5829716c7143eec295bc691adc18e27c5 100644
--- a/cc/paint/skia_paint_canvas.cc
+++ b/cc/paint/skia_paint_canvas.cc
@@ -9,11 +9,25 @@
#include "cc/paint/paint_record.h"
#include "cc/paint/paint_recorder.h"
#include "third_party/skia/include/core/SkAnnotation.h"
+#include "third_party/skia/include/core/SkMallocPixelRef.h"
#include "third_party/skia/include/core/SkMetaData.h"
#include "third_party/skia/include/utils/SkNWayCanvas.h"
namespace cc {
+// static
+std::unique_ptr<SkiaPaintCanvas> SkiaPaintCanvas::CreateRasterZeroed(
enne (OOO) 2017/03/22 00:41:01 I'm a little confused about the zeroed part of thi
Khushal 2017/03/22 00:45:51 The SkSurface does that, and I had a few tests bre
danakj 2017/03/22 15:06:51 Can you just have code that makes SkBitmap call Sk
+ const SkImageInfo& info) {
+ sk_sp<SkPixelRef> pr(SkMallocPixelRef::NewZeroed(info, 0, nullptr));
+ if (!pr)
+ return nullptr;
+
+ SkBitmap bitmap;
+ bitmap.setInfo(info, pr->rowBytes());
+ bitmap.setPixelRef(std::move(pr), 0, 0);
+ return base::MakeUnique<SkiaPaintCanvas>(bitmap);
+}
+
SkiaPaintCanvas::SkiaPaintCanvas(SkCanvas* canvas) : canvas_(canvas) {}
SkiaPaintCanvas::SkiaPaintCanvas(const SkBitmap& bitmap)

Powered by Google App Engine
This is Rietveld 408576698