| 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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "ui/compositor/compositor_export.h" | 10 #include "ui/compositor/compositor_export.h" |
| 11 #include "ui/gfx/geometry/rect.h" |
| 12 |
| 13 namespace gfx { |
| 14 class Size; |
| 15 } |
| 11 | 16 |
| 12 namespace ui { | 17 namespace ui { |
| 13 class PaintContext; | 18 class PaintContext; |
| 14 | 19 |
| 15 // A class to provide scoped compositing filters (eg opacity) of painting to a | 20 // A class to provide scoped compositing filters (eg opacity) of painting to a |
| 16 // DisplayItemList. The filters provided will be applied to any | 21 // DisplayItemList. The filters provided will be applied to any |
| 17 // DisplayItems added to the DisplayItemList while this object is alive. In | 22 // DisplayItems added to the DisplayItemList while this object is alive. In |
| 18 // other words, any nested PaintRecorders or other such Recorders will | 23 // other words, any nested PaintRecorders or other such Recorders will |
| 19 // be filtered by the effect. | 24 // be filtered by the effect. |
| 20 class COMPOSITOR_EXPORT CompositingRecorder { | 25 class COMPOSITOR_EXPORT CompositingRecorder { |
| 21 public: | 26 public: |
| 22 // |alpha| is a value between 0 and 255, where 0 is transparent and 255 is | 27 // |alpha| is a value between 0 and 255, where 0 is transparent and 255 is |
| 23 // opaque. | 28 // opaque. |
| 24 CompositingRecorder(const PaintContext& context, uint8_t alpha); | 29 CompositingRecorder(const PaintContext& context, |
| 30 const gfx::Size& size_in_layer, |
| 31 uint8_t alpha); |
| 25 ~CompositingRecorder(); | 32 ~CompositingRecorder(); |
| 26 | 33 |
| 27 private: | 34 private: |
| 28 const PaintContext& context_; | 35 const PaintContext& context_; |
| 36 const gfx::Rect layer_bounds_; |
| 29 bool saved_; | 37 bool saved_; |
| 30 | 38 |
| 31 DISALLOW_COPY_AND_ASSIGN(CompositingRecorder); | 39 DISALLOW_COPY_AND_ASSIGN(CompositingRecorder); |
| 32 }; | 40 }; |
| 33 | 41 |
| 34 } // namespace ui | 42 } // namespace ui |
| 35 | 43 |
| 36 #endif // UI_COMPOSITOR_CLIP_TRANSFORM_RECORDER_H_ | 44 #endif // UI_COMPOSITOR_CLIP_TRANSFORM_RECORDER_H_ |
| OLD | NEW |