| 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() : cull_rect_(SkRect::MakeEmpty()) {} | 585 PaintOpBuffer::PaintOpBuffer() = default; |
| 586 | |
| 587 PaintOpBuffer::PaintOpBuffer(const SkRect& cull_rect) : cull_rect_(cull_rect) {} | |
| 588 | 586 |
| 589 PaintOpBuffer::~PaintOpBuffer() { | 587 PaintOpBuffer::~PaintOpBuffer() { |
| 590 Reset(); | 588 Reset(); |
| 591 } | 589 } |
| 592 | 590 |
| 593 void PaintOpBuffer::Reset() { | 591 void PaintOpBuffer::Reset() { |
| 594 for (auto* op : Iterator(this)) { | 592 for (auto* op : Iterator(this)) { |
| 595 auto func = g_destructor_functions[op->type]; | 593 auto func = g_destructor_functions[op->type]; |
| 596 if (func) | 594 if (func) |
| 597 func(op); | 595 func(op); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 return std::make_pair(op, skip); | 733 return std::make_pair(op, skip); |
| 736 } | 734 } |
| 737 | 735 |
| 738 void PaintOpBuffer::ShrinkToFit() { | 736 void PaintOpBuffer::ShrinkToFit() { |
| 739 if (!used_ || used_ == reserved_) | 737 if (!used_ || used_ == reserved_) |
| 740 return; | 738 return; |
| 741 ReallocBuffer(used_); | 739 ReallocBuffer(used_); |
| 742 } | 740 } |
| 743 | 741 |
| 744 } // namespace cc | 742 } // namespace cc |
| OLD | NEW |