| 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* quad, OverlayCandidate* candidate); |
| 29 // Apply transform |delta| to |in| and return the resulting transform, | |
| 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(); | 34 OverlayCandidate(); |
| 37 ~OverlayCandidate(); | 35 ~OverlayCandidate(); |
| 38 | 36 |
| 39 // Transformation to apply to layer during composition. | 37 // Transformation to apply to layer during composition. |
| 40 gfx::OverlayTransform transform; | 38 gfx::OverlayTransform transform; |
| 41 // Format of the buffer to composite. | 39 // Format of the buffer to composite. |
| 42 ResourceFormat format; | 40 ResourceFormat format; |
| 43 // Size of the resource, in pixels. | 41 // Size of the resource, in pixels. |
| 44 gfx::Size resource_size_in_pixels; | 42 gfx::Size resource_size_in_pixels; |
| 45 // Rect on the display to position the overlay to. Implementer must convert | 43 // 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; | 56 bool use_output_surface_for_resource; |
| 59 // Texture resource to present in an overlay. | 57 // Texture resource to present in an overlay. |
| 60 unsigned resource_id; | 58 unsigned resource_id; |
| 61 // Stacking order of the overlay plane relative to the main surface, | 59 // Stacking order of the overlay plane relative to the main surface, |
| 62 // which is 0. Signed to allow for "underlays". | 60 // which is 0. Signed to allow for "underlays". |
| 63 int plane_z_order; | 61 int plane_z_order; |
| 64 | 62 |
| 65 // To be modified by the implementer if this candidate can go into | 63 // To be modified by the implementer if this candidate can go into |
| 66 // an overlay. | 64 // an overlay. |
| 67 bool overlay_handled; | 65 bool overlay_handled; |
| 66 |
| 67 private: |
| 68 static bool FromTextureQuad(const TextureDrawQuad* quad, |
| 69 OverlayCandidate* candidate); |
| 70 static bool FromStreamVideoQuad(const StreamVideoDrawQuad* quad, |
| 71 OverlayCandidate* candidate); |
| 72 static bool FromIOSurfaceQuad(const IOSurfaceDrawQuad* quad, |
| 73 OverlayCandidate* candidate); |
| 68 }; | 74 }; |
| 69 | 75 |
| 70 typedef std::vector<OverlayCandidate> OverlayCandidateList; | 76 typedef std::vector<OverlayCandidate> OverlayCandidateList; |
| 71 | 77 |
| 72 } // namespace cc | 78 } // namespace cc |
| 73 | 79 |
| 74 #endif // CC_OUTPUT_OVERLAY_CANDIDATE_H_ | 80 #endif // CC_OUTPUT_OVERLAY_CANDIDATE_H_ |
| OLD | NEW |