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

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

Issue 2876033005: Track slow paths in DisplayItemList (Closed)
Patch Set: Rebase 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
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 "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 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 } 447 }
448 448
449 void PaintOp::RasterWithAlpha(SkCanvas* canvas, uint8_t alpha) const { 449 void PaintOp::RasterWithAlpha(SkCanvas* canvas, uint8_t alpha) const {
450 g_raster_alpha_functions[type](this, canvas, alpha); 450 g_raster_alpha_functions[type](this, canvas, alpha);
451 } 451 }
452 452
453 int ClipPathOp::CountSlowPaths() const { 453 int ClipPathOp::CountSlowPaths() const {
454 return antialias && !path.isConvex() ? 1 : 0; 454 return antialias && !path.isConvex() ? 1 : 0;
455 } 455 }
456 456
457 int DrawDisplayItemListOp::CountSlowPaths() const {
458 return list->NumSlowPaths();
459 }
460
457 int DrawLineOp::CountSlowPaths() const { 461 int DrawLineOp::CountSlowPaths() const {
458 if (const SkPathEffect* effect = flags.getPathEffect()) { 462 if (const SkPathEffect* effect = flags.getPathEffect()) {
459 SkPathEffect::DashInfo info; 463 SkPathEffect::DashInfo info;
460 SkPathEffect::DashType dashType = effect->asADash(&info); 464 SkPathEffect::DashType dashType = effect->asADash(&info);
461 if (flags.getStrokeCap() != PaintFlags::kRound_Cap && 465 if (flags.getStrokeCap() != PaintFlags::kRound_Cap &&
462 dashType == SkPathEffect::kDash_DashType && info.fCount == 2) { 466 dashType == SkPathEffect::kDash_DashType && info.fCount == 2) {
463 // The PaintFlags will count this as 1, so uncount that here as 467 // The PaintFlags will count this as 1, so uncount that here as
464 // this kind of line is special cased and not slow. 468 // this kind of line is special cased and not slow.
465 return -1; 469 return -1;
466 } 470 }
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 return std::make_pair(op, skip); 737 return std::make_pair(op, skip);
734 } 738 }
735 739
736 void PaintOpBuffer::ShrinkToFit() { 740 void PaintOpBuffer::ShrinkToFit() {
737 if (!used_ || used_ == reserved_) 741 if (!used_ || used_ == reserved_)
738 return; 742 return;
739 ReallocBuffer(used_); 743 ReallocBuffer(used_);
740 } 744 }
741 745
742 } // namespace cc 746 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698