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

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

Issue 1982893002: [blimp] Add SkPicture caching support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments from vmpstr, including adding //cc/blimp Created 4 years, 6 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.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 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" 11 #include "cc/proto/display_item.pb.h"
12 #include "cc/proto/gfx_conversions.h" 12 #include "cc/proto/gfx_conversions.h"
13 #include "third_party/skia/include/core/SkCanvas.h" 13 #include "third_party/skia/include/core/SkCanvas.h"
14 #include "ui/gfx/skia_util.h" 14 #include "ui/gfx/skia_util.h"
15 15
16 namespace cc { 16 namespace cc {
17 class ImageSerializationProcessor;
18 17
19 FloatClipDisplayItem::FloatClipDisplayItem(const gfx::RectF& clip_rect) { 18 FloatClipDisplayItem::FloatClipDisplayItem(const gfx::RectF& clip_rect) {
20 SetNew(clip_rect); 19 SetNew(clip_rect);
21 } 20 }
22 21
23 FloatClipDisplayItem::FloatClipDisplayItem(const proto::DisplayItem& proto) { 22 FloatClipDisplayItem::FloatClipDisplayItem(const proto::DisplayItem& proto) {
24 DCHECK_EQ(proto::DisplayItem::Type_FloatClip, proto.type()); 23 DCHECK_EQ(proto::DisplayItem::Type_FloatClip, proto.type());
25 24
26 const proto::FloatClipDisplayItem& details = proto.float_clip_item(); 25 const proto::FloatClipDisplayItem& details = proto.float_clip_item();
27 gfx::RectF clip_rect = ProtoToRectF(details.clip_rect()); 26 gfx::RectF clip_rect = ProtoToRectF(details.clip_rect());
28 27
29 SetNew(clip_rect); 28 SetNew(clip_rect);
30 } 29 }
31 30
32 FloatClipDisplayItem::~FloatClipDisplayItem() { 31 FloatClipDisplayItem::~FloatClipDisplayItem() {
33 } 32 }
34 33
35 void FloatClipDisplayItem::SetNew(const gfx::RectF& clip_rect) { 34 void FloatClipDisplayItem::SetNew(const gfx::RectF& clip_rect) {
36 clip_rect_ = clip_rect; 35 clip_rect_ = clip_rect;
37 } 36 }
38 37
39 void FloatClipDisplayItem::ToProtobuf( 38 void FloatClipDisplayItem::ToProtobuf(proto::DisplayItem* proto) const {
40 proto::DisplayItem* proto,
41 ImageSerializationProcessor* image_serialization_processor) const {
42 proto->set_type(proto::DisplayItem::Type_FloatClip); 39 proto->set_type(proto::DisplayItem::Type_FloatClip);
43 40
44 proto::FloatClipDisplayItem* details = proto->mutable_float_clip_item(); 41 proto::FloatClipDisplayItem* details = proto->mutable_float_clip_item();
45 RectFToProto(clip_rect_, details->mutable_clip_rect()); 42 RectFToProto(clip_rect_, details->mutable_clip_rect());
46 } 43 }
47 44
48 void FloatClipDisplayItem::Raster(SkCanvas* canvas, 45 void FloatClipDisplayItem::Raster(SkCanvas* canvas,
49 SkPicture::AbortCallback* callback) const { 46 SkPicture::AbortCallback* callback) const {
50 canvas->save(); 47 canvas->save();
51 canvas->clipRect(gfx::RectFToSkRect(clip_rect_)); 48 canvas->clipRect(gfx::RectFToSkRect(clip_rect_));
(...skipping 14 matching lines...) Expand all
66 EndFloatClipDisplayItem::EndFloatClipDisplayItem() {} 63 EndFloatClipDisplayItem::EndFloatClipDisplayItem() {}
67 64
68 EndFloatClipDisplayItem::EndFloatClipDisplayItem( 65 EndFloatClipDisplayItem::EndFloatClipDisplayItem(
69 const proto::DisplayItem& proto) { 66 const proto::DisplayItem& proto) {
70 DCHECK_EQ(proto::DisplayItem::Type_EndFloatClip, proto.type()); 67 DCHECK_EQ(proto::DisplayItem::Type_EndFloatClip, proto.type());
71 } 68 }
72 69
73 EndFloatClipDisplayItem::~EndFloatClipDisplayItem() { 70 EndFloatClipDisplayItem::~EndFloatClipDisplayItem() {
74 } 71 }
75 72
76 void EndFloatClipDisplayItem::ToProtobuf( 73 void EndFloatClipDisplayItem::ToProtobuf(proto::DisplayItem* proto) const {
77 proto::DisplayItem* proto,
78 ImageSerializationProcessor* image_serialization_processor) const {
79 proto->set_type(proto::DisplayItem::Type_EndFloatClip); 74 proto->set_type(proto::DisplayItem::Type_EndFloatClip);
80 } 75 }
81 76
82 void EndFloatClipDisplayItem::Raster( 77 void EndFloatClipDisplayItem::Raster(
83 SkCanvas* canvas, 78 SkCanvas* canvas,
84 SkPicture::AbortCallback* callback) const { 79 SkPicture::AbortCallback* callback) const {
85 canvas->restore(); 80 canvas->restore();
86 } 81 }
87 82
88 void EndFloatClipDisplayItem::AsValueInto( 83 void EndFloatClipDisplayItem::AsValueInto(
89 const gfx::Rect& visual_rect, 84 const gfx::Rect& visual_rect,
90 base::trace_event::TracedValue* array) const { 85 base::trace_event::TracedValue* array) const {
91 array->AppendString( 86 array->AppendString(
92 base::StringPrintf("EndFloatClipDisplayItem visualRect: [%s]", 87 base::StringPrintf("EndFloatClipDisplayItem visualRect: [%s]",
93 visual_rect.ToString().c_str())); 88 visual_rect.ToString().c_str()));
94 } 89 }
95 90
96 size_t EndFloatClipDisplayItem::ExternalMemoryUsage() const { 91 size_t EndFloatClipDisplayItem::ExternalMemoryUsage() const {
97 return 0; 92 return 0;
98 } 93 }
99 94
100 } // namespace cc 95 } // namespace cc
OLDNEW
« no previous file with comments | « cc/playback/float_clip_display_item.h ('k') | cc/playback/recording_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698