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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 candidate); | 210 candidate); |
211 default: | 211 default: |
212 break; | 212 break; |
213 } | 213 } |
214 | 214 |
215 return false; | 215 return false; |
216 } | 216 } |
217 | 217 |
218 // static | 218 // static |
219 bool OverlayCandidate::IsInvisibleQuad(const DrawQuad* quad) { | 219 bool OverlayCandidate::IsInvisibleQuad(const DrawQuad* quad) { |
| 220 float opacity = quad->shared_quad_state->opacity; |
| 221 if (opacity < std::numeric_limits<float>::epsilon()) |
| 222 return true; |
220 if (quad->material == DrawQuad::SOLID_COLOR) { | 223 if (quad->material == DrawQuad::SOLID_COLOR) { |
221 SkColor color = SolidColorDrawQuad::MaterialCast(quad)->color; | 224 SkColor color = SolidColorDrawQuad::MaterialCast(quad)->color; |
222 float opacity = quad->shared_quad_state->opacity; | |
223 float alpha = (SkColorGetA(color) * (1.0f / 255.0f)) * opacity; | 225 float alpha = (SkColorGetA(color) * (1.0f / 255.0f)) * opacity; |
224 return quad->ShouldDrawWithBlending() && | 226 return quad->ShouldDrawWithBlending() && |
225 alpha < std::numeric_limits<float>::epsilon(); | 227 alpha < std::numeric_limits<float>::epsilon(); |
226 } | 228 } |
227 return false; | 229 return false; |
228 } | 230 } |
229 | 231 |
230 // static | 232 // static |
231 bool OverlayCandidate::IsOccluded(const OverlayCandidate& candidate, | 233 bool OverlayCandidate::IsOccluded(const OverlayCandidate& candidate, |
232 QuadList::ConstIterator quad_list_begin, | 234 QuadList::ConstIterator quad_list_begin, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 candidate->uv_rect = gfx::RectF(uv0.x(), uv1.y(), delta.x(), -delta.y()); | 304 candidate->uv_rect = gfx::RectF(uv0.x(), uv1.y(), delta.x(), -delta.y()); |
303 } else { | 305 } else { |
304 candidate->transform = ComposeTransforms( | 306 candidate->transform = ComposeTransforms( |
305 gfx::OVERLAY_TRANSFORM_FLIP_VERTICAL, candidate->transform); | 307 gfx::OVERLAY_TRANSFORM_FLIP_VERTICAL, candidate->transform); |
306 candidate->uv_rect = gfx::RectF(uv0.x(), uv0.y(), delta.x(), delta.y()); | 308 candidate->uv_rect = gfx::RectF(uv0.x(), uv0.y(), delta.x(), delta.y()); |
307 } | 309 } |
308 return true; | 310 return true; |
309 } | 311 } |
310 | 312 |
311 } // namespace cc | 313 } // namespace cc |
OLD | NEW |