| OLD | NEW |
| 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/compositing_display_item.h" | 5 #include "cc/playback/compositing_display_item.h" |
| 6 | 6 |
| 7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "base/trace_event/trace_event_argument.h" | 8 #include "base/trace_event/trace_event_argument.h" |
| 9 #include "cc/proto/display_item.pb.h" | 9 #include "cc/proto/display_item.pb.h" |
| 10 #include "cc/proto/gfx_conversions.h" | 10 #include "cc/proto/gfx_conversions.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 const gfx::Rect& canvas_target_playback_rect, | 87 const gfx::Rect& canvas_target_playback_rect, |
| 88 SkPicture::AbortCallback* callback) const { | 88 SkPicture::AbortCallback* callback) const { |
| 89 SkPaint paint; | 89 SkPaint paint; |
| 90 paint.setXfermodeMode(xfermode_); | 90 paint.setXfermodeMode(xfermode_); |
| 91 paint.setAlpha(alpha_); | 91 paint.setAlpha(alpha_); |
| 92 paint.setColorFilter(color_filter_.get()); | 92 paint.setColorFilter(color_filter_.get()); |
| 93 canvas->saveLayer(has_bounds_ ? &bounds_ : nullptr, &paint); | 93 canvas->saveLayer(has_bounds_ ? &bounds_ : nullptr, &paint); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void CompositingDisplayItem::AsValueInto( | 96 void CompositingDisplayItem::AsValueInto( |
| 97 const gfx::Rect& visual_rect, |
| 97 base::trace_event::TracedValue* array) const { | 98 base::trace_event::TracedValue* array) const { |
| 98 array->AppendString(base::StringPrintf( | 99 array->AppendString(base::StringPrintf( |
| 99 "CompositingDisplayItem alpha: %d, xfermode: %d", alpha_, xfermode_)); | 100 "CompositingDisplayItem alpha: %d, xfermode: %d, visualRect: [%s]", |
| 101 alpha_, xfermode_, visual_rect.ToString().c_str())); |
| 100 if (has_bounds_) | 102 if (has_bounds_) |
| 101 array->AppendString(base::StringPrintf( | 103 array->AppendString(base::StringPrintf( |
| 102 ", bounds: [%f, %f, %f, %f]", static_cast<float>(bounds_.x()), | 104 ", bounds: [%f, %f, %f, %f]", static_cast<float>(bounds_.x()), |
| 103 static_cast<float>(bounds_.y()), static_cast<float>(bounds_.width()), | 105 static_cast<float>(bounds_.y()), static_cast<float>(bounds_.width()), |
| 104 static_cast<float>(bounds_.height()))); | 106 static_cast<float>(bounds_.height()))); |
| 105 } | 107 } |
| 106 | 108 |
| 107 EndCompositingDisplayItem::EndCompositingDisplayItem() { | 109 EndCompositingDisplayItem::EndCompositingDisplayItem() { |
| 108 DisplayItem::SetNew(true /* suitable_for_gpu_raster */, 0 /* op_count */, | 110 DisplayItem::SetNew(true /* suitable_for_gpu_raster */, 0 /* op_count */, |
| 109 0 /* external_memory_usage */); | 111 0 /* external_memory_usage */); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 121 } | 123 } |
| 122 | 124 |
| 123 void EndCompositingDisplayItem::Raster( | 125 void EndCompositingDisplayItem::Raster( |
| 124 SkCanvas* canvas, | 126 SkCanvas* canvas, |
| 125 const gfx::Rect& canvas_target_playback_rect, | 127 const gfx::Rect& canvas_target_playback_rect, |
| 126 SkPicture::AbortCallback* callback) const { | 128 SkPicture::AbortCallback* callback) const { |
| 127 canvas->restore(); | 129 canvas->restore(); |
| 128 } | 130 } |
| 129 | 131 |
| 130 void EndCompositingDisplayItem::AsValueInto( | 132 void EndCompositingDisplayItem::AsValueInto( |
| 133 const gfx::Rect& visual_rect, |
| 131 base::trace_event::TracedValue* array) const { | 134 base::trace_event::TracedValue* array) const { |
| 132 array->AppendString("EndCompositingDisplayItem"); | 135 array->AppendString( |
| 136 base::StringPrintf("EndCompositingDisplayItem visualRect: [%s]", |
| 137 visual_rect.ToString().c_str())); |
| 133 } | 138 } |
| 134 | 139 |
| 135 } // namespace cc | 140 } // namespace cc |
| OLD | NEW |