| OLD | NEW |
| 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 <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 if (rounded_clip_rects_[i].isRect()) { | 69 if (rounded_clip_rects_[i].isRect()) { |
| 70 canvas->clipRect(rounded_clip_rects_[i].rect()); | 70 canvas->clipRect(rounded_clip_rects_[i].rect()); |
| 71 } else { | 71 } else { |
| 72 bool antialiased = true; | 72 bool antialiased = true; |
| 73 canvas->clipRRect(rounded_clip_rects_[i], SkRegion::kIntersect_Op, | 73 canvas->clipRRect(rounded_clip_rects_[i], SkRegion::kIntersect_Op, |
| 74 antialiased); | 74 antialiased); |
| 75 } | 75 } |
| 76 } | 76 } |
| 77 } | 77 } |
| 78 | 78 |
| 79 void ClipDisplayItem::AsValueInto(base::trace_event::TracedValue* array) const { | 79 void ClipDisplayItem::AsValueInto(const gfx::Rect& visual_rect, |
| 80 std::string value = base::StringPrintf("ClipDisplayItem rect: [%s]", | 80 base::trace_event::TracedValue* array) const { |
| 81 clip_rect_.ToString().c_str()); | 81 std::string value = base::StringPrintf( |
| 82 "ClipDisplayItem rect: [%s] visualRect: [%s]", |
| 83 clip_rect_.ToString().c_str(), visual_rect.ToString().c_str()); |
| 82 for (const SkRRect& rounded_rect : rounded_clip_rects_) { | 84 for (const SkRRect& rounded_rect : rounded_clip_rects_) { |
| 83 base::StringAppendF( | 85 base::StringAppendF( |
| 84 &value, " rounded_rect: [rect: [%s]", | 86 &value, " rounded_rect: [rect: [%s]", |
| 85 gfx::SkRectToRectF(rounded_rect.rect()).ToString().c_str()); | 87 gfx::SkRectToRectF(rounded_rect.rect()).ToString().c_str()); |
| 86 base::StringAppendF(&value, " radii: ["); | 88 base::StringAppendF(&value, " radii: ["); |
| 87 SkVector upper_left_radius = rounded_rect.radii(SkRRect::kUpperLeft_Corner); | 89 SkVector upper_left_radius = rounded_rect.radii(SkRRect::kUpperLeft_Corner); |
| 88 base::StringAppendF(&value, "[%f,%f],", upper_left_radius.x(), | 90 base::StringAppendF(&value, "[%f,%f],", upper_left_radius.x(), |
| 89 upper_left_radius.y()); | 91 upper_left_radius.y()); |
| 90 SkVector upper_right_radius = | 92 SkVector upper_right_radius = |
| 91 rounded_rect.radii(SkRRect::kUpperRight_Corner); | 93 rounded_rect.radii(SkRRect::kUpperRight_Corner); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 118 DCHECK_EQ(proto::DisplayItem::Type_EndClip, proto.type()); | 120 DCHECK_EQ(proto::DisplayItem::Type_EndClip, proto.type()); |
| 119 } | 121 } |
| 120 | 122 |
| 121 void EndClipDisplayItem::Raster(SkCanvas* canvas, | 123 void EndClipDisplayItem::Raster(SkCanvas* canvas, |
| 122 const gfx::Rect& canvas_target_playback_rect, | 124 const gfx::Rect& canvas_target_playback_rect, |
| 123 SkPicture::AbortCallback* callback) const { | 125 SkPicture::AbortCallback* callback) const { |
| 124 canvas->restore(); | 126 canvas->restore(); |
| 125 } | 127 } |
| 126 | 128 |
| 127 void EndClipDisplayItem::AsValueInto( | 129 void EndClipDisplayItem::AsValueInto( |
| 130 const gfx::Rect& visual_rect, |
| 128 base::trace_event::TracedValue* array) const { | 131 base::trace_event::TracedValue* array) const { |
| 129 array->AppendString("EndClipDisplayItem"); | 132 array->AppendString(base::StringPrintf("EndClipDisplayItem visualRect: [%s]", |
| 133 visual_rect.ToString().c_str())); |
| 130 } | 134 } |
| 131 | 135 |
| 132 } // namespace cc | 136 } // namespace cc |
| OLD | NEW |