Chromium Code Reviews| 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_CLIP_TRANSFORM_RECORDER_H_ | 5 #ifndef UI_COMPOSITOR_CLIP_RECORDER_H_ |
| 6 #define UI_COMPOSITOR_CLIP_TRANSFORM_RECORDER_H_ | 6 #define UI_COMPOSITOR_CLIP_RECORDER_H_ |
| 7 | |
| 8 #include <vector> | |
| 9 | 7 |
| 10 #include "base/macros.h" | 8 #include "base/macros.h" |
| 11 #include "ui/compositor/compositor_export.h" | 9 #include "ui/compositor/compositor_export.h" |
| 12 | 10 |
| 13 namespace cc { | 11 namespace cc { |
| 14 class DisplayItem; | 12 class DisplayItem; |
| 15 class DisplayItemList; | 13 class DisplayItemList; |
| 16 } | 14 } |
| 17 | 15 |
| 18 namespace gfx { | 16 namespace gfx { |
| 19 class Path; | 17 class Path; |
| 20 class Rect; | 18 class Rect; |
| 21 class Transform; | |
| 22 } | 19 } |
| 23 | 20 |
| 24 namespace ui { | 21 namespace ui { |
| 25 class PaintContext; | 22 class PaintContext; |
| 26 | 23 |
| 27 // A class to provide scoped clips and transforms of painting to a | 24 // A class to provide scoped clips of painting to a |
|
danakj
2015/11/23 23:20:30
use the full 80 cols
wkorman
2015/11/23 23:38:08
Done.
| |
| 28 // DisplayItemList. The the clip/transform provided will be applied to any | 25 // DisplayItemList. The clip provided will be applied to any |
| 29 // DisplayItems added to the DisplayItemList while this object is alive. In | 26 // DisplayItems added to the DisplayItemList while this object is |
| 30 // other words, any nested PaintRecorders or other ClipTransformRecorders will | 27 // alive. In other words, any nested PaintRecorders or other |
| 31 // be clipped/transformed. | 28 // ClipRecorders will be clipped. |
| 32 class COMPOSITOR_EXPORT ClipTransformRecorder { | 29 class COMPOSITOR_EXPORT ClipRecorder { |
| 33 public: | 30 public: |
| 34 explicit ClipTransformRecorder(const PaintContext& context); | 31 explicit ClipRecorder(const PaintContext& context); |
| 35 ~ClipTransformRecorder(); | 32 ~ClipRecorder(); |
| 36 | 33 |
| 37 void ClipRect(const gfx::Rect& clip_rect); | 34 void ClipRect(const gfx::Rect& clip_rect); |
| 38 void ClipPath(const gfx::Path& clip_path); | 35 void ClipPath(const gfx::Path& clip_path); |
| 39 void ClipPathWithAntiAliasing(const gfx::Path& clip_path); | 36 void ClipPathWithAntiAliasing(const gfx::Path& clip_path); |
| 40 void Transform(const gfx::Transform& transform); | |
| 41 | 37 |
| 42 private: | 38 private: |
| 43 enum Closer { | 39 enum Closer { |
| 44 CLIP_RECT, | 40 CLIP_RECT, |
| 45 CLIP_PATH, | 41 CLIP_PATH, |
| 46 TRANSFORM, | |
| 47 }; | 42 }; |
| 48 const PaintContext& context_; | 43 const PaintContext& context_; |
| 49 // If someone needs to do more than this many operations with a single | 44 // If someone needs to do more than this many operations with a single |
| 50 // ClipTransformRecorder then increase the size of the closers_ array. | 45 // ClipRecorder then increase the size of the closers_ array. |
| 51 Closer closers_[4]; | 46 Closer closers_[4]; |
| 52 size_t num_closers_; | 47 size_t num_closers_; |
| 53 | 48 |
| 54 DISALLOW_COPY_AND_ASSIGN(ClipTransformRecorder); | 49 DISALLOW_COPY_AND_ASSIGN(ClipRecorder); |
| 55 }; | 50 }; |
| 56 | 51 |
| 57 } // namespace ui | 52 } // namespace ui |
| 58 | 53 |
| 59 #endif // UI_COMPOSITOR_CLIP_TRANSFORM_RECORDER_H_ | 54 #endif // UI_COMPOSITOR_CLIP_RECORDER_H_ |
| OLD | NEW |