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 #ifndef UI_COMPOSITOR_TRANSFORM_RECORDER_H_ | 5 #ifndef UI_COMPOSITOR_TRANSFORM_RECORDER_H_ |
6 #define UI_COMPOSITOR_TRANSFORM_RECORDER_H_ | 6 #define UI_COMPOSITOR_TRANSFORM_RECORDER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "ui/compositor/compositor_export.h" | 9 #include "ui/compositor/compositor_export.h" |
10 #include "ui/gfx/geometry/rect.h" | |
11 | 10 |
12 namespace cc { | 11 namespace cc { |
13 class DisplayItem; | 12 class DisplayItem; |
14 class DisplayItemList; | 13 class DisplayItemList; |
15 } | 14 } |
16 | 15 |
17 namespace gfx { | 16 namespace gfx { |
18 class Size; | |
19 class Transform; | 17 class Transform; |
20 } | 18 } |
21 | 19 |
22 namespace ui { | 20 namespace ui { |
23 class PaintContext; | 21 class PaintContext; |
24 | 22 |
25 // A class to provide scoped transforms of painting to a DisplayItemList. The | 23 // A class to provide scoped transforms of painting to a DisplayItemList. The |
26 // transform provided will be applied to any DisplayItems added to the | 24 // transform provided will be applied to any DisplayItems added to the |
27 // DisplayItemList while this object is alive. In other words, any nested | 25 // DisplayItemList while this object is alive. In other words, any nested |
28 // recorders will be transformed. | 26 // recorders will be transformed. |
29 class COMPOSITOR_EXPORT TransformRecorder { | 27 class COMPOSITOR_EXPORT TransformRecorder { |
30 public: | 28 public: |
31 explicit TransformRecorder(const PaintContext& context); | 29 explicit TransformRecorder(const PaintContext& context); |
32 ~TransformRecorder(); | 30 ~TransformRecorder(); |
33 | 31 |
34 // |size_in_context| is the size in the paint context's space surrounding | 32 void Transform(const gfx::Transform& transform); |
35 // everything that's visible. | |
36 void Transform(const gfx::Transform& transform, | |
37 const gfx::Size& size_in_context); | |
38 | 33 |
39 private: | 34 private: |
40 const PaintContext& context_; | 35 const PaintContext& context_; |
41 gfx::Rect bounds_in_layer_; | |
42 bool transformed_; | 36 bool transformed_; |
43 | 37 |
44 DISALLOW_COPY_AND_ASSIGN(TransformRecorder); | 38 DISALLOW_COPY_AND_ASSIGN(TransformRecorder); |
45 }; | 39 }; |
46 | 40 |
47 } // namespace ui | 41 } // namespace ui |
48 | 42 |
49 #endif // UI_COMPOSITOR_TRANSFORM_RECORDER_H_ | 43 #endif // UI_COMPOSITOR_TRANSFORM_RECORDER_H_ |
OLD | NEW |