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

Side by Side Diff: cc/playback/transform_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/transform_display_item.h ('k') | cc/proto/BUILD.gn » ('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/playback/transform_display_item.h" 5 #include "cc/playback/transform_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 12
15 namespace cc { 13 namespace cc {
16 14
17 TransformDisplayItem::TransformDisplayItem(const gfx::Transform& transform) 15 TransformDisplayItem::TransformDisplayItem(const gfx::Transform& transform)
18 : DisplayItem(TRANSFORM), transform_(gfx::Transform::kSkipInitialization) { 16 : DisplayItem(TRANSFORM), transform_(gfx::Transform::kSkipInitialization) {
19 SetNew(transform); 17 SetNew(transform);
20 } 18 }
21 19
22 TransformDisplayItem::TransformDisplayItem(const proto::DisplayItem& proto)
23 : DisplayItem(TRANSFORM) {
24 DCHECK_EQ(proto::DisplayItem::Type_Transform, proto.type());
25
26 const proto::TransformDisplayItem& details = proto.transform_item();
27 gfx::Transform transform = ProtoToTransform(details.transform());
28
29 SetNew(transform);
30 }
31
32 TransformDisplayItem::~TransformDisplayItem() { 20 TransformDisplayItem::~TransformDisplayItem() {
33 } 21 }
34 22
35 void TransformDisplayItem::SetNew(const gfx::Transform& transform) { 23 void TransformDisplayItem::SetNew(const gfx::Transform& transform) {
36 transform_ = transform; 24 transform_ = transform;
37 } 25 }
38 26
39 void TransformDisplayItem::ToProtobuf(proto::DisplayItem* proto) const {
40 proto->set_type(proto::DisplayItem::Type_Transform);
41
42 proto::TransformDisplayItem* details = proto->mutable_transform_item();
43 TransformToProto(transform_, details->mutable_transform());
44 }
45
46 void TransformDisplayItem::Raster(SkCanvas* canvas, 27 void TransformDisplayItem::Raster(SkCanvas* canvas,
47 SkPicture::AbortCallback* callback) const { 28 SkPicture::AbortCallback* callback) const {
48 canvas->save(); 29 canvas->save();
49 if (!transform_.IsIdentity()) 30 if (!transform_.IsIdentity())
50 canvas->concat(transform_.matrix()); 31 canvas->concat(transform_.matrix());
51 } 32 }
52 33
53 void TransformDisplayItem::AsValueInto( 34 void TransformDisplayItem::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 "TransformDisplayItem transform: [%s] visualRect: [%s]", 38 "TransformDisplayItem transform: [%s] visualRect: [%s]",
58 transform_.ToString().c_str(), visual_rect.ToString().c_str())); 39 transform_.ToString().c_str(), visual_rect.ToString().c_str()));
59 } 40 }
60 41
61 EndTransformDisplayItem::EndTransformDisplayItem() 42 EndTransformDisplayItem::EndTransformDisplayItem()
62 : DisplayItem(END_TRANSFORM) {} 43 : DisplayItem(END_TRANSFORM) {}
63 44
64 EndTransformDisplayItem::EndTransformDisplayItem(
65 const proto::DisplayItem& proto)
66 : DisplayItem(END_TRANSFORM) {
67 DCHECK_EQ(proto::DisplayItem::Type_EndTransform, proto.type());
68 }
69
70 EndTransformDisplayItem::~EndTransformDisplayItem() { 45 EndTransformDisplayItem::~EndTransformDisplayItem() {
71 } 46 }
72 47
73 void EndTransformDisplayItem::ToProtobuf(proto::DisplayItem* proto) const {
74 proto->set_type(proto::DisplayItem::Type_EndTransform);
75 }
76
77 void EndTransformDisplayItem::Raster( 48 void EndTransformDisplayItem::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 EndTransformDisplayItem::AsValueInto( 54 void EndTransformDisplayItem::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("EndTransformDisplayItem visualRect: [%s]", 58 base::StringPrintf("EndTransformDisplayItem 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/transform_display_item.h ('k') | cc/proto/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698