OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "content/browser/android/edge_effect.h" | 5 #include "content/browser/android/edge_effect.h" |
6 | 6 |
7 #include "cc/layers/layer.h" | 7 #include "cc/layers/layer.h" |
8 #include "ui/gfx/screen.h" | 8 #include "ui/gfx/screen.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 if (size.IsEmpty()) { | 337 if (size.IsEmpty()) { |
338 DisableLayer(edge_.get()); | 338 DisableLayer(edge_.get()); |
339 DisableLayer(glow_.get()); | 339 DisableLayer(glow_.get()); |
340 return; | 340 return; |
341 } | 341 } |
342 | 342 |
343 float dummy_scale_x, dummy_scale_y; | 343 float dummy_scale_x, dummy_scale_y; |
344 | 344 |
345 // Glow | 345 // Glow |
346 gfx::Size glow_image_bounds; | 346 gfx::Size glow_image_bounds; |
347 glow_->CalculateContentsScale(1.f, 1.f, 1.f, false, | 347 glow_->CalculateContentsScale(1.f, 1.f, 1.f, 0.f, false, |
348 &dummy_scale_x, &dummy_scale_y, | 348 &dummy_scale_x, &dummy_scale_y, |
349 &glow_image_bounds); | 349 &glow_image_bounds); |
350 const int glow_height = glow_image_bounds.height(); | 350 const int glow_height = glow_image_bounds.height(); |
351 const int glow_width = glow_image_bounds.width(); | 351 const int glow_width = glow_image_bounds.width(); |
352 const int glow_bottom = static_cast<int>(std::min( | 352 const int glow_bottom = static_cast<int>(std::min( |
353 glow_height * glow_scale_y_ * glow_height / glow_width * 0.6f, | 353 glow_height * glow_scale_y_ * glow_height / glow_width * 0.6f, |
354 glow_height * kMaxGlowHeight) * dpi_scale_ + 0.5f); | 354 glow_height * kMaxGlowHeight) * dpi_scale_ + 0.5f); |
355 UpdateLayer(glow_.get(), edge, size, glow_bottom, glow_alpha_); | 355 UpdateLayer(glow_.get(), edge, size, glow_bottom, glow_alpha_); |
356 | 356 |
357 // Edge | 357 // Edge |
358 gfx::Size edge_image_bounds; | 358 gfx::Size edge_image_bounds; |
359 edge_->CalculateContentsScale(1.f, 1.f, 1.f, false, | 359 edge_->CalculateContentsScale(1.f, 1.f, 1.f, 0.f, false, |
360 &dummy_scale_x, &dummy_scale_y, | 360 &dummy_scale_x, &dummy_scale_y, |
361 &edge_image_bounds); | 361 &edge_image_bounds); |
362 const int edge_height = edge_image_bounds.height(); | 362 const int edge_height = edge_image_bounds.height(); |
363 const int edge_bottom = static_cast<int>( | 363 const int edge_bottom = static_cast<int>( |
364 edge_height * edge_scale_y_ * dpi_scale_); | 364 edge_height * edge_scale_y_ * dpi_scale_); |
365 UpdateLayer(edge_.get(), edge, size, edge_bottom, edge_alpha_); | 365 UpdateLayer(edge_.get(), edge, size, edge_bottom, edge_alpha_); |
366 } | 366 } |
367 | 367 |
368 } // namespace content | 368 } // namespace content |
OLD | NEW |