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 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 } | 481 } |
482 | 482 |
483 void Layer::paintContents(WebKit::WebCanvas* web_canvas, | 483 void Layer::paintContents(WebKit::WebCanvas* web_canvas, |
484 const WebKit::WebRect& clip, | 484 const WebKit::WebRect& clip, |
485 #if defined(WEBCONTENTLAYERCLIENT_FLOAT_OPAQUE_RECT) | 485 #if defined(WEBCONTENTLAYERCLIENT_FLOAT_OPAQUE_RECT) |
486 WebKit::WebFloatRect& opaque) { | 486 WebKit::WebFloatRect& opaque) { |
487 #else | 487 #else |
488 WebKit::WebRect& opaque) { | 488 WebKit::WebRect& opaque) { |
489 #endif | 489 #endif |
490 TRACE_EVENT0("ui", "Layer::paintContents"); | 490 TRACE_EVENT0("ui", "Layer::paintContents"); |
491 scoped_ptr<gfx::Canvas> canvas(gfx::Canvas::CreateCanvasWithoutScaling( | 491 gfx::Canvas canvas(web_canvas, |
492 web_canvas, ui::GetScaleFactorFromScale(device_scale_factor_))); | 492 ui::GetScaleFactorFromScale(device_scale_factor_), scale_content_); |
493 | |
494 if (scale_content_) { | |
495 canvas->Save(); | |
496 canvas->sk_canvas()->scale(SkFloatToScalar(device_scale_factor_), | |
497 SkFloatToScalar(device_scale_factor_)); | |
498 } | |
499 | 493 |
500 if (delegate_) | 494 if (delegate_) |
501 delegate_->OnPaintLayer(canvas.get()); | 495 delegate_->OnPaintLayer(&canvas); |
502 if (scale_content_) | |
503 canvas->Restore(); | |
504 } | 496 } |
505 | 497 |
506 unsigned Layer::prepareTexture(WebKit::WebTextureUpdater& /* updater */) { | 498 unsigned Layer::prepareTexture(WebKit::WebTextureUpdater& /* updater */) { |
507 DCHECK(layer_updated_externally_); | 499 DCHECK(layer_updated_externally_); |
508 return texture_->texture_id(); | 500 return texture_->texture_id(); |
509 } | 501 } |
510 | 502 |
511 WebKit::WebGraphicsContext3D* Layer::context() { | 503 WebKit::WebGraphicsContext3D* Layer::context() { |
512 DCHECK(layer_updated_externally_); | 504 DCHECK(layer_updated_externally_); |
513 return texture_->HostContext3D(); | 505 return texture_->HostContext3D(); |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 return; | 757 return; |
766 unsigned int color = 0xFF000000; | 758 unsigned int color = 0xFF000000; |
767 color |= web_layer_is_accelerated_ ? 0x0000FF00 : 0x00FF0000; | 759 color |= web_layer_is_accelerated_ ? 0x0000FF00 : 0x00FF0000; |
768 bool opaque = fills_bounds_opaquely_ && (GetCombinedOpacity() == 1.f); | 760 bool opaque = fills_bounds_opaquely_ && (GetCombinedOpacity() == 1.f); |
769 if (!opaque) | 761 if (!opaque) |
770 color |= 0xFF; | 762 color |= 0xFF; |
771 web_layer_.setDebugBorderColor(color); | 763 web_layer_.setDebugBorderColor(color); |
772 } | 764 } |
773 | 765 |
774 } // namespace ui | 766 } // namespace ui |
OLD | NEW |