| 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 "ui/compositor/transform_recorder.h" | 5 #include "ui/compositor/transform_recorder.h" |
| 6 | 6 |
| 7 #include "cc/playback/display_item_list.h" | 7 #include "cc/playback/display_item_list.h" |
| 8 #include "cc/playback/transform_display_item.h" | 8 #include "cc/playback/transform_display_item.h" |
| 9 #include "ui/compositor/paint_context.h" | 9 #include "ui/compositor/paint_context.h" |
| 10 | 10 |
| 11 namespace ui { | 11 namespace ui { |
| 12 | 12 |
| 13 TransformRecorder::TransformRecorder(const PaintContext& context, | 13 TransformRecorder::TransformRecorder(const PaintContext& context, |
| 14 const gfx::Size& size_in_layer) | 14 const gfx::Size& size_in_layer) |
| 15 : context_(context), | 15 : context_(context), |
| 16 bounds_in_layer_(context.ToLayerSpaceBounds(size_in_layer)), | 16 bounds_in_layer_(context.ToLayerSpaceBounds(size_in_layer)), |
| 17 transformed_(false) {} | 17 transformed_(false) {} |
| 18 | 18 |
| 19 TransformRecorder::~TransformRecorder() { | 19 TransformRecorder::~TransformRecorder() { |
| 20 if (transformed_) | 20 if (transformed_) |
| 21 context_.list_->CreateAndAppendItem<cc::EndTransformDisplayItem>( | 21 context_.list_->CreateAndAppendItem<cc::EndTransformDisplayItem>( |
| 22 bounds_in_layer_); | 22 bounds_in_layer_); |
| 23 } | 23 } |
| 24 | 24 |
| 25 void TransformRecorder::Transform(const gfx::Transform& transform) { | 25 void TransformRecorder::Transform(const gfx::Transform& transform) { |
| 26 DCHECK(!transformed_); | 26 DCHECK(!transformed_); |
| 27 auto* item = context_.list_->CreateAndAppendItem<cc::TransformDisplayItem>( | 27 context_.list_->CreateAndAppendItem<cc::TransformDisplayItem>( |
| 28 bounds_in_layer_); | 28 bounds_in_layer_, transform); |
| 29 item->SetNew(transform); | |
| 30 transformed_ = true; | 29 transformed_ = true; |
| 31 } | 30 } |
| 32 | 31 |
| 33 } // namespace ui | 32 } // namespace ui |
| OLD | NEW |