OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/compositor/layer.h" | 5 #include "ui/compositor/layer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 // sizes once WebKit understands DIP. http://crbug.com/127455 | 595 // sizes once WebKit understands DIP. http://crbug.com/127455 |
596 gfx::Size size(std::min(bounds().width(), texture_size.width()), | 596 gfx::Size size(std::min(bounds().width(), texture_size.width()), |
597 std::min(bounds().height(), texture_size.height())); | 597 std::min(bounds().height(), texture_size.height())); |
598 WebKit::WebFloatRect rect( | 598 WebKit::WebFloatRect rect( |
599 0, | 599 0, |
600 0, | 600 0, |
601 static_cast<float>(size.width())/texture_size.width(), | 601 static_cast<float>(size.width())/texture_size.width(), |
602 static_cast<float>(size.height())/texture_size.height()); | 602 static_cast<float>(size.height())/texture_size.height()); |
603 texture_layer.setUVRect(rect); | 603 texture_layer.setUVRect(rect); |
604 | 604 |
605 gfx::Size size_in_pixel = ConvertSizeToPixel(this, bounds().size()); | 605 gfx::Size size_in_pixel = ConvertSizeToPixel(this, size); |
606 web_layer_.setBounds(size_in_pixel); | 606 web_layer_.setBounds(size_in_pixel); |
607 } | 607 } |
608 } | 608 } |
609 | 609 |
610 void Layer::RecomputeDebugBorderColor() { | 610 void Layer::RecomputeDebugBorderColor() { |
611 if (!show_debug_borders_) | 611 if (!show_debug_borders_) |
612 return; | 612 return; |
613 unsigned int color = 0xFF000000; | 613 unsigned int color = 0xFF000000; |
614 color |= web_layer_is_accelerated_ ? 0x0000FF00 : 0x00FF0000; | 614 color |= web_layer_is_accelerated_ ? 0x0000FF00 : 0x00FF0000; |
615 bool opaque = fills_bounds_opaquely_ && (GetCombinedOpacity() == 1.f); | 615 bool opaque = fills_bounds_opaquely_ && (GetCombinedOpacity() == 1.f); |
616 if (!opaque) | 616 if (!opaque) |
617 color |= 0xFF; | 617 color |= 0xFF; |
618 web_layer_.setDebugBorderColor(color); | 618 web_layer_.setDebugBorderColor(color); |
619 } | 619 } |
620 | 620 |
621 } // namespace ui | 621 } // namespace ui |
OLD | NEW |