Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_OVERLAY_CANDIDATE_H_ | 5 #ifndef CC_OUTPUT_OVERLAY_CANDIDATE_H_ |
| 6 #define CC_OUTPUT_OVERLAY_CANDIDATE_H_ | 6 #define CC_OUTPUT_OVERLAY_CANDIDATE_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "cc/base/cc_export.h" | 10 #include "cc/base/cc_export.h" |
| 11 #include "cc/resources/resource_format.h" | 11 #include "cc/resources/resource_format.h" |
| 12 #include "ui/gfx/geometry/rect.h" | 12 #include "ui/gfx/geometry/rect.h" |
| 13 #include "ui/gfx/geometry/rect_f.h" | 13 #include "ui/gfx/geometry/rect_f.h" |
| 14 #include "ui/gfx/geometry/size.h" | 14 #include "ui/gfx/geometry/size.h" |
| 15 #include "ui/gfx/overlay_transform.h" | 15 #include "ui/gfx/overlay_transform.h" |
| 16 #include "ui/gfx/transform.h" | 16 #include "ui/gfx/transform.h" |
| 17 | 17 |
| 18 namespace gfx { | 18 namespace gfx { |
| 19 class Rect; | 19 class Rect; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace cc { | 22 namespace cc { |
| 23 | 23 |
| 24 class DrawQuad; | |
| 25 class IOSurfaceDrawQuad; | |
| 26 class StreamVideoDrawQuad; | |
| 27 class TextureDrawQuad; | |
| 28 | |
| 24 class CC_EXPORT OverlayCandidate { | 29 class CC_EXPORT OverlayCandidate { |
| 25 public: | 30 public: |
| 26 static gfx::OverlayTransform GetOverlayTransform( | 31 // Returns true and fills in |candidate| if |draw_quad| is of a known quad |
| 27 const gfx::Transform& quad_transform, | 32 // type and contains an overlayable resource. |
| 28 bool y_flipped); | 33 static bool FromDrawQuad(const DrawQuad* draw_quad, |
| 29 // Apply transform |delta| to |in| and return the resulting transform, | 34 OverlayCandidate* candidate); |
| 30 // or OVERLAY_TRANSFORM_INVALID. | |
| 31 static gfx::OverlayTransform ModifyTransform(gfx::OverlayTransform in, | |
| 32 gfx::OverlayTransform delta); | |
| 33 static gfx::RectF GetOverlayRect(const gfx::Transform& quad_transform, | |
| 34 const gfx::Rect& rect); | |
| 35 | |
| 36 OverlayCandidate(); | 35 OverlayCandidate(); |
| 37 ~OverlayCandidate(); | 36 ~OverlayCandidate(); |
| 38 | 37 |
| 39 // Transformation to apply to layer during composition. | 38 // Transformation to apply to layer during composition. |
| 40 gfx::OverlayTransform transform; | 39 gfx::OverlayTransform transform; |
| 41 // Format of the buffer to composite. | 40 // Format of the buffer to composite. |
| 42 ResourceFormat format; | 41 ResourceFormat format; |
| 43 // Size of the resource, in pixels. | 42 // Size of the resource, in pixels. |
| 44 gfx::Size resource_size_in_pixels; | 43 gfx::Size resource_size_in_pixels; |
| 45 // Rect on the display to position the overlay to. Implementer must convert | 44 // Rect on the display to position the overlay to. Implementer must convert |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 58 bool use_output_surface_for_resource; | 57 bool use_output_surface_for_resource; |
| 59 // Texture resource to present in an overlay. | 58 // Texture resource to present in an overlay. |
| 60 unsigned resource_id; | 59 unsigned resource_id; |
| 61 // Stacking order of the overlay plane relative to the main surface, | 60 // Stacking order of the overlay plane relative to the main surface, |
| 62 // which is 0. Signed to allow for "underlays". | 61 // which is 0. Signed to allow for "underlays". |
| 63 int plane_z_order; | 62 int plane_z_order; |
| 64 | 63 |
| 65 // To be modified by the implementer if this candidate can go into | 64 // To be modified by the implementer if this candidate can go into |
| 66 // an overlay. | 65 // an overlay. |
| 67 bool overlay_handled; | 66 bool overlay_handled; |
| 67 | |
| 68 private: | |
| 69 static bool FromTextureQuad(const TextureDrawQuad* quad, | |
| 70 OverlayCandidate* candidate); | |
| 71 static bool FromStreamVideoQuad(const StreamVideoDrawQuad* quad, | |
| 72 OverlayCandidate* candidate); | |
| 73 static bool FromIOSurfaceQuad(const IOSurfaceDrawQuad* quad, | |
| 74 OverlayCandidate* candidate); | |
|
ccameron
2015/09/29 23:29:56
I'd suggest making GetOverlayTransform be a non-me
Andre
2015/09/30 00:18:38
Done.
| |
| 75 static gfx::OverlayTransform GetOverlayTransform( | |
| 76 const gfx::Transform& quad_transform, | |
| 77 bool y_flipped); | |
|
ccameron
2015/09/29 23:29:55
I'd prefer to name "ModifyTransform" to be "Compos
Andre
2015/09/30 00:18:38
Done.
| |
| 78 // Apply transform |delta| to |in| and return the resulting transform, | |
| 79 // or OVERLAY_TRANSFORM_INVALID. | |
| 80 static gfx::OverlayTransform ModifyTransform(gfx::OverlayTransform in, | |
| 81 gfx::OverlayTransform delta); | |
| 82 static gfx::RectF GetOverlayRect(const gfx::Transform& quad_transform, | |
| 83 const gfx::Rect& rect); | |
| 68 }; | 84 }; |
| 69 | 85 |
| 70 typedef std::vector<OverlayCandidate> OverlayCandidateList; | 86 typedef std::vector<OverlayCandidate> OverlayCandidateList; |
| 71 | 87 |
| 72 } // namespace cc | 88 } // namespace cc |
| 73 | 89 |
| 74 #endif // CC_OUTPUT_OVERLAY_CANDIDATE_H_ | 90 #endif // CC_OUTPUT_OVERLAY_CANDIDATE_H_ |
| OLD | NEW |