| 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 class ResourceProvider; | 30 class ResourceProvider; |
| 29 | 31 |
| 30 class CC_EXPORT OverlayCandidate { | 32 class CC_EXPORT OverlayCandidate { |
| 31 public: | 33 public: |
| 32 // Returns true and fills in |candidate| if |draw_quad| is of a known quad | 34 // Returns true and fills in |candidate| if |draw_quad| is of a known quad |
| 33 // type and contains an overlayable resource. | 35 // type and contains an overlayable resource. |
| 34 static bool FromDrawQuad(ResourceProvider* resource_provider, | 36 static bool FromDrawQuad(ResourceProvider* resource_provider, |
| 35 const DrawQuad* quad, | 37 const DrawQuad* quad, |
| 36 OverlayCandidate* candidate); | 38 OverlayCandidate* candidate); |
| 37 // Returns true if |quad| will not block quads underneath from becoming | 39 // Returns true if |quad| will not block quads underneath from becoming |
| (...skipping 13 matching lines...) Expand all Loading... |
| 51 // to integer coordinates if setting |overlay_handled| to true. | 53 // to integer coordinates if setting |overlay_handled| to true. |
| 52 gfx::RectF display_rect; | 54 gfx::RectF display_rect; |
| 53 // Crop within the buffer to be placed inside |display_rect|. | 55 // Crop within the buffer to be placed inside |display_rect|. |
| 54 gfx::RectF uv_rect; | 56 gfx::RectF uv_rect; |
| 55 // Quad geometry rect after applying the quad_transform(). | 57 // Quad geometry rect after applying the quad_transform(). |
| 56 gfx::Rect quad_rect_in_target_space; | 58 gfx::Rect quad_rect_in_target_space; |
| 57 // Clip rect in the target content space after composition. | 59 // Clip rect in the target content space after composition. |
| 58 gfx::Rect clip_rect; | 60 gfx::Rect clip_rect; |
| 59 // If the quad is clipped after composition. | 61 // If the quad is clipped after composition. |
| 60 bool is_clipped; | 62 bool is_clipped; |
| 61 // True if the texture for this overlay should be the same one used by the | 63 |
| 62 // output surface's main overlay. | 64 enum { |
| 63 bool use_output_surface_for_resource; | 65 HAS_RESOURCE, // Use |resource_id| for texture resource. |
| 64 // Texture resource to present in an overlay. | 66 USE_OUTPUT_SURFACE, // Use the same texture as the output surface's main |
| 65 unsigned resource_id; | 67 // overlay. |
| 68 SOLID_COLOR, // No resource, use |solid_color|. |
| 69 } resource_type; |
| 70 union { |
| 71 unsigned resource_id; // When resource_type == HAS_RESOURCE. |
| 72 SkColor solid_color; // When resource_type == SOLID_COLOR. |
| 73 } resource; |
| 74 |
| 66 // Stacking order of the overlay plane relative to the main surface, | 75 // Stacking order of the overlay plane relative to the main surface, |
| 67 // which is 0. Signed to allow for "underlays". | 76 // which is 0. Signed to allow for "underlays". |
| 68 int plane_z_order; | 77 int plane_z_order; |
| 69 | 78 |
| 70 // To be modified by the implementer if this candidate can go into | 79 // To be modified by the implementer if this candidate can go into |
| 71 // an overlay. | 80 // an overlay. |
| 72 bool overlay_handled; | 81 bool overlay_handled; |
| 73 | 82 |
| 74 private: | 83 private: |
| 75 static bool FromTextureQuad(ResourceProvider* resource_provider, | 84 static bool FromTextureQuad(ResourceProvider* resource_provider, |
| 76 const TextureDrawQuad* quad, | 85 const TextureDrawQuad* quad, |
| 77 OverlayCandidate* candidate); | 86 OverlayCandidate* candidate); |
| 78 static bool FromStreamVideoQuad(ResourceProvider* resource_provider, | 87 static bool FromStreamVideoQuad(ResourceProvider* resource_provider, |
| 79 const StreamVideoDrawQuad* quad, | 88 const StreamVideoDrawQuad* quad, |
| 80 OverlayCandidate* candidate); | 89 OverlayCandidate* candidate); |
| 81 static bool FromIOSurfaceQuad(ResourceProvider* resource_provider, | 90 static bool FromIOSurfaceQuad(ResourceProvider* resource_provider, |
| 82 const IOSurfaceDrawQuad* quad, | 91 const IOSurfaceDrawQuad* quad, |
| 83 OverlayCandidate* candidate); | 92 OverlayCandidate* candidate); |
| 93 static bool FromTileQuad(ResourceProvider* resource_provider, |
| 94 const TileDrawQuad* quad, |
| 95 OverlayCandidate* candidate); |
| 96 static bool FromSolidColorQuad(const SolidColorDrawQuad* quad, |
| 97 OverlayCandidate* candidate); |
| 84 }; | 98 }; |
| 85 | 99 |
| 86 typedef std::vector<OverlayCandidate> OverlayCandidateList; | 100 typedef std::vector<OverlayCandidate> OverlayCandidateList; |
| 87 | 101 |
| 88 } // namespace cc | 102 } // namespace cc |
| 89 | 103 |
| 90 #endif // CC_OUTPUT_OVERLAY_CANDIDATE_H_ | 104 #endif // CC_OUTPUT_OVERLAY_CANDIDATE_H_ |
| OLD | NEW |