Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Side by Side Diff: cc/paint/paint_op_buffer.cc

Issue 2884563004: cc: Renamed approximate{BytesUsed,OpCount} in paint op buffer. (Closed)
Patch Set: winfix Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/paint/paint_op_buffer.h ('k') | cc/paint/paint_op_buffer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "cc/paint/display_item_list.h" 7 #include "cc/paint/display_item_list.h"
8 #include "cc/paint/paint_record.h" 8 #include "cc/paint/paint_record.h"
9 #include "third_party/skia/include/core/SkAnnotation.h" 9 #include "third_party/skia/include/core/SkAnnotation.h"
10 10
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 }; 105 };
106 106
107 template <> 107 template <>
108 struct Rasterizer<DrawRecordOp, false> { 108 struct Rasterizer<DrawRecordOp, false> {
109 static void RasterWithAlpha(const DrawRecordOp* op, 109 static void RasterWithAlpha(const DrawRecordOp* op,
110 SkCanvas* canvas, 110 SkCanvas* canvas,
111 uint8_t alpha) { 111 uint8_t alpha) {
112 // This "looking into records" optimization is done here instead of 112 // This "looking into records" optimization is done here instead of
113 // in the PaintOpBuffer::Raster function as DisplayItemList calls 113 // in the PaintOpBuffer::Raster function as DisplayItemList calls
114 // into RasterWithAlpha directly. 114 // into RasterWithAlpha directly.
115 if (op->record->approximateOpCount() == 1) { 115 if (op->record->size() == 1u) {
116 PaintOp* single_op = op->record->GetFirstOp(); 116 PaintOp* single_op = op->record->GetFirstOp();
117 // RasterWithAlpha only supported for draw ops. 117 // RasterWithAlpha only supported for draw ops.
118 if (single_op->IsDrawOp()) { 118 if (single_op->IsDrawOp()) {
119 single_op->RasterWithAlpha(canvas, alpha); 119 single_op->RasterWithAlpha(canvas, alpha);
120 return; 120 return;
121 } 121 }
122 } 122 }
123 123
124 canvas->saveLayerAlpha(nullptr, alpha); 124 canvas->saveLayerAlpha(nullptr, alpha);
125 SkMatrix unused_matrix; 125 SkMatrix unused_matrix;
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 : PaintOpWithArray(flags, bytes, count) {} 559 : PaintOpWithArray(flags, bytes, count) {}
560 560
561 DrawPosTextOp::~DrawPosTextOp() = default; 561 DrawPosTextOp::~DrawPosTextOp() = default;
562 562
563 DrawRecordOp::DrawRecordOp(sk_sp<const PaintRecord> record) 563 DrawRecordOp::DrawRecordOp(sk_sp<const PaintRecord> record)
564 : record(std::move(record)) {} 564 : record(std::move(record)) {}
565 565
566 DrawRecordOp::~DrawRecordOp() = default; 566 DrawRecordOp::~DrawRecordOp() = default;
567 567
568 size_t DrawRecordOp::AdditionalBytesUsed() const { 568 size_t DrawRecordOp::AdditionalBytesUsed() const {
569 return record->approximateBytesUsed(); 569 return record->bytes_used();
570 } 570 }
571 571
572 bool DrawRecordOp::HasDiscardableImages() const { 572 bool DrawRecordOp::HasDiscardableImages() const {
573 return record->HasDiscardableImages(); 573 return record->HasDiscardableImages();
574 } 574 }
575 575
576 DrawTextBlobOp::DrawTextBlobOp(sk_sp<SkTextBlob> blob, 576 DrawTextBlobOp::DrawTextBlobOp(sk_sp<SkTextBlob> blob,
577 SkScalar x, 577 SkScalar x,
578 SkScalar y, 578 SkScalar y,
579 const PaintFlags& flags) 579 const PaintFlags& flags)
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 return std::make_pair(op, skip); 712 return std::make_pair(op, skip);
713 } 713 }
714 714
715 void PaintOpBuffer::ShrinkToFit() { 715 void PaintOpBuffer::ShrinkToFit() {
716 if (!used_ || used_ == reserved_) 716 if (!used_ || used_ == reserved_)
717 return; 717 return;
718 ReallocBuffer(used_); 718 ReallocBuffer(used_);
719 } 719 }
720 720
721 } // namespace cc 721 } // namespace cc
OLDNEW
« no previous file with comments | « cc/paint/paint_op_buffer.h ('k') | cc/paint/paint_op_buffer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698