| 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 } | 188 } |
| 189 | 189 |
| 190 OverlayCandidate::OverlayCandidate(const OverlayCandidate& other) = default; | 190 OverlayCandidate::OverlayCandidate(const OverlayCandidate& other) = default; |
| 191 | 191 |
| 192 OverlayCandidate::~OverlayCandidate() {} | 192 OverlayCandidate::~OverlayCandidate() {} |
| 193 | 193 |
| 194 // static | 194 // static |
| 195 bool OverlayCandidate::FromDrawQuad(ResourceProvider* resource_provider, | 195 bool OverlayCandidate::FromDrawQuad(ResourceProvider* resource_provider, |
| 196 const DrawQuad* quad, | 196 const DrawQuad* quad, |
| 197 OverlayCandidate* candidate) { | 197 OverlayCandidate* candidate) { |
| 198 if (quad->ShouldDrawWithBlending() || | 198 // We don't support an opacity value different than one for an overlay plane. |
| 199 quad->shared_quad_state->opacity != 1.f || | 199 if (quad->shared_quad_state->opacity != 1.f) |
| 200 quad->shared_quad_state->blend_mode != SkBlendMode::kSrcOver) | 200 return false; |
| 201 // We support only kSrc (no blending) and kSrcOver (blending with premul). |
| 202 if (!(quad->shared_quad_state->blend_mode == SkBlendMode::kSrc || |
| 203 quad->shared_quad_state->blend_mode == SkBlendMode::kSrcOver)) |
| 201 return false; | 204 return false; |
| 202 | 205 |
| 203 auto& transform = quad->shared_quad_state->quad_to_target_transform; | 206 auto& transform = quad->shared_quad_state->quad_to_target_transform; |
| 204 candidate->display_rect = gfx::RectF(quad->rect); | 207 candidate->display_rect = gfx::RectF(quad->rect); |
| 205 transform.TransformRect(&candidate->display_rect); | 208 transform.TransformRect(&candidate->display_rect); |
| 206 candidate->quad_rect_in_target_space = | 209 candidate->quad_rect_in_target_space = |
| 207 MathUtil::MapEnclosingClippedRect(transform, quad->rect); | 210 MathUtil::MapEnclosingClippedRect(transform, quad->rect); |
| 208 | 211 |
| 209 candidate->clip_rect = quad->shared_quad_state->clip_rect; | 212 candidate->clip_rect = quad->shared_quad_state->clip_rect; |
| 210 candidate->is_clipped = quad->shared_quad_state->is_clipped; | 213 candidate->is_clipped = quad->shared_quad_state->is_clipped; |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 | 345 |
| 343 OverlayCandidateList& OverlayCandidateList::operator=( | 346 OverlayCandidateList& OverlayCandidateList::operator=( |
| 344 OverlayCandidateList&& other) = default; | 347 OverlayCandidateList&& other) = default; |
| 345 | 348 |
| 346 void OverlayCandidateList::AddPromotionHint(const OverlayCandidate& candidate) { | 349 void OverlayCandidateList::AddPromotionHint(const OverlayCandidate& candidate) { |
| 347 promotion_hint_info_map_[candidate.resource_id] = | 350 promotion_hint_info_map_[candidate.resource_id] = |
| 348 candidate.display_rect.origin(); | 351 candidate.display_rect.origin(); |
| 349 } | 352 } |
| 350 | 353 |
| 351 } // namespace cc | 354 } // namespace cc |
| OLD | NEW |