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

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

Issue 2646623002: cc: Remove all blimp code from cc. (Closed)
Patch Set: test build 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
« no previous file with comments | « cc/playback/float_clip_display_item.h ('k') | cc/playback/recording_source.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/float_clip_display_item.h" 5 #include "cc/playback/float_clip_display_item.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
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 "cc/proto/display_item.pb.h"
12 #include "cc/proto/gfx_conversions.h"
13 #include "third_party/skia/include/core/SkCanvas.h" 11 #include "third_party/skia/include/core/SkCanvas.h"
14 #include "ui/gfx/skia_util.h" 12 #include "ui/gfx/skia_util.h"
15 13
16 namespace cc { 14 namespace cc {
17 15
18 FloatClipDisplayItem::FloatClipDisplayItem(const gfx::RectF& clip_rect) 16 FloatClipDisplayItem::FloatClipDisplayItem(const gfx::RectF& clip_rect)
19 : DisplayItem(FLOAT_CLIP) { 17 : DisplayItem(FLOAT_CLIP) {
20 SetNew(clip_rect); 18 SetNew(clip_rect);
21 } 19 }
22 20
23 FloatClipDisplayItem::FloatClipDisplayItem(const proto::DisplayItem& proto)
24 : DisplayItem(FLOAT_CLIP) {
25 DCHECK_EQ(proto::DisplayItem::Type_FloatClip, proto.type());
26
27 const proto::FloatClipDisplayItem& details = proto.float_clip_item();
28 gfx::RectF clip_rect = ProtoToRectF(details.clip_rect());
29
30 SetNew(clip_rect);
31 }
32
33 FloatClipDisplayItem::~FloatClipDisplayItem() { 21 FloatClipDisplayItem::~FloatClipDisplayItem() {
34 } 22 }
35 23
36 void FloatClipDisplayItem::SetNew(const gfx::RectF& clip_rect) { 24 void FloatClipDisplayItem::SetNew(const gfx::RectF& clip_rect) {
37 clip_rect_ = clip_rect; 25 clip_rect_ = clip_rect;
38 } 26 }
39 27
40 void FloatClipDisplayItem::ToProtobuf(proto::DisplayItem* proto) const {
41 proto->set_type(proto::DisplayItem::Type_FloatClip);
42
43 proto::FloatClipDisplayItem* details = proto->mutable_float_clip_item();
44 RectFToProto(clip_rect_, details->mutable_clip_rect());
45 }
46
47 void FloatClipDisplayItem::Raster(SkCanvas* canvas, 28 void FloatClipDisplayItem::Raster(SkCanvas* canvas,
48 SkPicture::AbortCallback* callback) const { 29 SkPicture::AbortCallback* callback) const {
49 canvas->save(); 30 canvas->save();
50 canvas->clipRect(gfx::RectFToSkRect(clip_rect_)); 31 canvas->clipRect(gfx::RectFToSkRect(clip_rect_));
51 } 32 }
52 33
53 void FloatClipDisplayItem::AsValueInto( 34 void FloatClipDisplayItem::AsValueInto(
54 const gfx::Rect& visual_rect, 35 const gfx::Rect& visual_rect,
55 base::trace_event::TracedValue* array) const { 36 base::trace_event::TracedValue* array) const {
56 array->AppendString(base::StringPrintf( 37 array->AppendString(base::StringPrintf(
57 "FloatClipDisplayItem rect: [%s] visualRect: [%s]", 38 "FloatClipDisplayItem rect: [%s] visualRect: [%s]",
58 clip_rect_.ToString().c_str(), visual_rect.ToString().c_str())); 39 clip_rect_.ToString().c_str(), visual_rect.ToString().c_str()));
59 } 40 }
60 41
61 EndFloatClipDisplayItem::EndFloatClipDisplayItem() 42 EndFloatClipDisplayItem::EndFloatClipDisplayItem()
62 : DisplayItem(END_FLOAT_CLIP) {} 43 : DisplayItem(END_FLOAT_CLIP) {}
63 44
64 EndFloatClipDisplayItem::EndFloatClipDisplayItem(
65 const proto::DisplayItem& proto)
66 : DisplayItem(END_FLOAT_CLIP) {
67 DCHECK_EQ(proto::DisplayItem::Type_EndFloatClip, proto.type());
68 }
69
70 EndFloatClipDisplayItem::~EndFloatClipDisplayItem() { 45 EndFloatClipDisplayItem::~EndFloatClipDisplayItem() {
71 } 46 }
72 47
73 void EndFloatClipDisplayItem::ToProtobuf(proto::DisplayItem* proto) const {
74 proto->set_type(proto::DisplayItem::Type_EndFloatClip);
75 }
76
77 void EndFloatClipDisplayItem::Raster( 48 void EndFloatClipDisplayItem::Raster(
78 SkCanvas* canvas, 49 SkCanvas* canvas,
79 SkPicture::AbortCallback* callback) const { 50 SkPicture::AbortCallback* callback) const {
80 canvas->restore(); 51 canvas->restore();
81 } 52 }
82 53
83 void EndFloatClipDisplayItem::AsValueInto( 54 void EndFloatClipDisplayItem::AsValueInto(
84 const gfx::Rect& visual_rect, 55 const gfx::Rect& visual_rect,
85 base::trace_event::TracedValue* array) const { 56 base::trace_event::TracedValue* array) const {
86 array->AppendString( 57 array->AppendString(
87 base::StringPrintf("EndFloatClipDisplayItem visualRect: [%s]", 58 base::StringPrintf("EndFloatClipDisplayItem visualRect: [%s]",
88 visual_rect.ToString().c_str())); 59 visual_rect.ToString().c_str()));
89 } 60 }
90 61
91 } // namespace cc 62 } // namespace cc
OLDNEW
« no previous file with comments | « cc/playback/float_clip_display_item.h ('k') | cc/playback/recording_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698