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

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

Issue 2640983002: Rename paint data structures (Closed)
Patch Set: Re-add ios changes Created 3 years, 11 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 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/playback/clip_display_item.h" 5 #include "cc/playback/clip_display_item.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
13 #include "base/trace_event/trace_event_argument.h" 13 #include "base/trace_event/trace_event_argument.h"
14 #include "third_party/skia/include/core/SkCanvas.h"
15 #include "ui/gfx/skia_util.h" 14 #include "ui/gfx/skia_util.h"
16 15
17 namespace cc { 16 namespace cc {
18 class ImageSerializationProcessor; 17 class ImageSerializationProcessor;
19 18
20 ClipDisplayItem::ClipDisplayItem(const gfx::Rect& clip_rect, 19 ClipDisplayItem::ClipDisplayItem(const gfx::Rect& clip_rect,
21 const std::vector<SkRRect>& rounded_clip_rects, 20 const std::vector<SkRRect>& rounded_clip_rects,
22 bool antialias) 21 bool antialias)
23 : DisplayItem(CLIP) { 22 : DisplayItem(CLIP) {
24 SetNew(clip_rect, rounded_clip_rects, antialias); 23 SetNew(clip_rect, rounded_clip_rects, antialias);
25 } 24 }
26 25
27 void ClipDisplayItem::SetNew(const gfx::Rect& clip_rect, 26 void ClipDisplayItem::SetNew(const gfx::Rect& clip_rect,
28 const std::vector<SkRRect>& rounded_clip_rects, 27 const std::vector<SkRRect>& rounded_clip_rects,
29 bool antialias) { 28 bool antialias) {
30 clip_rect_ = clip_rect; 29 clip_rect_ = clip_rect;
31 rounded_clip_rects_ = rounded_clip_rects; 30 rounded_clip_rects_ = rounded_clip_rects;
32 antialias_ = antialias; 31 antialias_ = antialias;
33 } 32 }
34 33
35 ClipDisplayItem::~ClipDisplayItem() {} 34 ClipDisplayItem::~ClipDisplayItem() {}
36 35
37 void ClipDisplayItem::Raster(SkCanvas* canvas, 36 void ClipDisplayItem::Raster(PaintCanvas* canvas,
38 SkPicture::AbortCallback* callback) const { 37 PaintRecord::AbortCallback* callback) const {
39 canvas->save(); 38 canvas->save();
40 canvas->clipRect(gfx::RectToSkRect(clip_rect_), antialias_); 39 canvas->clipRect(gfx::RectToSkRect(clip_rect_), antialias_);
41 for (size_t i = 0; i < rounded_clip_rects_.size(); ++i) { 40 for (size_t i = 0; i < rounded_clip_rects_.size(); ++i) {
42 if (rounded_clip_rects_[i].isRect()) { 41 if (rounded_clip_rects_[i].isRect()) {
43 canvas->clipRect(rounded_clip_rects_[i].rect(), antialias_); 42 canvas->clipRect(rounded_clip_rects_[i].rect(), antialias_);
44 } else { 43 } else {
45 canvas->clipRRect(rounded_clip_rects_[i], antialias_); 44 canvas->clipRRect(rounded_clip_rects_[i], antialias_);
46 } 45 }
47 } 46 }
48 } 47 }
(...skipping 24 matching lines...) Expand all
73 lower_left_radius.y()); 72 lower_left_radius.y());
74 } 73 }
75 array->AppendString(value); 74 array->AppendString(value);
76 } 75 }
77 76
78 EndClipDisplayItem::EndClipDisplayItem() : DisplayItem(END_CLIP) {} 77 EndClipDisplayItem::EndClipDisplayItem() : DisplayItem(END_CLIP) {}
79 78
80 EndClipDisplayItem::~EndClipDisplayItem() { 79 EndClipDisplayItem::~EndClipDisplayItem() {
81 } 80 }
82 81
83 void EndClipDisplayItem::Raster(SkCanvas* canvas, 82 void EndClipDisplayItem::Raster(PaintCanvas* canvas,
84 SkPicture::AbortCallback* callback) const { 83 PaintRecord::AbortCallback* callback) const {
85 canvas->restore(); 84 canvas->restore();
86 } 85 }
87 86
88 void EndClipDisplayItem::AsValueInto( 87 void EndClipDisplayItem::AsValueInto(
89 const gfx::Rect& visual_rect, 88 const gfx::Rect& visual_rect,
90 base::trace_event::TracedValue* array) const { 89 base::trace_event::TracedValue* array) const {
91 array->AppendString(base::StringPrintf("EndClipDisplayItem visualRect: [%s]", 90 array->AppendString(base::StringPrintf("EndClipDisplayItem visualRect: [%s]",
92 visual_rect.ToString().c_str())); 91 visual_rect.ToString().c_str()));
93 } 92 }
94 93
95 } // namespace cc 94 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698