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