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/paint_record.h" | 9 #include "cc/paint/paint_record.h" |
| 9 #include "cc/paint/paint_recorder.h" | 10 #include "cc/paint/paint_recorder.h" |
| 10 #include "third_party/skia/include/core/SkAnnotation.h" | 11 #include "third_party/skia/include/core/SkAnnotation.h" |
| 11 #include "third_party/skia/include/core/SkMetaData.h" | 12 #include "third_party/skia/include/core/SkMetaData.h" |
| 12 #include "third_party/skia/include/utils/SkNWayCanvas.h" | 13 #include "third_party/skia/include/utils/SkNWayCanvas.h" |
| 13 | 14 |
| 14 namespace cc { | 15 namespace cc { |
| 15 | 16 |
| 16 SkiaPaintCanvas::SkiaPaintCanvas(SkCanvas* canvas) : canvas_(canvas) {} | 17 SkiaPaintCanvas::SkiaPaintCanvas(SkCanvas* canvas) : canvas_(canvas) {} |
| 17 | 18 |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 280 canvas_->drawTextBlob(blob, x, y, ToSkPaint(flags)); | 281 canvas_->drawTextBlob(blob, x, y, ToSkPaint(flags)); |
| 281 } | 282 } |
| 282 | 283 |
| 283 void SkiaPaintCanvas::drawTextBlob(const sk_sp<SkTextBlob>& blob, | 284 void SkiaPaintCanvas::drawTextBlob(const sk_sp<SkTextBlob>& blob, |
| 284 SkScalar x, | 285 SkScalar x, |
| 285 SkScalar y, | 286 SkScalar y, |
| 286 const PaintFlags& flags) { | 287 const PaintFlags& flags) { |
| 287 canvas_->drawTextBlob(blob, x, y, ToSkPaint(flags)); | 288 canvas_->drawTextBlob(blob, x, y, ToSkPaint(flags)); |
| 288 } | 289 } |
| 289 | 290 |
| 291 void SkiaPaintCanvas::drawDisplayItemList( | |
| 292 const SkRect& bounds, | |
| 293 const DisplayItemList* display_item_list) { | |
| 294 SkPictureRecorder recorder; | |
| 295 SkCanvas* canvas = recorder.beginRecording(bounds); | |
| 296 display_item_list->Raster(canvas, nullptr); | |
| 297 canvas_->drawPicture(recorder.finishRecordingAsPicture(0)); | |
|
enne (OOO)
2017/03/20 18:10:39
(0) => ()
chrishtr
2017/03/20 18:15:22
Done.
| |
| 298 } | |
| 299 | |
| 290 void SkiaPaintCanvas::drawPicture(const PaintRecord* record) { | 300 void SkiaPaintCanvas::drawPicture(const PaintRecord* record) { |
| 291 canvas_->drawPicture(ToSkPicture(record)); | 301 canvas_->drawPicture(ToSkPicture(record)); |
| 292 } | 302 } |
| 293 | 303 |
| 294 void SkiaPaintCanvas::drawPicture(const PaintRecord* record, | 304 void SkiaPaintCanvas::drawPicture(const PaintRecord* record, |
| 295 const SkMatrix* matrix, | 305 const SkMatrix* matrix, |
| 296 const PaintFlags* flags) { | 306 const PaintFlags* flags) { |
| 297 canvas_->drawPicture(ToSkPicture(record), matrix, ToSkPaint(flags)); | 307 canvas_->drawPicture(ToSkPicture(record), matrix, ToSkPaint(flags)); |
| 298 } | 308 } |
| 299 | 309 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 340 SkData* data) { | 350 SkData* data) { |
| 341 SkAnnotateNamedDestination(canvas_, point, data); | 351 SkAnnotateNamedDestination(canvas_, point, data); |
| 342 } | 352 } |
| 343 | 353 |
| 344 void SkiaPaintCanvas::AnnotateLinkToDestination(const SkRect& rect, | 354 void SkiaPaintCanvas::AnnotateLinkToDestination(const SkRect& rect, |
| 345 SkData* data) { | 355 SkData* data) { |
| 346 SkAnnotateLinkToDestination(canvas_, rect, data); | 356 SkAnnotateLinkToDestination(canvas_, rect, data); |
| 347 } | 357 } |
| 348 | 358 |
| 349 } // namespace cc | 359 } // namespace cc |
| OLD | NEW |