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; | |
26 SkiaPaintCanvas::~SkiaPaintCanvas() = default; | 25 SkiaPaintCanvas::~SkiaPaintCanvas() = default; |
27 | 26 |
28 SkMetaData& SkiaPaintCanvas::getMetaData() { | 27 SkMetaData& SkiaPaintCanvas::getMetaData() { |
29 return canvas_->getMetaData(); | 28 return canvas_->getMetaData(); |
30 } | 29 } |
31 | 30 |
32 SkImageInfo SkiaPaintCanvas::imageInfo() const { | 31 SkImageInfo SkiaPaintCanvas::imageInfo() const { |
33 return canvas_->imageInfo(); | 32 return canvas_->imageInfo(); |
34 } | 33 } |
35 | 34 |
36 void SkiaPaintCanvas::flush() { | 35 void SkiaPaintCanvas::flush() { |
37 canvas_->flush(); | 36 canvas_->flush(); |
38 } | 37 } |
39 | 38 |
40 int SkiaPaintCanvas::save() { | 39 int SkiaPaintCanvas::save() { |
41 return canvas_->save(); | 40 return canvas_->save(); |
42 } | 41 } |
43 | 42 |
44 int SkiaPaintCanvas::saveLayer(const SkRect* bounds, const PaintFlags* flags) { | 43 int SkiaPaintCanvas::saveLayer(const SkRect* bounds, const PaintFlags* flags) { |
45 return canvas_->saveLayer(bounds, ToSkPaint(flags)); | 44 return canvas_->saveLayer(bounds, ToSkPaint(flags)); |
46 } | 45 } |
47 | 46 |
48 int SkiaPaintCanvas::saveLayerAlpha(const SkRect* bounds, U8CPU alpha) { | 47 int SkiaPaintCanvas::saveLayerAlpha(const SkRect* bounds, uint8_t alpha) { |
49 return canvas_->saveLayerAlpha(bounds, alpha); | 48 return canvas_->saveLayerAlpha(bounds, alpha); |
50 } | 49 } |
51 | 50 |
52 void SkiaPaintCanvas::restore() { | 51 void SkiaPaintCanvas::restore() { |
53 canvas_->restore(); | 52 canvas_->restore(); |
54 } | 53 } |
55 | 54 |
56 int SkiaPaintCanvas::getSaveCount() const { | 55 int SkiaPaintCanvas::getSaveCount() const { |
57 return canvas_->getSaveCount(); | 56 return canvas_->getSaveCount(); |
58 } | 57 } |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 break; | 269 break; |
271 case AnnotationType::NAMED_DESTINATION: { | 270 case AnnotationType::NAMED_DESTINATION: { |
272 SkPoint point = SkPoint::Make(rect.x(), rect.y()); | 271 SkPoint point = SkPoint::Make(rect.x(), rect.y()); |
273 SkAnnotateNamedDestination(canvas_, point, data.get()); | 272 SkAnnotateNamedDestination(canvas_, point, data.get()); |
274 break; | 273 break; |
275 } | 274 } |
276 } | 275 } |
277 } | 276 } |
278 | 277 |
279 } // namespace cc | 278 } // namespace cc |
OLD | NEW |