Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/paint/paint_canvas.h" | 5 #include "cc/paint/paint_canvas.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "cc/paint/display_item_list.h" | 8 #include "cc/paint/display_item_list.h" |
| 9 #include "cc/paint/paint_record.h" | 9 #include "cc/paint/paint_record.h" |
| 10 #include "cc/paint/paint_recorder.h" | 10 #include "cc/paint/paint_recorder.h" |
| 11 #include "third_party/skia/include/core/SkAnnotation.h" | 11 #include "third_party/skia/include/core/SkAnnotation.h" |
| 12 #include "third_party/skia/include/core/SkMallocPixelRef.h" | |
| 12 #include "third_party/skia/include/core/SkMetaData.h" | 13 #include "third_party/skia/include/core/SkMetaData.h" |
| 13 #include "third_party/skia/include/utils/SkNWayCanvas.h" | 14 #include "third_party/skia/include/utils/SkNWayCanvas.h" |
| 14 | 15 |
| 15 namespace cc { | 16 namespace cc { |
| 16 | 17 |
| 18 // static | |
| 19 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
| |
| 20 const SkImageInfo& info) { | |
| 21 sk_sp<SkPixelRef> pr(SkMallocPixelRef::NewZeroed(info, 0, nullptr)); | |
| 22 if (!pr) | |
| 23 return nullptr; | |
| 24 | |
| 25 SkBitmap bitmap; | |
| 26 bitmap.setInfo(info, pr->rowBytes()); | |
| 27 bitmap.setPixelRef(std::move(pr), 0, 0); | |
| 28 return base::MakeUnique<SkiaPaintCanvas>(bitmap); | |
| 29 } | |
| 30 | |
| 17 SkiaPaintCanvas::SkiaPaintCanvas(SkCanvas* canvas) : canvas_(canvas) {} | 31 SkiaPaintCanvas::SkiaPaintCanvas(SkCanvas* canvas) : canvas_(canvas) {} |
| 18 | 32 |
| 19 SkiaPaintCanvas::SkiaPaintCanvas(const SkBitmap& bitmap) | 33 SkiaPaintCanvas::SkiaPaintCanvas(const SkBitmap& bitmap) |
| 20 : canvas_(new SkCanvas(bitmap)), owned_(canvas_) {} | 34 : canvas_(new SkCanvas(bitmap)), owned_(canvas_) {} |
| 21 | 35 |
| 22 SkiaPaintCanvas::SkiaPaintCanvas(const SkBitmap& bitmap, | 36 SkiaPaintCanvas::SkiaPaintCanvas(const SkBitmap& bitmap, |
| 23 const SkSurfaceProps& props) | 37 const SkSurfaceProps& props) |
| 24 : canvas_(new SkCanvas(bitmap, props)), owned_(canvas_) {} | 38 : canvas_(new SkCanvas(bitmap, props)), owned_(canvas_) {} |
| 25 | 39 |
| 26 SkiaPaintCanvas::~SkiaPaintCanvas() = default; | 40 SkiaPaintCanvas::~SkiaPaintCanvas() = default; |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 324 SkData* data) { | 338 SkData* data) { |
| 325 SkAnnotateNamedDestination(canvas_, point, data); | 339 SkAnnotateNamedDestination(canvas_, point, data); |
| 326 } | 340 } |
| 327 | 341 |
| 328 void SkiaPaintCanvas::AnnotateLinkToDestination(const SkRect& rect, | 342 void SkiaPaintCanvas::AnnotateLinkToDestination(const SkRect& rect, |
| 329 SkData* data) { | 343 SkData* data) { |
| 330 SkAnnotateLinkToDestination(canvas_, rect, data); | 344 SkAnnotateLinkToDestination(canvas_, rect, data); |
| 331 } | 345 } |
| 332 | 346 |
| 333 } // namespace cc | 347 } // namespace cc |
| OLD | NEW |