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/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_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 { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 } | 68 } |
69 | 69 |
70 int SkiaPaintCanvas::save() { | 70 int SkiaPaintCanvas::save() { |
71 return canvas_->save(); | 71 return canvas_->save(); |
72 } | 72 } |
73 | 73 |
74 int SkiaPaintCanvas::saveLayer(const SkRect* bounds, const PaintFlags* flags) { | 74 int SkiaPaintCanvas::saveLayer(const SkRect* bounds, const PaintFlags* flags) { |
75 return canvas_->saveLayer(bounds, ToSkPaint(flags)); | 75 return canvas_->saveLayer(bounds, ToSkPaint(flags)); |
76 } | 76 } |
77 | 77 |
78 int SkiaPaintCanvas::saveLayerAlpha(const SkRect* bounds, U8CPU alpha) { | 78 int SkiaPaintCanvas::saveLayerAlpha(const SkRect* bounds, uint8_t alpha) { |
79 return canvas_->saveLayerAlpha(bounds, alpha); | 79 return canvas_->saveLayerAlpha(bounds, alpha); |
80 } | 80 } |
81 | 81 |
82 void SkiaPaintCanvas::restore() { | 82 void SkiaPaintCanvas::restore() { |
83 canvas_->restore(); | 83 canvas_->restore(); |
84 } | 84 } |
85 | 85 |
86 int SkiaPaintCanvas::getSaveCount() const { | 86 int SkiaPaintCanvas::getSaveCount() const { |
87 return canvas_->getSaveCount(); | 87 return canvas_->getSaveCount(); |
88 } | 88 } |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 void* pixels = canvas_->accessTopLayerPixels(&info, &row_bytes); | 300 void* pixels = canvas_->accessTopLayerPixels(&info, &row_bytes); |
301 if (!pixels) { | 301 if (!pixels) { |
302 output->reset(); | 302 output->reset(); |
303 return false; | 303 return false; |
304 } | 304 } |
305 | 305 |
306 output->reset(info, pixels, row_bytes); | 306 output->reset(info, pixels, row_bytes); |
307 return true; | 307 return true; |
308 } | 308 } |
309 | 309 |
310 void SkiaPaintCanvas::AnnotateRectWithURL(const SkRect& rect, SkData* data) { | 310 void SkiaPaintCanvas::Annotate(AnnotationType type, |
311 SkAnnotateRectWithURL(canvas_, rect, data); | 311 const SkRect& rect, |
312 } | 312 sk_sp<SkData> data) { |
313 | 313 switch (type) { |
314 void SkiaPaintCanvas::AnnotateNamedDestination(const SkPoint& point, | 314 case AnnotationType::URL: |
315 SkData* data) { | 315 SkAnnotateRectWithURL(canvas_, rect, data.get()); |
316 SkAnnotateNamedDestination(canvas_, point, data); | 316 break; |
317 } | 317 case AnnotationType::LINK_TO_DESTINATION: |
318 | 318 SkAnnotateLinkToDestination(canvas_, rect, data.get()); |
319 void SkiaPaintCanvas::AnnotateLinkToDestination(const SkRect& rect, | 319 break; |
320 SkData* data) { | 320 case AnnotationType::NAMED_DESTINATION: { |
321 SkAnnotateLinkToDestination(canvas_, rect, data); | 321 SkPoint point = SkPoint::Make(rect.x(), rect.y()); |
| 322 SkAnnotateNamedDestination(canvas_, point, data.get()); |
| 323 break; |
| 324 } |
| 325 } |
322 } | 326 } |
323 | 327 |
324 } // namespace cc | 328 } // namespace cc |
OLD | NEW |