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_->CreateAndAppendItem<cc::EndTransformDisplayItem>( |
19 bounds_in_layer_); | 19 bounds_in_layer_); |
20 } | 20 } |
21 | 21 |
22 void TransformRecorder::Transform(const gfx::Transform& transform, | 22 void TransformRecorder::Transform(const gfx::Transform& transform, |
23 const gfx::Size& size_in_context) { | 23 const gfx::Size& size_in_context) { |
24 DCHECK(!transformed_); | 24 DCHECK(!transformed_); |
25 bounds_in_layer_ = context_.ToLayerSpaceBounds(size_in_context); | 25 bounds_in_layer_ = context_.ToLayerSpaceBounds(size_in_context); |
26 context_.list_->CreateAndAppendItem<cc::TransformDisplayItem>( | 26 auto* item = context_.list_->CreateAndAppendItem<cc::TransformDisplayItem>( |
27 bounds_in_layer_, transform); | 27 bounds_in_layer_); |
| 28 item->SetNew(transform); |
28 transformed_ = true; | 29 transformed_ = true; |
29 } | 30 } |
30 | 31 |
31 } // namespace ui | 32 } // namespace ui |
OLD | NEW |