| 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; | 24 class DrawQuad; |
| 25 class IOSurfaceDrawQuad; | 25 class IOSurfaceDrawQuad; |
| 26 class SolidColorDrawQuad; |
| 26 class StreamVideoDrawQuad; | 27 class StreamVideoDrawQuad; |
| 27 class TextureDrawQuad; | 28 class TextureDrawQuad; |
| 29 class TileDrawQuad; |
| 28 | 30 |
| 29 class CC_EXPORT OverlayCandidate { | 31 class CC_EXPORT OverlayCandidate { |
| 30 public: | 32 public: |
| 33 // Returns true if |quad|'s allow_overlay is true. |
| 34 static bool IsAllowedQuad(const DrawQuad* quad); |
| 31 // Returns true and fills in |candidate| if |draw_quad| is of a known quad | 35 // Returns true and fills in |candidate| if |draw_quad| is of a known quad |
| 32 // type and contains an overlayable resource. | 36 // type and contains an overlayable resource. |
| 33 static bool FromDrawQuad(const DrawQuad* quad, OverlayCandidate* candidate); | 37 static bool FromDrawQuad(const DrawQuad* quad, OverlayCandidate* candidate); |
| 34 OverlayCandidate(); | 38 OverlayCandidate(); |
| 35 ~OverlayCandidate(); | 39 ~OverlayCandidate(); |
| 36 | 40 |
| 37 // Transformation to apply to layer during composition. | 41 // Transformation to apply to layer during composition. |
| 38 gfx::OverlayTransform transform; | 42 gfx::OverlayTransform transform; |
| 39 // Format of the buffer to composite. | 43 // Format of the buffer to composite. |
| 40 ResourceFormat format; | 44 ResourceFormat format; |
| 41 // Size of the resource, in pixels. | 45 // Size of the resource, in pixels. |
| 42 gfx::Size resource_size_in_pixels; | 46 gfx::Size resource_size_in_pixels; |
| 43 // Rect on the display to position the overlay to. Implementer must convert | 47 // Rect on the display to position the overlay to. Implementer must convert |
| 44 // to integer coordinates if setting |overlay_handled| to true. | 48 // to integer coordinates if setting |overlay_handled| to true. |
| 45 gfx::RectF display_rect; | 49 gfx::RectF display_rect; |
| 46 // Crop within the buffer to be placed inside |display_rect|. | 50 // Crop within the buffer to be placed inside |display_rect|. |
| 47 gfx::RectF uv_rect; | 51 gfx::RectF uv_rect; |
| 48 // Quad geometry rect after applying the quad_transform(). | 52 // Quad geometry rect after applying the quad_transform(). |
| 49 gfx::Rect quad_rect_in_target_space; | 53 gfx::Rect quad_rect_in_target_space; |
| 50 // Clip rect in the target content space after composition. | 54 // Clip rect in the target content space after composition. |
| 51 gfx::Rect clip_rect; | 55 gfx::Rect clip_rect; |
| 52 // If the quad is clipped after composition. | 56 // If the quad is clipped after composition. |
| 53 bool is_clipped; | 57 bool is_clipped; |
| 54 // True if the texture for this overlay should be the same one used by the | 58 // True if the texture for this overlay should be the same one used by the |
| 55 // output surface's main overlay. | 59 // output surface's main overlay. |
| 56 bool use_output_surface_for_resource; | 60 bool use_output_surface_for_resource; |
| 57 // Texture resource to present in an overlay. | 61 // Texture resource to present in an overlay. |
| 58 unsigned resource_id; | 62 unsigned resource_id; |
| 63 // If |resource_id| is 0, this overlay is solid color. |
| 64 SkColor solid_color; |
| 59 // Stacking order of the overlay plane relative to the main surface, | 65 // Stacking order of the overlay plane relative to the main surface, |
| 60 // which is 0. Signed to allow for "underlays". | 66 // which is 0. Signed to allow for "underlays". |
| 61 int plane_z_order; | 67 int plane_z_order; |
| 62 | 68 |
| 63 // To be modified by the implementer if this candidate can go into | 69 // To be modified by the implementer if this candidate can go into |
| 64 // an overlay. | 70 // an overlay. |
| 65 bool overlay_handled; | 71 bool overlay_handled; |
| 66 | 72 |
| 67 private: | 73 private: |
| 68 static bool FromTextureQuad(const TextureDrawQuad* quad, | 74 static bool FromTextureQuad(const TextureDrawQuad* quad, |
| 69 OverlayCandidate* candidate); | 75 OverlayCandidate* candidate); |
| 70 static bool FromStreamVideoQuad(const StreamVideoDrawQuad* quad, | 76 static bool FromStreamVideoQuad(const StreamVideoDrawQuad* quad, |
| 71 OverlayCandidate* candidate); | 77 OverlayCandidate* candidate); |
| 72 static bool FromIOSurfaceQuad(const IOSurfaceDrawQuad* quad, | 78 static bool FromIOSurfaceQuad(const IOSurfaceDrawQuad* quad, |
| 73 OverlayCandidate* candidate); | 79 OverlayCandidate* candidate); |
| 80 static bool FromTileQuad(const TileDrawQuad* quad, |
| 81 OverlayCandidate* candidate); |
| 82 static bool FromSolidColorQuad(const SolidColorDrawQuad* quad, |
| 83 OverlayCandidate* candidate); |
| 74 }; | 84 }; |
| 75 | 85 |
| 76 typedef std::vector<OverlayCandidate> OverlayCandidateList; | 86 typedef std::vector<OverlayCandidate> OverlayCandidateList; |
| 77 | 87 |
| 78 } // namespace cc | 88 } // namespace cc |
| 79 | 89 |
| 80 #endif // CC_OUTPUT_OVERLAY_CANDIDATE_H_ | 90 #endif // CC_OUTPUT_OVERLAY_CANDIDATE_H_ |
| OLD | NEW |