| 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 : context_(context), transformed_(false) {} | 14 : context_(context), transformed_(false) {} |
| 15 | 15 |
| 16 TransformRecorder::~TransformRecorder() { | 16 TransformRecorder::~TransformRecorder() { |
| 17 if (transformed_) | 17 if (transformed_) |
| 18 context_.list_->CreateAndAppendItem<cc::EndTransformDisplayItem>( | 18 context_.list_->CreateAndAppendPairedEndItem<cc::EndTransformDisplayItem>(); |
| 19 bounds_in_layer_); | |
| 20 } | 19 } |
| 21 | 20 |
| 22 void TransformRecorder::Transform(const gfx::Transform& transform, | 21 void TransformRecorder::Transform(const gfx::Transform& transform) { |
| 23 const gfx::Size& size_in_context) { | |
| 24 DCHECK(!transformed_); | 22 DCHECK(!transformed_); |
| 25 bounds_in_layer_ = context_.ToLayerSpaceBounds(size_in_context); | 23 context_.list_->CreateAndAppendPairedBeginItem<cc::TransformDisplayItem>( |
| 26 context_.list_->CreateAndAppendItem<cc::TransformDisplayItem>( | 24 transform); |
| 27 bounds_in_layer_, transform); | |
| 28 transformed_ = true; | 25 transformed_ = true; |
| 29 } | 26 } |
| 30 | 27 |
| 31 } // namespace ui | 28 } // namespace ui |
| OLD | NEW |