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 #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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 161 break; | 161 break; |
| 162 default: | 162 default: |
| 163 return gfx::OVERLAY_TRANSFORM_INVALID; | 163 return gfx::OVERLAY_TRANSFORM_INVALID; |
| 164 } | 164 } |
| 165 } | 165 } |
| 166 | 166 |
| 167 } // namespace | 167 } // namespace |
| 168 | 168 |
| 169 OverlayCandidate::OverlayCandidate() | 169 OverlayCandidate::OverlayCandidate() |
| 170 : transform(gfx::OVERLAY_TRANSFORM_NONE), | 170 : transform(gfx::OVERLAY_TRANSFORM_NONE), |
| 171 format(RGBA_8888), | 171 format(gfx::BufferFormat::RGBA_8888), |
| 172 uv_rect(0.f, 0.f, 1.f, 1.f), | 172 uv_rect(0.f, 0.f, 1.f, 1.f), |
| 173 is_clipped(false), | 173 is_clipped(false), |
| 174 use_output_surface_for_resource(false), | 174 use_output_surface_for_resource(false), |
| 175 resource_id(0), | 175 resource_id(0), |
| 176 #if defined(OS_ANDROID) | 176 #if defined(OS_ANDROID) |
| 177 is_backed_by_surface_texture(false), | 177 is_backed_by_surface_texture(false), |
| 178 is_promotable_hint(false), | 178 is_promotable_hint(false), |
| 179 #endif | 179 #endif |
| 180 plane_z_order(0), | 180 plane_z_order(0), |
| 181 is_unoccluded(false), | 181 is_unoccluded(false), |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 194 quad->shared_quad_state->opacity != 1.f || | 194 quad->shared_quad_state->opacity != 1.f || |
| 195 quad->shared_quad_state->blend_mode != SkBlendMode::kSrcOver) | 195 quad->shared_quad_state->blend_mode != SkBlendMode::kSrcOver) |
| 196 return false; | 196 return false; |
| 197 | 197 |
| 198 auto& transform = quad->shared_quad_state->quad_to_target_transform; | 198 auto& transform = quad->shared_quad_state->quad_to_target_transform; |
| 199 candidate->display_rect = gfx::RectF(quad->rect); | 199 candidate->display_rect = gfx::RectF(quad->rect); |
| 200 transform.TransformRect(&candidate->display_rect); | 200 transform.TransformRect(&candidate->display_rect); |
| 201 candidate->quad_rect_in_target_space = | 201 candidate->quad_rect_in_target_space = |
| 202 MathUtil::MapEnclosingClippedRect(transform, quad->rect); | 202 MathUtil::MapEnclosingClippedRect(transform, quad->rect); |
| 203 | 203 |
| 204 candidate->format = RGBA_8888; | 204 candidate->format = gfx::BufferFormat::RGBA_8888; |
| 205 candidate->clip_rect = quad->shared_quad_state->clip_rect; | 205 candidate->clip_rect = quad->shared_quad_state->clip_rect; |
| 206 candidate->is_clipped = quad->shared_quad_state->is_clipped; | 206 candidate->is_clipped = quad->shared_quad_state->is_clipped; |
| 207 | 207 |
| 208 switch (quad->material) { | 208 switch (quad->material) { |
| 209 case DrawQuad::TEXTURE_CONTENT: | 209 case DrawQuad::TEXTURE_CONTENT: |
| 210 return FromTextureQuad(resource_provider, | 210 return FromTextureQuad(resource_provider, |
| 211 TextureDrawQuad::MaterialCast(quad), candidate); | 211 TextureDrawQuad::MaterialCast(quad), candidate); |
| 212 case DrawQuad::STREAM_VIDEO_CONTENT: | 212 case DrawQuad::STREAM_VIDEO_CONTENT: |
| 213 return FromStreamVideoQuad(resource_provider, | 213 return FromStreamVideoQuad(resource_provider, |
| 214 StreamVideoDrawQuad::MaterialCast(quad), | 214 StreamVideoDrawQuad::MaterialCast(quad), |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 277 return false; | 277 return false; |
| 278 gfx::OverlayTransform overlay_transform = GetOverlayTransform( | 278 gfx::OverlayTransform overlay_transform = GetOverlayTransform( |
| 279 quad->shared_quad_state->quad_to_target_transform, false); | 279 quad->shared_quad_state->quad_to_target_transform, false); |
| 280 if (overlay_transform == gfx::OVERLAY_TRANSFORM_INVALID) | 280 if (overlay_transform == gfx::OVERLAY_TRANSFORM_INVALID) |
| 281 return false; | 281 return false; |
| 282 if (!quad->matrix.IsScaleOrTranslation()) { | 282 if (!quad->matrix.IsScaleOrTranslation()) { |
| 283 // We cannot handle anything other than scaling & translation for texture | 283 // We cannot handle anything other than scaling & translation for texture |
| 284 // coordinates yet. | 284 // coordinates yet. |
| 285 return false; | 285 return false; |
| 286 } | 286 } |
| 287 candidate->format = quad->format; | |
|
dshwang
2017/02/09 00:03:54
To query this actuall format, all boilerplate plum
| |
| 287 candidate->resource_id = quad->resource_id(); | 288 candidate->resource_id = quad->resource_id(); |
| 288 candidate->resource_size_in_pixels = quad->resource_size_in_pixels(); | 289 candidate->resource_size_in_pixels = quad->resource_size_in_pixels(); |
| 289 candidate->transform = overlay_transform; | 290 candidate->transform = overlay_transform; |
| 290 #if defined(OS_ANDROID) | 291 #if defined(OS_ANDROID) |
| 291 candidate->is_backed_by_surface_texture = | 292 candidate->is_backed_by_surface_texture = |
| 292 resource_provider->IsBackedBySurfaceTexture(quad->resource_id()); | 293 resource_provider->IsBackedBySurfaceTexture(quad->resource_id()); |
| 293 #endif | 294 #endif |
| 294 | 295 |
| 295 gfx::Point3F uv0 = gfx::Point3F(0, 0, 0); | 296 gfx::Point3F uv0 = gfx::Point3F(0, 0, 0); |
| 296 gfx::Point3F uv1 = gfx::Point3F(1, 1, 0); | 297 gfx::Point3F uv1 = gfx::Point3F(1, 1, 0); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 334 | 335 |
| 335 OverlayCandidateList& OverlayCandidateList::operator=( | 336 OverlayCandidateList& OverlayCandidateList::operator=( |
| 336 OverlayCandidateList&& other) = default; | 337 OverlayCandidateList&& other) = default; |
| 337 | 338 |
| 338 void OverlayCandidateList::AddPromotionHint(const OverlayCandidate& candidate) { | 339 void OverlayCandidateList::AddPromotionHint(const OverlayCandidate& candidate) { |
| 339 promotion_hint_info_map_[candidate.resource_id] = | 340 promotion_hint_info_map_[candidate.resource_id] = |
| 340 candidate.display_rect.origin(); | 341 candidate.display_rect.origin(); |
| 341 } | 342 } |
| 342 | 343 |
| 343 } // namespace cc | 344 } // namespace cc |
| OLD | NEW |