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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 for (size_t i = 0; i < children_.size(); ++i) | 421 for (size_t i = 0; i < children_.size(); ++i) |
422 children_[i]->OnDeviceScaleFactorChanged(device_scale_factor); | 422 children_[i]->OnDeviceScaleFactorChanged(device_scale_factor); |
423 } | 423 } |
424 | 424 |
425 void Layer::paintContents(WebKit::WebCanvas* web_canvas, | 425 void Layer::paintContents(WebKit::WebCanvas* web_canvas, |
426 const WebKit::WebRect& clip) { | 426 const WebKit::WebRect& clip) { |
427 TRACE_EVENT0("ui", "Layer::paintContents"); | 427 TRACE_EVENT0("ui", "Layer::paintContents"); |
428 gfx::Canvas canvas(web_canvas); | 428 gfx::Canvas canvas(web_canvas); |
429 bool scale_content = scale_content_; | 429 bool scale_content = scale_content_; |
430 if (scale_content) { | 430 if (scale_content) { |
| 431 canvas.Save(); |
431 canvas.sk_canvas()->scale(SkFloatToScalar(device_scale_factor_), | 432 canvas.sk_canvas()->scale(SkFloatToScalar(device_scale_factor_), |
432 SkFloatToScalar(device_scale_factor_)); | 433 SkFloatToScalar(device_scale_factor_)); |
433 } | 434 } |
434 if (delegate_) | 435 if (delegate_) |
435 delegate_->OnPaintLayer(&canvas); | 436 delegate_->OnPaintLayer(&canvas); |
436 if (scale_content) | 437 if (scale_content) |
437 canvas.Restore(); | 438 canvas.Restore(); |
438 } | 439 } |
439 | 440 |
440 void Layer::SetForceRenderSurface(bool force) { | 441 void Layer::SetForceRenderSurface(bool force) { |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 return; | 667 return; |
667 unsigned int color = 0xFF000000; | 668 unsigned int color = 0xFF000000; |
668 color |= web_layer_is_accelerated_ ? 0x0000FF00 : 0x00FF0000; | 669 color |= web_layer_is_accelerated_ ? 0x0000FF00 : 0x00FF0000; |
669 bool opaque = fills_bounds_opaquely_ && (GetCombinedOpacity() == 1.f); | 670 bool opaque = fills_bounds_opaquely_ && (GetCombinedOpacity() == 1.f); |
670 if (!opaque) | 671 if (!opaque) |
671 color |= 0xFF; | 672 color |= 0xFF; |
672 web_layer_.setDebugBorderColor(color); | 673 web_layer_.setDebugBorderColor(color); |
673 } | 674 } |
674 | 675 |
675 } // namespace ui | 676 } // namespace ui |
OLD | NEW |