| 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_PAINT_CONTEXT_H_ | 5 #ifndef UI_COMPOSITOR_PAINT_CONTEXT_H_ |
| 6 #define UI_COMPOSITOR_PAINT_CONTEXT_H_ | 6 #define UI_COMPOSITOR_PAINT_CONTEXT_H_ |
| 7 | 7 |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "ui/compositor/compositor_export.h" | 10 #include "ui/compositor/compositor_export.h" |
| 11 #include "ui/gfx/geometry/rect.h" | 11 #include "ui/gfx/geometry/rect.h" |
| 12 | 12 |
| 13 namespace cc { | 13 namespace cc { |
| 14 class DisplayItemList; | 14 class DisplayItemList; |
| 15 } | 15 } |
| 16 | 16 |
| 17 namespace gfx { | 17 namespace gfx { |
| 18 class Canvas; | 18 class Canvas; |
| 19 } | 19 } |
| 20 | 20 |
| 21 class SkPictureRecorder; | 21 class SkPictureRecorder; |
| 22 | 22 |
| 23 namespace ui { | 23 namespace ui { |
| 24 class ClipTransformRecorder; | 24 class ClipRecorder; |
| 25 class CompositingRecorder; | 25 class CompositingRecorder; |
| 26 class PaintRecorder; | 26 class PaintRecorder; |
| 27 class TransformRecorder; |
| 27 | 28 |
| 28 class COMPOSITOR_EXPORT PaintContext { | 29 class COMPOSITOR_EXPORT PaintContext { |
| 29 public: | 30 public: |
| 30 // Construct a PaintContext that may only re-paint the area in the | 31 // Construct a PaintContext that may only re-paint the area in the |
| 31 // |invalidation|. | 32 // |invalidation|. |
| 32 PaintContext(cc::DisplayItemList* list, | 33 PaintContext(cc::DisplayItemList* list, |
| 33 float device_scale_factor, | 34 float device_scale_factor, |
| 34 const gfx::Rect& invalidation); | 35 const gfx::Rect& invalidation); |
| 35 | 36 |
| 36 // Clone a PaintContext with an additional |offset|. | 37 // Clone a PaintContext with an additional |offset|. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 64 void* RootVisited() const { return root_visited_; } | 65 void* RootVisited() const { return root_visited_; } |
| 65 const gfx::Vector2d& PaintOffset() const { return offset_; } | 66 const gfx::Vector2d& PaintOffset() const { return offset_; } |
| 66 #endif | 67 #endif |
| 67 | 68 |
| 68 const gfx::Rect& InvalidationForTesting() const { return invalidation_; } | 69 const gfx::Rect& InvalidationForTesting() const { return invalidation_; } |
| 69 | 70 |
| 70 private: | 71 private: |
| 71 // The Recorder classes need access to the internal canvas and friends, but we | 72 // The Recorder classes need access to the internal canvas and friends, but we |
| 72 // don't want to expose them on this class so that people must go through the | 73 // don't want to expose them on this class so that people must go through the |
| 73 // recorders to access them. | 74 // recorders to access them. |
| 74 friend class ClipTransformRecorder; | 75 friend class ClipRecorder; |
| 75 friend class CompositingRecorder; | 76 friend class CompositingRecorder; |
| 76 friend class PaintRecorder; | 77 friend class PaintRecorder; |
| 78 friend class TransformRecorder; |
| 77 // The Cache class also needs to access the DisplayItemList to append its | 79 // The Cache class also needs to access the DisplayItemList to append its |
| 78 // cache contents. | 80 // cache contents. |
| 79 friend class PaintCache; | 81 friend class PaintCache; |
| 80 | 82 |
| 81 cc::DisplayItemList* list_; | 83 cc::DisplayItemList* list_; |
| 82 scoped_ptr<SkPictureRecorder> owned_recorder_; | 84 scoped_ptr<SkPictureRecorder> owned_recorder_; |
| 83 // A pointer to the |owned_recorder_| in this PaintContext, or in another one | 85 // A pointer to the |owned_recorder_| in this PaintContext, or in another one |
| 84 // which this was copied from. We expect a copied-from PaintContext to outlive | 86 // which this was copied from. We expect a copied-from PaintContext to outlive |
| 85 // copies made from it. | 87 // copies made from it. |
| 86 SkPictureRecorder* recorder_; | 88 SkPictureRecorder* recorder_; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 102 // recorder is active. | 104 // recorder is active. |
| 103 mutable bool inside_paint_recorder_; | 105 mutable bool inside_paint_recorder_; |
| 104 #endif | 106 #endif |
| 105 | 107 |
| 106 DISALLOW_COPY_AND_ASSIGN(PaintContext); | 108 DISALLOW_COPY_AND_ASSIGN(PaintContext); |
| 107 }; | 109 }; |
| 108 | 110 |
| 109 } // namespace ui | 111 } // namespace ui |
| 110 | 112 |
| 111 #endif // UI_COMPOSITOR_PAINT_CONTEXT_H_ | 113 #endif // UI_COMPOSITOR_PAINT_CONTEXT_H_ |
| OLD | NEW |