Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: cc/output/overlay_candidate.cc

Issue 2162663003: Don't reject overlay candidates for premultiplied alpha. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | cc/output/overlay_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 overlay_handled(false) {} 178 overlay_handled(false) {}
179 179
180 OverlayCandidate::OverlayCandidate(const OverlayCandidate& other) = default; 180 OverlayCandidate::OverlayCandidate(const OverlayCandidate& other) = default;
181 181
182 OverlayCandidate::~OverlayCandidate() {} 182 OverlayCandidate::~OverlayCandidate() {}
183 183
184 // static 184 // static
185 bool OverlayCandidate::FromDrawQuad(ResourceProvider* resource_provider, 185 bool OverlayCandidate::FromDrawQuad(ResourceProvider* resource_provider,
186 const DrawQuad* quad, 186 const DrawQuad* quad,
187 OverlayCandidate* candidate) { 187 OverlayCandidate* candidate) {
188 if (quad->needs_blending || quad->shared_quad_state->opacity != 1.f || 188 if (quad->ShouldDrawWithBlending() ||
189 quad->shared_quad_state->opacity != 1.f ||
189 quad->shared_quad_state->blend_mode != SkXfermode::kSrcOver_Mode) 190 quad->shared_quad_state->blend_mode != SkXfermode::kSrcOver_Mode)
190 return false; 191 return false;
191 192
192 auto& transform = quad->shared_quad_state->quad_to_target_transform; 193 auto& transform = quad->shared_quad_state->quad_to_target_transform;
193 candidate->display_rect = gfx::RectF(quad->rect); 194 candidate->display_rect = gfx::RectF(quad->rect);
194 transform.TransformRect(&candidate->display_rect); 195 transform.TransformRect(&candidate->display_rect);
195 candidate->quad_rect_in_target_space = 196 candidate->quad_rect_in_target_space =
196 MathUtil::MapEnclosingClippedRect(transform, quad->rect); 197 MathUtil::MapEnclosingClippedRect(transform, quad->rect);
197 198
198 candidate->format = RGBA_8888; 199 candidate->format = RGBA_8888;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 246
246 // static 247 // static
247 bool OverlayCandidate::FromTextureQuad(ResourceProvider* resource_provider, 248 bool OverlayCandidate::FromTextureQuad(ResourceProvider* resource_provider,
248 const TextureDrawQuad* quad, 249 const TextureDrawQuad* quad,
249 OverlayCandidate* candidate) { 250 OverlayCandidate* candidate) {
250 if (!resource_provider->IsOverlayCandidate(quad->resource_id())) 251 if (!resource_provider->IsOverlayCandidate(quad->resource_id()))
251 return false; 252 return false;
252 gfx::OverlayTransform overlay_transform = GetOverlayTransform( 253 gfx::OverlayTransform overlay_transform = GetOverlayTransform(
253 quad->shared_quad_state->quad_to_target_transform, quad->y_flipped); 254 quad->shared_quad_state->quad_to_target_transform, quad->y_flipped);
254 if (quad->background_color != SK_ColorTRANSPARENT || 255 if (quad->background_color != SK_ColorTRANSPARENT ||
255 quad->premultiplied_alpha ||
256 overlay_transform == gfx::OVERLAY_TRANSFORM_INVALID) 256 overlay_transform == gfx::OVERLAY_TRANSFORM_INVALID)
257 return false; 257 return false;
258 candidate->resource_id = quad->resource_id(); 258 candidate->resource_id = quad->resource_id();
259 candidate->resource_size_in_pixels = quad->resource_size_in_pixels(); 259 candidate->resource_size_in_pixels = quad->resource_size_in_pixels();
260 candidate->transform = overlay_transform; 260 candidate->transform = overlay_transform;
261 candidate->uv_rect = BoundingRect(quad->uv_top_left, quad->uv_bottom_right); 261 candidate->uv_rect = BoundingRect(quad->uv_top_left, quad->uv_bottom_right);
262 return true; 262 return true;
263 } 263 }
264 264
265 // static 265 // static
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 candidate->uv_rect = gfx::RectF(uv0.x(), uv1.y(), delta.x(), -delta.y()); 302 candidate->uv_rect = gfx::RectF(uv0.x(), uv1.y(), delta.x(), -delta.y());
303 } else { 303 } else {
304 candidate->transform = ComposeTransforms( 304 candidate->transform = ComposeTransforms(
305 gfx::OVERLAY_TRANSFORM_FLIP_VERTICAL, candidate->transform); 305 gfx::OVERLAY_TRANSFORM_FLIP_VERTICAL, candidate->transform);
306 candidate->uv_rect = gfx::RectF(uv0.x(), uv0.y(), delta.x(), delta.y()); 306 candidate->uv_rect = gfx::RectF(uv0.x(), uv0.y(), delta.x(), delta.y());
307 } 307 }
308 return true; 308 return true;
309 } 309 }
310 310
311 } // namespace cc 311 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/output/overlay_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698