| 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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 } | 370 } |
| 371 | 371 |
| 372 void Layer::OnDeviceScaleFactorChanged(float device_scale_factor) { | 372 void Layer::OnDeviceScaleFactorChanged(float device_scale_factor) { |
| 373 CHECK(IsDIPEnabled()); | 373 CHECK(IsDIPEnabled()); |
| 374 if (device_scale_factor_ == device_scale_factor) | 374 if (device_scale_factor_ == device_scale_factor) |
| 375 return; | 375 return; |
| 376 device_scale_factor_ = device_scale_factor; | 376 device_scale_factor_ = device_scale_factor; |
| 377 RecomputeTransform(); | 377 RecomputeTransform(); |
| 378 RecomputeDrawsContentAndUVRect(); | 378 RecomputeDrawsContentAndUVRect(); |
| 379 SchedulePaint(gfx::Rect(bounds_.size())); | 379 SchedulePaint(gfx::Rect(bounds_.size())); |
| 380 if (delegate_) |
| 381 delegate_->OnDeviceScaleFactorChanged(device_scale_factor); |
| 380 for (size_t i = 0; i < children_.size(); ++i) | 382 for (size_t i = 0; i < children_.size(); ++i) |
| 381 children_[i]->OnDeviceScaleFactorChanged(device_scale_factor); | 383 children_[i]->OnDeviceScaleFactorChanged(device_scale_factor); |
| 382 } | 384 } |
| 383 | 385 |
| 384 void Layer::paintContents(WebKit::WebCanvas* web_canvas, | 386 void Layer::paintContents(WebKit::WebCanvas* web_canvas, |
| 385 const WebKit::WebRect& clip) { | 387 const WebKit::WebRect& clip) { |
| 386 TRACE_EVENT0("ui", "Layer::paintContents"); | 388 TRACE_EVENT0("ui", "Layer::paintContents"); |
| 387 gfx::Canvas canvas(web_canvas); | 389 gfx::Canvas canvas(web_canvas); |
| 388 bool scale_canvas = IsDIPEnabled() && scale_canvas_; | 390 bool scale_canvas = IsDIPEnabled() && scale_canvas_; |
| 389 if (scale_canvas) { | 391 if (scale_canvas) { |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 return; | 620 return; |
| 619 unsigned int color = 0xFF000000; | 621 unsigned int color = 0xFF000000; |
| 620 color |= web_layer_is_accelerated_ ? 0x0000FF00 : 0x00FF0000; | 622 color |= web_layer_is_accelerated_ ? 0x0000FF00 : 0x00FF0000; |
| 621 bool opaque = fills_bounds_opaquely_ && (GetCombinedOpacity() == 1.f); | 623 bool opaque = fills_bounds_opaquely_ && (GetCombinedOpacity() == 1.f); |
| 622 if (!opaque) | 624 if (!opaque) |
| 623 color |= 0xFF; | 625 color |= 0xFF; |
| 624 web_layer_.setDebugBorderColor(color); | 626 web_layer_.setDebugBorderColor(color); |
| 625 } | 627 } |
| 626 | 628 |
| 627 } // namespace ui | 629 } // namespace ui |
| OLD | NEW |