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/SkMetaData.h" | 12 #include "third_party/skia/include/core/SkMetaData.h" |
13 #include "third_party/skia/include/utils/SkNWayCanvas.h" | 13 #include "third_party/skia/include/utils/SkNWayCanvas.h" |
14 | 14 |
15 namespace cc { | 15 namespace cc { |
16 | 16 |
17 SkiaPaintCanvas::SkiaPaintCanvas(SkCanvas* canvas) : canvas_(canvas) {} | 17 SkiaPaintCanvas::SkiaPaintCanvas(SkCanvas* canvas) : canvas_(canvas) {} |
18 | 18 |
19 SkiaPaintCanvas::SkiaPaintCanvas(const SkBitmap& bitmap) | 19 SkiaPaintCanvas::SkiaPaintCanvas(const SkBitmap& bitmap) |
20 : canvas_(new SkCanvas(bitmap)), owned_(canvas_) {} | 20 : canvas_(new SkCanvas(bitmap)), owned_(canvas_) {} |
21 | 21 |
22 SkiaPaintCanvas::SkiaPaintCanvas(const SkBitmap& bitmap, | 22 SkiaPaintCanvas::SkiaPaintCanvas(const SkBitmap& bitmap, |
23 const SkSurfaceProps& props) | 23 const SkSurfaceProps& props) |
24 : canvas_(new SkCanvas(bitmap, props)), owned_(canvas_) {} | 24 : canvas_(new SkCanvas(bitmap, props)), owned_(canvas_) {} |
25 | 25 |
| 26 SkiaPaintCanvas::SkiaPaintCanvas(SkiaPaintCanvas&& other) = default; |
26 SkiaPaintCanvas::~SkiaPaintCanvas() = default; | 27 SkiaPaintCanvas::~SkiaPaintCanvas() = default; |
27 | 28 |
28 SkMetaData& SkiaPaintCanvas::getMetaData() { | 29 SkMetaData& SkiaPaintCanvas::getMetaData() { |
29 return canvas_->getMetaData(); | 30 return canvas_->getMetaData(); |
30 } | 31 } |
31 | 32 |
32 SkImageInfo SkiaPaintCanvas::imageInfo() const { | 33 SkImageInfo SkiaPaintCanvas::imageInfo() const { |
33 return canvas_->imageInfo(); | 34 return canvas_->imageInfo(); |
34 } | 35 } |
35 | 36 |
36 void SkiaPaintCanvas::flush() { | 37 void SkiaPaintCanvas::flush() { |
37 canvas_->flush(); | 38 canvas_->flush(); |
38 } | 39 } |
39 | 40 |
40 SkISize SkiaPaintCanvas::getBaseLayerSize() const { | 41 SkISize SkiaPaintCanvas::getBaseLayerSize() const { |
41 return canvas_->getBaseLayerSize(); | 42 return canvas_->getBaseLayerSize(); |
42 } | 43 } |
43 | 44 |
44 bool SkiaPaintCanvas::peekPixels(SkPixmap* pixmap) { | |
45 return canvas_->peekPixels(pixmap); | |
46 } | |
47 | |
48 bool SkiaPaintCanvas::readPixels(const SkImageInfo& dest_info, | 45 bool SkiaPaintCanvas::readPixels(const SkImageInfo& dest_info, |
49 void* dest_pixels, | 46 void* dest_pixels, |
50 size_t dest_row_bytes, | 47 size_t dest_row_bytes, |
51 int src_x, | 48 int src_x, |
52 int src_y) { | 49 int src_y) { |
53 return canvas_->readPixels(dest_info, dest_pixels, dest_row_bytes, src_x, | 50 return canvas_->readPixels(dest_info, dest_pixels, dest_row_bytes, src_x, |
54 src_y); | 51 src_y); |
55 } | 52 } |
56 | 53 |
57 bool SkiaPaintCanvas::readPixels(SkBitmap* bitmap, int src_x, int src_y) { | 54 bool SkiaPaintCanvas::readPixels(SkBitmap* bitmap, int src_x, int src_y) { |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 SkData* data) { | 317 SkData* data) { |
321 SkAnnotateNamedDestination(canvas_, point, data); | 318 SkAnnotateNamedDestination(canvas_, point, data); |
322 } | 319 } |
323 | 320 |
324 void SkiaPaintCanvas::AnnotateLinkToDestination(const SkRect& rect, | 321 void SkiaPaintCanvas::AnnotateLinkToDestination(const SkRect& rect, |
325 SkData* data) { | 322 SkData* data) { |
326 SkAnnotateLinkToDestination(canvas_, rect, data); | 323 SkAnnotateLinkToDestination(canvas_, rect, data); |
327 } | 324 } |
328 | 325 |
329 } // namespace cc | 326 } // namespace cc |
OLD | NEW |