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

Side by Side Diff: cc/resources/clip_display_item.cc

Issue 1123983002: cc: Use a ListContainer for DisplayItemList to reduce allocations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: displaylistcontainer: fixdcheck Created 5 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/resources/clip_display_item.h ('k') | cc/resources/clip_path_display_item.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/resources/clip_display_item.h" 5 #include "cc/resources/clip_display_item.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/trace_event/trace_event_argument.h" 10 #include "base/trace_event/trace_event_argument.h"
11 #include "third_party/skia/include/core/SkCanvas.h" 11 #include "third_party/skia/include/core/SkCanvas.h"
12 #include "ui/gfx/skia_util.h" 12 #include "ui/gfx/skia_util.h"
13 13
14 namespace cc { 14 namespace cc {
15 15
16 ClipDisplayItem::ClipDisplayItem(gfx::Rect clip_rect, 16 ClipDisplayItem::ClipDisplayItem() {
17 const std::vector<SkRRect>& rounded_clip_rects)
18 : clip_rect_(clip_rect), rounded_clip_rects_(rounded_clip_rects) {
19 } 17 }
20 18
21 ClipDisplayItem::~ClipDisplayItem() { 19 ClipDisplayItem::~ClipDisplayItem() {
22 } 20 }
23 21
22 void ClipDisplayItem::SetNew(gfx::Rect clip_rect,
23 const std::vector<SkRRect>& rounded_clip_rects) {
24 clip_rect_ = clip_rect;
25 rounded_clip_rects_ = rounded_clip_rects;
26 }
27
24 void ClipDisplayItem::Raster(SkCanvas* canvas, 28 void ClipDisplayItem::Raster(SkCanvas* canvas,
25 SkDrawPictureCallback* callback) const { 29 SkDrawPictureCallback* callback) const {
26 canvas->save(); 30 canvas->save();
27 canvas->clipRect(SkRect::MakeXYWH(clip_rect_.x(), clip_rect_.y(), 31 canvas->clipRect(SkRect::MakeXYWH(clip_rect_.x(), clip_rect_.y(),
28 clip_rect_.width(), clip_rect_.height())); 32 clip_rect_.width(), clip_rect_.height()));
29 for (size_t i = 0; i < rounded_clip_rects_.size(); ++i) { 33 for (size_t i = 0; i < rounded_clip_rects_.size(); ++i) {
30 if (rounded_clip_rects_[i].isRect()) { 34 if (rounded_clip_rects_[i].isRect()) {
31 canvas->clipRect(rounded_clip_rects_[i].rect()); 35 canvas->clipRect(rounded_clip_rects_[i].rect());
32 } else { 36 } else {
33 bool antialiased = true; 37 bool antialiased = true;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 size_t EndClipDisplayItem::PictureMemoryUsage() const { 105 size_t EndClipDisplayItem::PictureMemoryUsage() const {
102 return 0; 106 return 0;
103 } 107 }
104 108
105 void EndClipDisplayItem::AsValueInto( 109 void EndClipDisplayItem::AsValueInto(
106 base::trace_event::TracedValue* array) const { 110 base::trace_event::TracedValue* array) const {
107 array->AppendString("EndClipDisplayItem"); 111 array->AppendString("EndClipDisplayItem");
108 } 112 }
109 113
110 } // namespace cc 114 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/clip_display_item.h ('k') | cc/resources/clip_path_display_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698