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