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 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 "base/memory/ref_counted.h" |
| 9 #include "cc/base/resource_id.h" | |
| 9 #include "cc/quads/render_pass.h" | 10 #include "cc/quads/render_pass.h" |
| 10 #include "third_party/skia/include/core/SkColor.h" | 11 #include "third_party/skia/include/core/SkColor.h" |
| 11 #include "third_party/skia/include/core/SkMatrix44.h" | 12 #include "third_party/skia/include/core/SkMatrix44.h" |
| 12 #include "ui/gfx/geometry/rect_f.h" | 13 #include "ui/gfx/geometry/rect_f.h" |
| 13 | 14 |
| 14 namespace cc { | 15 namespace cc { |
| 15 | 16 |
| 16 class DrawQuad; | 17 class DrawQuad; |
| 17 class ResourceProvider; | 18 class ResourceProvider; |
| 18 | 19 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 31 gfx::RectF clip_rect; | 32 gfx::RectF clip_rect; |
| 32 // The opacity property for the CAayer. | 33 // The opacity property for the CAayer. |
| 33 float opacity = 1; | 34 float opacity = 1; |
| 34 // The transform to apply to the CALayer. | 35 // The transform to apply to the CALayer. |
| 35 SkMatrix44 transform = SkMatrix44(SkMatrix44::kIdentity_Constructor); | 36 SkMatrix44 transform = SkMatrix44(SkMatrix44::kIdentity_Constructor); |
| 36 | 37 |
| 37 private: | 38 private: |
| 38 friend class base::RefCounted<CALayerOverlaySharedState>; | 39 friend class base::RefCounted<CALayerOverlaySharedState>; |
| 39 ~CALayerOverlaySharedState() {} | 40 ~CALayerOverlaySharedState() {} |
| 40 }; | 41 }; |
| 41 | 42 |
|
ccameron
2016/07/20 05:32:19
I'd advocate just stuffing the CopyRenderPassDrawQ
erikchen
2016/07/20 21:48:01
Done.
| |
| 43 class RenderPassDrawQuadCopier { | |
| 44 public: | |
| 45 // On success, the resource will be marked as in-use and will not be reused | |
| 46 // until the gpu process has marked the resource as no longer in use. The | |
| 47 // caller is required to send the IOSurface to the gpu process. | |
| 48 virtual bool CopyRenderPassDrawQuadToIOSurface(const RenderPassDrawQuad* quad, | |
| 49 ResourceId* resource_id) = 0; | |
| 50 // Immediately releases the IOSurface-backed resources for reuse or deletion. | |
| 51 virtual void ReleaseIOSurfaces(const std::vector<ResourceId>& resources) = 0; | |
|
ccameron
2016/07/20 05:32:19
ReleaseIOSurfaces appears only to be called from w
erikchen
2016/07/20 21:48:01
Done.
| |
| 52 // Informs the RenderPassDrawQuadCopier of the number of copied IOSurfaces for | |
| 53 // the current frame, which will affect the IOSurface cache size. | |
| 54 virtual void UpdateCopyCountForFrame(size_t count) = 0; | |
|
ccameron
2016/07/20 05:32:19
This appears only to be called in testing code. Ca
erikchen
2016/07/20 21:48:01
Done.
| |
| 55 }; | |
| 56 | |
| 42 // Holds all information necessary to construct a CALayer from a DrawQuad. | 57 // Holds all information necessary to construct a CALayer from a DrawQuad. |
| 43 class CC_EXPORT CALayerOverlay { | 58 class CC_EXPORT CALayerOverlay { |
| 44 public: | 59 public: |
| 45 CALayerOverlay(); | 60 CALayerOverlay(); |
| 46 CALayerOverlay(const CALayerOverlay& other); | 61 CALayerOverlay(const CALayerOverlay& other); |
| 47 ~CALayerOverlay(); | 62 ~CALayerOverlay(); |
| 48 | 63 |
| 49 // State that is frequently shared between consecutive CALayerOverlays. | 64 // State that is frequently shared between consecutive CALayerOverlays. |
| 50 scoped_refptr<CALayerOverlaySharedState> shared_state; | 65 scoped_refptr<CALayerOverlaySharedState> shared_state; |
| 51 | 66 |
|
ccameron
2016/07/20 05:32:19
I think this would be easier if we had an enum for
erikchen
2016/07/20 21:48:01
Hm. I'm not sure how much that helps, since the co
| |
| 52 // Texture that corresponds to an IOSurface to set as the content of the | 67 // Texture that corresponds to an IOSurface to set as the content of the |
| 53 // CALayer. If this is 0 then the CALayer is a solid color. | 68 // CALayer. If this is 0 then the CALayer is a solid color. |
| 54 unsigned contents_resource_id = 0; | 69 unsigned contents_resource_id = 0; |
| 55 // The contents rect property for the CALayer. | 70 // The contents rect property for the CALayer. |
| 56 gfx::RectF contents_rect; | 71 gfx::RectF contents_rect; |
| 57 // The bounds for the CALayer in pixels. | 72 // The bounds for the CALayer in pixels. |
| 58 gfx::RectF bounds_rect; | 73 gfx::RectF bounds_rect; |
| 59 // The background color property for the CALayer. | 74 // The background color property for the CALayer. |
| 60 SkColor background_color = SK_ColorTRANSPARENT; | 75 SkColor background_color = SK_ColorTRANSPARENT; |
| 61 // The edge anti-aliasing mask property for the CALayer. | 76 // The edge anti-aliasing mask property for the CALayer. |
| 62 unsigned edge_aa_mask = 0; | 77 unsigned edge_aa_mask = 0; |
| 63 // The minification and magnification filters for the CALayer. | 78 // The minification and magnification filters for the CALayer. |
| 64 unsigned filter; | 79 unsigned filter; |
| 65 }; | 80 }; |
| 66 | 81 |
| 67 typedef std::vector<CALayerOverlay> CALayerOverlayList; | 82 typedef std::vector<CALayerOverlay> CALayerOverlayList; |
| 68 | 83 |
| 69 // Returns true if all quads in the root render pass have been replaced by | 84 // Returns true if all quads in the root render pass have been replaced by |
| 70 // CALayerOverlays. | 85 // CALayerOverlays. |
| 71 bool ProcessForCALayerOverlays(ResourceProvider* resource_provider, | 86 bool ProcessForCALayerOverlays(ResourceProvider* resource_provider, |
| 72 const gfx::RectF& display_rect, | 87 const gfx::RectF& display_rect, |
| 73 const QuadList& quad_list, | 88 const QuadList& quad_list, |
| 74 CALayerOverlayList* ca_layer_overlays); | 89 CALayerOverlayList* ca_layer_overlays); |
| 75 | 90 |
| 76 } // namespace cc | 91 } // namespace cc |
| 77 | 92 |
| 78 #endif // CC_OUTPUT_CA_LAYER_OVERLAY_H_ | 93 #endif // CC_OUTPUT_CA_LAYER_OVERLAY_H_ |
| OLD | NEW |