| 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_op_buffer.h" | 5 #include "cc/paint/paint_op_buffer.h" |
| 6 | 6 |
| 7 #include "base/containers/stack_container.h" | 7 #include "base/containers/stack_container.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 "third_party/skia/include/core/SkAnnotation.h" | 10 #include "third_party/skia/include/core/SkAnnotation.h" |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 } | 575 } |
| 576 | 576 |
| 577 DrawTextBlobOp::DrawTextBlobOp(sk_sp<SkTextBlob> blob, | 577 DrawTextBlobOp::DrawTextBlobOp(sk_sp<SkTextBlob> blob, |
| 578 SkScalar x, | 578 SkScalar x, |
| 579 SkScalar y, | 579 SkScalar y, |
| 580 const PaintFlags& flags) | 580 const PaintFlags& flags) |
| 581 : PaintOpWithFlags(flags), blob(std::move(blob)), x(x), y(y) {} | 581 : PaintOpWithFlags(flags), blob(std::move(blob)), x(x), y(y) {} |
| 582 | 582 |
| 583 DrawTextBlobOp::~DrawTextBlobOp() = default; | 583 DrawTextBlobOp::~DrawTextBlobOp() = default; |
| 584 | 584 |
| 585 PaintOpBuffer::PaintOpBuffer() = default; | 585 PaintOpBuffer::PaintOpBuffer() : cull_rect_(SkRect::MakeEmpty()) {} |
| 586 |
| 587 PaintOpBuffer::PaintOpBuffer(const SkRect& cull_rect) : cull_rect_(cull_rect) {} |
| 586 | 588 |
| 587 PaintOpBuffer::~PaintOpBuffer() { | 589 PaintOpBuffer::~PaintOpBuffer() { |
| 588 Reset(); | 590 Reset(); |
| 589 } | 591 } |
| 590 | 592 |
| 591 void PaintOpBuffer::Reset() { | 593 void PaintOpBuffer::Reset() { |
| 592 for (auto* op : Iterator(this)) { | 594 for (auto* op : Iterator(this)) { |
| 593 auto func = g_destructor_functions[op->type]; | 595 auto func = g_destructor_functions[op->type]; |
| 594 if (func) | 596 if (func) |
| 595 func(op); | 597 func(op); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 return std::make_pair(op, skip); | 735 return std::make_pair(op, skip); |
| 734 } | 736 } |
| 735 | 737 |
| 736 void PaintOpBuffer::ShrinkToFit() { | 738 void PaintOpBuffer::ShrinkToFit() { |
| 737 if (!used_ || used_ == reserved_) | 739 if (!used_ || used_ == reserved_) |
| 738 return; | 740 return; |
| 739 ReallocBuffer(used_); | 741 ReallocBuffer(used_); |
| 740 } | 742 } |
| 741 | 743 |
| 742 } // namespace cc | 744 } // namespace cc |
| OLD | NEW |