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/skia_paint_canvas.h" | 5 #include "cc/paint/skia_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_recorder.h" | 9 #include "cc/paint/paint_recorder.h" |
10 #include "third_party/skia/include/core/SkAnnotation.h" | 10 #include "third_party/skia/include/core/SkAnnotation.h" |
11 #include "third_party/skia/include/core/SkMetaData.h" | 11 #include "third_party/skia/include/core/SkMetaData.h" |
12 #include "third_party/skia/include/utils/SkNWayCanvas.h" | 12 #include "third_party/skia/include/utils/SkNWayCanvas.h" |
13 | 13 |
14 namespace cc { | 14 namespace cc { |
15 | 15 |
16 SkiaPaintCanvas::SkiaPaintCanvas(SkCanvas* canvas) : canvas_(canvas) {} | 16 SkiaPaintCanvas::SkiaPaintCanvas(SkCanvas* canvas) : canvas_(canvas) {} |
17 | 17 |
18 SkiaPaintCanvas::SkiaPaintCanvas(const SkBitmap& bitmap) | 18 SkiaPaintCanvas::SkiaPaintCanvas(const SkBitmap& bitmap) |
19 : canvas_(new SkCanvas(bitmap)), owned_(canvas_) {} | 19 : canvas_(new SkCanvas(bitmap)), owned_(canvas_) {} |
20 | 20 |
21 SkiaPaintCanvas::SkiaPaintCanvas(const SkBitmap& bitmap, | 21 SkiaPaintCanvas::SkiaPaintCanvas(const SkBitmap& bitmap, |
22 const SkSurfaceProps& props) | 22 const SkSurfaceProps& props) |
23 : canvas_(new SkCanvas(bitmap, props)), owned_(canvas_) {} | 23 : canvas_(new SkCanvas(bitmap, props)), owned_(canvas_) {} |
24 | 24 |
| 25 SkiaPaintCanvas::SkiaPaintCanvas(SkiaPaintCanvas&& other) = default; |
25 SkiaPaintCanvas::~SkiaPaintCanvas() = default; | 26 SkiaPaintCanvas::~SkiaPaintCanvas() = default; |
26 | 27 |
27 SkMetaData& SkiaPaintCanvas::getMetaData() { | 28 SkMetaData& SkiaPaintCanvas::getMetaData() { |
28 return canvas_->getMetaData(); | 29 return canvas_->getMetaData(); |
29 } | 30 } |
30 | 31 |
31 SkImageInfo SkiaPaintCanvas::imageInfo() const { | 32 SkImageInfo SkiaPaintCanvas::imageInfo() const { |
32 return canvas_->imageInfo(); | 33 return canvas_->imageInfo(); |
33 } | 34 } |
34 | 35 |
35 void SkiaPaintCanvas::flush() { | 36 void SkiaPaintCanvas::flush() { |
36 canvas_->flush(); | 37 canvas_->flush(); |
37 } | 38 } |
38 | 39 |
39 int SkiaPaintCanvas::save() { | 40 int SkiaPaintCanvas::save() { |
40 return canvas_->save(); | 41 return canvas_->save(); |
41 } | 42 } |
42 | 43 |
43 int SkiaPaintCanvas::saveLayer(const SkRect* bounds, const PaintFlags* flags) { | 44 int SkiaPaintCanvas::saveLayer(const SkRect* bounds, const PaintFlags* flags) { |
44 return canvas_->saveLayer(bounds, ToSkPaint(flags)); | 45 return canvas_->saveLayer(bounds, ToSkPaint(flags)); |
45 } | 46 } |
46 | 47 |
47 int SkiaPaintCanvas::saveLayerAlpha(const SkRect* bounds, uint8_t alpha) { | 48 int SkiaPaintCanvas::saveLayerAlpha(const SkRect* bounds, U8CPU alpha) { |
48 return canvas_->saveLayerAlpha(bounds, alpha); | 49 return canvas_->saveLayerAlpha(bounds, alpha); |
49 } | 50 } |
50 | 51 |
51 void SkiaPaintCanvas::restore() { | 52 void SkiaPaintCanvas::restore() { |
52 canvas_->restore(); | 53 canvas_->restore(); |
53 } | 54 } |
54 | 55 |
55 int SkiaPaintCanvas::getSaveCount() const { | 56 int SkiaPaintCanvas::getSaveCount() const { |
56 return canvas_->getSaveCount(); | 57 return canvas_->getSaveCount(); |
57 } | 58 } |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 break; | 270 break; |
270 case AnnotationType::NAMED_DESTINATION: { | 271 case AnnotationType::NAMED_DESTINATION: { |
271 SkPoint point = SkPoint::Make(rect.x(), rect.y()); | 272 SkPoint point = SkPoint::Make(rect.x(), rect.y()); |
272 SkAnnotateNamedDestination(canvas_, point, data.get()); | 273 SkAnnotateNamedDestination(canvas_, point, data.get()); |
273 break; | 274 break; |
274 } | 275 } |
275 } | 276 } |
276 } | 277 } |
277 | 278 |
278 } // namespace cc | 279 } // namespace cc |
OLD | NEW |