| 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 CC_OUTPUT_CA_LAYER_OVERLAY_H_ | 5 #ifndef CC_OUTPUT_CA_LAYER_OVERLAY_H_ |
| 6 #define CC_OUTPUT_CA_LAYER_OVERLAY_H_ | 6 #define CC_OUTPUT_CA_LAYER_OVERLAY_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" |
| 8 #include "cc/quads/render_pass.h" | 9 #include "cc/quads/render_pass.h" |
| 9 #include "third_party/skia/include/core/SkColor.h" | 10 #include "third_party/skia/include/core/SkColor.h" |
| 10 #include "third_party/skia/include/core/SkMatrix44.h" | 11 #include "third_party/skia/include/core/SkMatrix44.h" |
| 11 #include "ui/gfx/geometry/rect_f.h" | 12 #include "ui/gfx/geometry/rect_f.h" |
| 12 | 13 |
| 13 namespace cc { | 14 namespace cc { |
| 14 | 15 |
| 15 class DrawQuad; | 16 class DrawQuad; |
| 16 class ResourceProvider; | 17 class ResourceProvider; |
| 17 | 18 |
| 19 // Holds information that is frequently shared between consecutive |
| 20 // CALayerOverlays. |
| 21 class CC_EXPORT CALayerOverlaySharedState |
| 22 : public base::RefCounted<CALayerOverlaySharedState> { |
| 23 public: |
| 24 CALayerOverlaySharedState() {} |
| 25 |
| 26 // Layers in a non-zero sorting context exist in the same 3D space and should |
| 27 // intersect. |
| 28 unsigned sorting_context_id = 0; |
| 29 // If |is_clipped| is true, then clip to |clip_rect| in the target space. |
| 30 bool is_clipped = false; |
| 31 gfx::RectF clip_rect; |
| 32 // The opacity property for the CAayer. |
| 33 float opacity = 1; |
| 34 // The transform to apply to the CALayer. |
| 35 SkMatrix44 transform = SkMatrix44(SkMatrix44::kIdentity_Constructor); |
| 36 |
| 37 private: |
| 38 friend class base::RefCounted<CALayerOverlaySharedState>; |
| 39 ~CALayerOverlaySharedState() {} |
| 40 }; |
| 41 |
| 42 // Holds all information necessary to construct a CALayer from a DrawQuad. |
| 18 class CC_EXPORT CALayerOverlay { | 43 class CC_EXPORT CALayerOverlay { |
| 19 public: | 44 public: |
| 20 CALayerOverlay(); | 45 CALayerOverlay(); |
| 21 CALayerOverlay(const CALayerOverlay& other); | 46 CALayerOverlay(const CALayerOverlay& other); |
| 22 ~CALayerOverlay(); | 47 ~CALayerOverlay(); |
| 23 | 48 |
| 24 // If |is_clipped| is true, then clip to |clip_rect| in the target space. | 49 // State that is frequently shared between consecutive CALayerOverlays. |
| 25 bool is_clipped = false; | 50 scoped_refptr<CALayerOverlaySharedState> shared_state; |
| 26 gfx::RectF clip_rect; | 51 |
| 27 // Layers in a non-zero sorting context exist in the same 3D space and should | |
| 28 // intersect. | |
| 29 unsigned sorting_context_id = 0; | |
| 30 // Texture that corresponds to an IOSurface to set as the content of the | 52 // Texture that corresponds to an IOSurface to set as the content of the |
| 31 // CALayer. If this is 0 then the CALayer is a solid color. | 53 // CALayer. If this is 0 then the CALayer is a solid color. |
| 32 unsigned contents_resource_id = 0; | 54 unsigned contents_resource_id = 0; |
| 33 // The contents rect property for the CALayer. | 55 // The contents rect property for the CALayer. |
| 34 gfx::RectF contents_rect; | 56 gfx::RectF contents_rect; |
| 35 // The opacity property for the CAayer. | 57 // The bounds for the CALayer in pixels. |
| 36 float opacity = 1; | 58 gfx::RectF bounds_rect; |
| 37 // The background color property for the CALayer. | 59 // The background color property for the CALayer. |
| 38 SkColor background_color = SK_ColorTRANSPARENT; | 60 SkColor background_color = SK_ColorTRANSPARENT; |
| 39 // The edge anti-aliasing mask property for the CALayer. | 61 // The edge anti-aliasing mask property for the CALayer. |
| 40 unsigned edge_aa_mask = 0; | 62 unsigned edge_aa_mask = 0; |
| 41 // The bounds for the CALayer in pixels. | |
| 42 gfx::RectF bounds_rect; | |
| 43 // The transform to apply to the CALayer. | |
| 44 SkMatrix44 transform = SkMatrix44(SkMatrix44::kIdentity_Constructor); | |
| 45 // The minification and magnification filters for the CALayer. | 63 // The minification and magnification filters for the CALayer. |
| 46 unsigned filter; | 64 unsigned filter; |
| 47 }; | 65 }; |
| 48 | 66 |
| 49 typedef std::vector<CALayerOverlay> CALayerOverlayList; | 67 typedef std::vector<CALayerOverlay> CALayerOverlayList; |
| 50 | 68 |
| 51 // Returns true if all quads in the root render pass have been replaced by | 69 // Returns true if all quads in the root render pass have been replaced by |
| 52 // CALayerOverlays. | 70 // CALayerOverlays. |
| 53 bool ProcessForCALayerOverlays(ResourceProvider* resource_provider, | 71 bool ProcessForCALayerOverlays(ResourceProvider* resource_provider, |
| 54 const gfx::RectF& display_rect, | 72 const gfx::RectF& display_rect, |
| 55 const QuadList& quad_list, | 73 const QuadList& quad_list, |
| 56 CALayerOverlayList* ca_layer_overlays); | 74 CALayerOverlayList* ca_layer_overlays); |
| 57 | 75 |
| 58 } // namespace cc | 76 } // namespace cc |
| 59 | 77 |
| 60 #endif // CC_OUTPUT_CA_LAYER_OVERLAY_H_ | 78 #endif // CC_OUTPUT_CA_LAYER_OVERLAY_H_ |
| OLD | NEW |