| 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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 canvas_->drawPosText(text, byte_length, pos, ToSkPaint(flags)); | 259 canvas_->drawPosText(text, byte_length, pos, ToSkPaint(flags)); |
| 259 } | 260 } |
| 260 | 261 |
| 261 void SkiaPaintCanvas::drawTextBlob(sk_sp<SkTextBlob> blob, | 262 void SkiaPaintCanvas::drawTextBlob(sk_sp<SkTextBlob> blob, |
| 262 SkScalar x, | 263 SkScalar x, |
| 263 SkScalar y, | 264 SkScalar y, |
| 264 const PaintFlags& flags) { | 265 const PaintFlags& flags) { |
| 265 canvas_->drawTextBlob(blob.get(), x, y, ToSkPaint(flags)); | 266 canvas_->drawTextBlob(blob.get(), x, y, ToSkPaint(flags)); |
| 266 } | 267 } |
| 267 | 268 |
| 269 void SkiaPaintCanvas::drawDisplayItemList( |
| 270 const SkRect& bounds, |
| 271 const DisplayItemList* display_item_list) { |
| 272 SkPictureRecorder recorder; |
| 273 SkCanvas* canvas = recorder.beginRecording(bounds); |
| 274 display_item_list->Raster(canvas, nullptr); |
| 275 canvas_->drawPicture(recorder.finishRecordingAsPicture()); |
| 276 } |
| 277 |
| 268 void SkiaPaintCanvas::drawPicture(sk_sp<const PaintRecord> record, | 278 void SkiaPaintCanvas::drawPicture(sk_sp<const PaintRecord> record, |
| 269 const SkMatrix* matrix, | 279 const SkMatrix* matrix, |
| 270 const PaintFlags* flags) { | 280 const PaintFlags* flags) { |
| 271 canvas_->drawPicture(ToSkPicture(record.get()), matrix, ToSkPaint(flags)); | 281 canvas_->drawPicture(ToSkPicture(record.get()), matrix, ToSkPaint(flags)); |
| 272 } | 282 } |
| 273 | 283 |
| 274 bool SkiaPaintCanvas::isClipEmpty() const { | 284 bool SkiaPaintCanvas::isClipEmpty() const { |
| 275 return canvas_->isClipEmpty(); | 285 return canvas_->isClipEmpty(); |
| 276 } | 286 } |
| 277 | 287 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 SkData* data) { | 320 SkData* data) { |
| 311 SkAnnotateNamedDestination(canvas_, point, data); | 321 SkAnnotateNamedDestination(canvas_, point, data); |
| 312 } | 322 } |
| 313 | 323 |
| 314 void SkiaPaintCanvas::AnnotateLinkToDestination(const SkRect& rect, | 324 void SkiaPaintCanvas::AnnotateLinkToDestination(const SkRect& rect, |
| 315 SkData* data) { | 325 SkData* data) { |
| 316 SkAnnotateLinkToDestination(canvas_, rect, data); | 326 SkAnnotateLinkToDestination(canvas_, rect, data); |
| 317 } | 327 } |
| 318 | 328 |
| 319 } // namespace cc | 329 } // namespace cc |
| OLD | NEW |