| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 } // namespace | 168 } // namespace |
| 169 | 169 |
| 170 OverlayCandidate::OverlayCandidate() | 170 OverlayCandidate::OverlayCandidate() |
| 171 : transform(gfx::OVERLAY_TRANSFORM_NONE), | 171 : transform(gfx::OVERLAY_TRANSFORM_NONE), |
| 172 format(RGBA_8888), | 172 format(RGBA_8888), |
| 173 uv_rect(0.f, 0.f, 1.f, 1.f), | 173 uv_rect(0.f, 0.f, 1.f, 1.f), |
| 174 is_clipped(false), | 174 is_clipped(false), |
| 175 use_output_surface_for_resource(false), | 175 use_output_surface_for_resource(false), |
| 176 resource_id(0), | 176 resource_id(0), |
| 177 plane_z_order(0), | 177 plane_z_order(0), |
| 178 needs_blending(false), | |
| 179 overlay_handled(false) {} | 178 overlay_handled(false) {} |
| 180 | 179 |
| 181 OverlayCandidate::~OverlayCandidate() {} | 180 OverlayCandidate::~OverlayCandidate() {} |
| 182 | 181 |
| 183 // static | 182 // static |
| 184 bool OverlayCandidate::FromDrawQuad(ResourceProvider* resource_provider, | 183 bool OverlayCandidate::FromDrawQuad(ResourceProvider* resource_provider, |
| 185 const DrawQuad* quad, | 184 const DrawQuad* quad, |
| 186 OverlayCandidate* candidate) { | 185 OverlayCandidate* candidate) { |
| 187 if (quad->needs_blending || quad->shared_quad_state->opacity != 1.f || | 186 if (quad->needs_blending || quad->shared_quad_state->opacity != 1.f || |
| 188 quad->shared_quad_state->blend_mode != SkXfermode::kSrcOver_Mode) | 187 quad->shared_quad_state->blend_mode != SkXfermode::kSrcOver_Mode) |
| 189 return false; | 188 return false; |
| 190 | 189 |
| 191 auto& transform = quad->shared_quad_state->quad_to_target_transform; | 190 auto& transform = quad->shared_quad_state->quad_to_target_transform; |
| 192 candidate->display_rect = gfx::RectF(quad->rect); | 191 candidate->display_rect = gfx::RectF(quad->rect); |
| 193 transform.TransformRect(&candidate->display_rect); | 192 transform.TransformRect(&candidate->display_rect); |
| 194 candidate->quad_rect_in_target_space = | 193 candidate->quad_rect_in_target_space = |
| 195 MathUtil::MapEnclosingClippedRect(transform, quad->rect); | 194 MathUtil::MapEnclosingClippedRect(transform, quad->rect); |
| 196 | 195 |
| 197 candidate->format = RGBA_8888; | 196 candidate->format = RGBA_8888; |
| 198 candidate->clip_rect = quad->shared_quad_state->clip_rect; | 197 candidate->clip_rect = quad->shared_quad_state->clip_rect; |
| 199 candidate->is_clipped = quad->shared_quad_state->is_clipped; | 198 candidate->is_clipped = quad->shared_quad_state->is_clipped; |
| 200 candidate->needs_blending = | |
| 201 quad->shared_quad_state->opacity < 1.0f || quad->needs_blending; | |
| 202 | 199 |
| 203 switch (quad->material) { | 200 switch (quad->material) { |
| 204 case DrawQuad::TEXTURE_CONTENT: | 201 case DrawQuad::TEXTURE_CONTENT: |
| 205 return FromTextureQuad(resource_provider, | 202 return FromTextureQuad(resource_provider, |
| 206 TextureDrawQuad::MaterialCast(quad), candidate); | 203 TextureDrawQuad::MaterialCast(quad), candidate); |
| 207 case DrawQuad::STREAM_VIDEO_CONTENT: | 204 case DrawQuad::STREAM_VIDEO_CONTENT: |
| 208 return FromStreamVideoQuad(resource_provider, | 205 return FromStreamVideoQuad(resource_provider, |
| 209 StreamVideoDrawQuad::MaterialCast(quad), | 206 StreamVideoDrawQuad::MaterialCast(quad), |
| 210 candidate); | 207 candidate); |
| 211 case DrawQuad::IO_SURFACE_CONTENT: | 208 case DrawQuad::IO_SURFACE_CONTENT: |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 if (overlay_transform != gfx::OVERLAY_TRANSFORM_NONE) | 303 if (overlay_transform != gfx::OVERLAY_TRANSFORM_NONE) |
| 307 return false; | 304 return false; |
| 308 candidate->resource_id = quad->io_surface_resource_id(); | 305 candidate->resource_id = quad->io_surface_resource_id(); |
| 309 candidate->resource_size_in_pixels = quad->io_surface_size; | 306 candidate->resource_size_in_pixels = quad->io_surface_size; |
| 310 candidate->transform = overlay_transform; | 307 candidate->transform = overlay_transform; |
| 311 candidate->uv_rect = gfx::RectF(1.f, 1.f); | 308 candidate->uv_rect = gfx::RectF(1.f, 1.f); |
| 312 return true; | 309 return true; |
| 313 } | 310 } |
| 314 | 311 |
| 315 } // namespace cc | 312 } // namespace cc |
| OLD | NEW |