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_COMPOSITING_RECORDER_H_ | 5 #ifndef UI_COMPOSITOR_COMPOSITING_RECORDER_H_ |
6 #define UI_COMPOSITOR_COMPOSITING_RECORDER_H_ | 6 #define UI_COMPOSITOR_COMPOSITING_RECORDER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "ui/compositor/compositor_export.h" | 11 #include "ui/compositor/compositor_export.h" |
12 #include "ui/gfx/geometry/rect.h" | |
13 | |
14 namespace gfx { | |
15 class Size; | |
16 } | |
17 | 12 |
18 namespace ui { | 13 namespace ui { |
19 class PaintContext; | 14 class PaintContext; |
20 | 15 |
21 // A class to provide scoped compositing filters (eg opacity) of painting to a | 16 // A class to provide scoped compositing filters (eg opacity) of painting to a |
22 // DisplayItemList. The filters provided will be applied to any | 17 // DisplayItemList. The filters provided will be applied to any |
23 // DisplayItems added to the DisplayItemList while this object is alive. In | 18 // DisplayItems added to the DisplayItemList while this object is alive. In |
24 // other words, any nested PaintRecorders or other such Recorders will | 19 // other words, any nested PaintRecorders or other such Recorders will |
25 // be filtered by the effect. | 20 // be filtered by the effect. |
26 class COMPOSITOR_EXPORT CompositingRecorder { | 21 class COMPOSITOR_EXPORT CompositingRecorder { |
27 public: | 22 public: |
28 // |alpha| is a value between 0 and 255, where 0 is transparent and 255 is | 23 // |alpha| is a value between 0 and 255, where 0 is transparent and 255 is |
29 // opaque. |size_in_context| is the size in the |context|'s space surrounding | 24 // opaque. |size_in_context| is the size in the |context|'s space surrounding |
30 // everything that's visible. |lcd_text_requires_opaque_layer| should | 25 // everything that's visible. |lcd_text_requires_opaque_layer| should |
31 // normally be true; if this is false, Skia will respect text rendering | 26 // normally be true; if this is false, Skia will respect text rendering |
32 // requests for LCD AA even if they occur on non-opaque layers. This should | 27 // requests for LCD AA even if they occur on non-opaque layers. This should |
33 // only be used in cases where the text is known to be rendered opaquely on an | 28 // only be used in cases where the text is known to be rendered opaquely on an |
34 // opaque background before compositing. | 29 // opaque background before compositing. |
35 CompositingRecorder(const PaintContext& context, | 30 CompositingRecorder(const PaintContext& context, |
36 const gfx::Size& size_in_context, | |
37 uint8_t alpha, | 31 uint8_t alpha, |
38 bool lcd_text_requires_opaque_layer); | 32 bool lcd_text_requires_opaque_layer); |
39 ~CompositingRecorder(); | 33 ~CompositingRecorder(); |
40 | 34 |
41 private: | 35 private: |
42 const PaintContext& context_; | 36 const PaintContext& context_; |
43 const gfx::Rect bounds_in_layer_; | |
44 bool saved_; | 37 bool saved_; |
45 | 38 |
46 DISALLOW_COPY_AND_ASSIGN(CompositingRecorder); | 39 DISALLOW_COPY_AND_ASSIGN(CompositingRecorder); |
47 }; | 40 }; |
48 | 41 |
49 } // namespace ui | 42 } // namespace ui |
50 | 43 |
51 #endif // UI_COMPOSITOR_CLIP_TRANSFORM_RECORDER_H_ | 44 #endif // UI_COMPOSITOR_CLIP_TRANSFORM_RECORDER_H_ |
OLD | NEW |