| 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 #include "cc/output/overlay_candidate.h" | 5 #include "cc/output/overlay_candidate.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 break; | 166 break; |
| 167 default: | 167 default: |
| 168 return gfx::OVERLAY_TRANSFORM_INVALID; | 168 return gfx::OVERLAY_TRANSFORM_INVALID; |
| 169 } | 169 } |
| 170 } | 170 } |
| 171 | 171 |
| 172 } // namespace | 172 } // namespace |
| 173 | 173 |
| 174 OverlayCandidate::OverlayCandidate() | 174 OverlayCandidate::OverlayCandidate() |
| 175 : transform(gfx::OVERLAY_TRANSFORM_NONE), | 175 : transform(gfx::OVERLAY_TRANSFORM_NONE), |
| 176 format(RGBA_8888), | 176 format(gfx::BufferFormat::RGBA_8888), |
| 177 uv_rect(0.f, 0.f, 1.f, 1.f), | 177 uv_rect(0.f, 0.f, 1.f, 1.f), |
| 178 is_clipped(false), | 178 is_clipped(false), |
| 179 use_output_surface_for_resource(false), | 179 use_output_surface_for_resource(false), |
| 180 resource_id(0), | 180 resource_id(0), |
| 181 #if defined(OS_ANDROID) | 181 #if defined(OS_ANDROID) |
| 182 is_backed_by_surface_texture(false), | 182 is_backed_by_surface_texture(false), |
| 183 is_promotable_hint(false), | 183 is_promotable_hint(false), |
| 184 #endif | 184 #endif |
| 185 plane_z_order(0), | 185 plane_z_order(0), |
| 186 is_unoccluded(false), | 186 is_unoccluded(false), |
| (...skipping 12 matching lines...) Expand all Loading... |
| 199 quad->shared_quad_state->opacity != 1.f || | 199 quad->shared_quad_state->opacity != 1.f || |
| 200 quad->shared_quad_state->blend_mode != SkBlendMode::kSrcOver) | 200 quad->shared_quad_state->blend_mode != SkBlendMode::kSrcOver) |
| 201 return false; | 201 return false; |
| 202 | 202 |
| 203 auto& transform = quad->shared_quad_state->quad_to_target_transform; | 203 auto& transform = quad->shared_quad_state->quad_to_target_transform; |
| 204 candidate->display_rect = gfx::RectF(quad->rect); | 204 candidate->display_rect = gfx::RectF(quad->rect); |
| 205 transform.TransformRect(&candidate->display_rect); | 205 transform.TransformRect(&candidate->display_rect); |
| 206 candidate->quad_rect_in_target_space = | 206 candidate->quad_rect_in_target_space = |
| 207 MathUtil::MapEnclosingClippedRect(transform, quad->rect); | 207 MathUtil::MapEnclosingClippedRect(transform, quad->rect); |
| 208 | 208 |
| 209 candidate->format = RGBA_8888; | |
| 210 candidate->clip_rect = quad->shared_quad_state->clip_rect; | 209 candidate->clip_rect = quad->shared_quad_state->clip_rect; |
| 211 candidate->is_clipped = quad->shared_quad_state->is_clipped; | 210 candidate->is_clipped = quad->shared_quad_state->is_clipped; |
| 212 | 211 |
| 213 switch (quad->material) { | 212 switch (quad->material) { |
| 214 case DrawQuad::TEXTURE_CONTENT: | 213 case DrawQuad::TEXTURE_CONTENT: |
| 215 return FromTextureQuad(resource_provider, | 214 return FromTextureQuad(resource_provider, |
| 216 TextureDrawQuad::MaterialCast(quad), candidate); | 215 TextureDrawQuad::MaterialCast(quad), candidate); |
| 217 case DrawQuad::STREAM_VIDEO_CONTENT: | 216 case DrawQuad::STREAM_VIDEO_CONTENT: |
| 218 return FromStreamVideoQuad(resource_provider, | 217 return FromStreamVideoQuad(resource_provider, |
| 219 StreamVideoDrawQuad::MaterialCast(quad), | 218 StreamVideoDrawQuad::MaterialCast(quad), |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 } | 254 } |
| 256 return false; | 255 return false; |
| 257 } | 256 } |
| 258 | 257 |
| 259 // static | 258 // static |
| 260 bool OverlayCandidate::FromTextureQuad(ResourceProvider* resource_provider, | 259 bool OverlayCandidate::FromTextureQuad(ResourceProvider* resource_provider, |
| 261 const TextureDrawQuad* quad, | 260 const TextureDrawQuad* quad, |
| 262 OverlayCandidate* candidate) { | 261 OverlayCandidate* candidate) { |
| 263 if (!resource_provider->IsOverlayCandidate(quad->resource_id())) | 262 if (!resource_provider->IsOverlayCandidate(quad->resource_id())) |
| 264 return false; | 263 return false; |
| 265 | 264 candidate->format = resource_provider->GetBufferFormat(quad->resource_id()); |
| 266 gfx::BufferFormat format = | |
| 267 resource_provider->GetBufferFormat(quad->resource_id()); | |
| 268 if (std::find(std::begin(kOverlayFormats), std::end(kOverlayFormats), | 265 if (std::find(std::begin(kOverlayFormats), std::end(kOverlayFormats), |
| 269 format) == std::end(kOverlayFormats)) | 266 candidate->format) == std::end(kOverlayFormats)) |
| 270 return false; | 267 return false; |
| 271 gfx::OverlayTransform overlay_transform = GetOverlayTransform( | 268 gfx::OverlayTransform overlay_transform = GetOverlayTransform( |
| 272 quad->shared_quad_state->quad_to_target_transform, quad->y_flipped); | 269 quad->shared_quad_state->quad_to_target_transform, quad->y_flipped); |
| 273 if (quad->background_color != SK_ColorTRANSPARENT || | 270 if (quad->background_color != SK_ColorTRANSPARENT || |
| 274 overlay_transform == gfx::OVERLAY_TRANSFORM_INVALID) | 271 overlay_transform == gfx::OVERLAY_TRANSFORM_INVALID) |
| 275 return false; | 272 return false; |
| 276 candidate->resource_id = quad->resource_id(); | 273 candidate->resource_id = quad->resource_id(); |
| 277 candidate->resource_size_in_pixels = quad->resource_size_in_pixels(); | 274 candidate->resource_size_in_pixels = quad->resource_size_in_pixels(); |
| 278 candidate->transform = overlay_transform; | 275 candidate->transform = overlay_transform; |
| 279 candidate->uv_rect = BoundingRect(quad->uv_top_left, quad->uv_bottom_right); | 276 candidate->uv_rect = BoundingRect(quad->uv_top_left, quad->uv_bottom_right); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 | 342 |
| 346 OverlayCandidateList& OverlayCandidateList::operator=( | 343 OverlayCandidateList& OverlayCandidateList::operator=( |
| 347 OverlayCandidateList&& other) = default; | 344 OverlayCandidateList&& other) = default; |
| 348 | 345 |
| 349 void OverlayCandidateList::AddPromotionHint(const OverlayCandidate& candidate) { | 346 void OverlayCandidateList::AddPromotionHint(const OverlayCandidate& candidate) { |
| 350 promotion_hint_info_map_[candidate.resource_id] = | 347 promotion_hint_info_map_[candidate.resource_id] = |
| 351 candidate.display_rect.origin(); | 348 candidate.display_rect.origin(); |
| 352 } | 349 } |
| 353 | 350 |
| 354 } // namespace cc | 351 } // namespace cc |
| OLD | NEW |