| 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 504 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 515   mailbox_scale_factor_ = scale_factor; | 515   mailbox_scale_factor_ = scale_factor; | 
| 516   RecomputeDrawsContentAndUVRect(); | 516   RecomputeDrawsContentAndUVRect(); | 
| 517 } | 517 } | 
| 518 | 518 | 
| 519 cc::TextureMailbox Layer::GetTextureMailbox(float* scale_factor) { | 519 cc::TextureMailbox Layer::GetTextureMailbox(float* scale_factor) { | 
| 520   if (scale_factor) | 520   if (scale_factor) | 
| 521     *scale_factor = mailbox_scale_factor_; | 521     *scale_factor = mailbox_scale_factor_; | 
| 522   return mailbox_; | 522   return mailbox_; | 
| 523 } | 523 } | 
| 524 | 524 | 
| 525 void Layer::SetDelegatedFrame(scoped_ptr<cc::DelegatedFrameData> frame, | 525 void Layer::SetShowDelegatedContent(cc::DelegatedFrameProvider* frame_provider, | 
| 526                               gfx::Size frame_size_in_dip) { | 526                                     gfx::Size frame_size_in_dip) { | 
| 527   DCHECK(frame && !frame->render_pass_list.empty()); | 527   DCHECK_EQ(type_, LAYER_TEXTURED); | 
| 528 | 528 | 
| 529   DCHECK_EQ(type_, LAYER_TEXTURED); | 529   scoped_refptr<cc::DelegatedRendererLayer> new_layer = | 
|  | 530       cc::DelegatedRendererLayer::Create(NULL, frame_provider); | 
|  | 531   SwitchToLayer(new_layer); | 
|  | 532   delegated_renderer_layer_ = new_layer; | 
| 530   layer_updated_externally_ = true; | 533   layer_updated_externally_ = true; | 
|  | 534 | 
| 531   delegated_frame_size_in_dip_ = frame_size_in_dip; | 535   delegated_frame_size_in_dip_ = frame_size_in_dip; | 
| 532   if (!delegated_renderer_layer_.get()) { |  | 
| 533     scoped_refptr<cc::DelegatedRendererLayer> new_layer = |  | 
| 534         cc::DelegatedRendererLayer::Create(NULL); |  | 
| 535     SwitchToLayer(new_layer); |  | 
| 536     delegated_renderer_layer_ = new_layer; |  | 
| 537   } |  | 
| 538   delegated_renderer_layer_->SetFrameData(frame.Pass()); |  | 
| 539   RecomputeDrawsContentAndUVRect(); | 536   RecomputeDrawsContentAndUVRect(); | 
| 540 } | 537 } | 
| 541 | 538 | 
| 542 void Layer::TakeUnusedResourcesForChildCompositor( |  | 
| 543     cc::ReturnedResourceArray* list) { |  | 
| 544   if (delegated_renderer_layer_.get()) |  | 
| 545     delegated_renderer_layer_->TakeUnusedResourcesForChildCompositor(list); |  | 
| 546 } |  | 
| 547 |  | 
| 548 void Layer::SetShowPaintedContent() { | 539 void Layer::SetShowPaintedContent() { | 
| 549   if (content_layer_.get()) | 540   if (content_layer_.get()) | 
| 550     return; | 541     return; | 
| 551 | 542 | 
| 552   scoped_refptr<cc::ContentLayer> new_layer = cc::ContentLayer::Create(this); | 543   scoped_refptr<cc::ContentLayer> new_layer = cc::ContentLayer::Create(this); | 
| 553   SwitchToLayer(new_layer); | 544   SwitchToLayer(new_layer); | 
| 554   content_layer_ = new_layer; | 545   content_layer_ = new_layer; | 
| 555 | 546 | 
| 556   layer_updated_externally_ = false; | 547   layer_updated_externally_ = false; | 
| 557   mailbox_ = cc::TextureMailbox(); | 548   mailbox_ = cc::TextureMailbox(); | 
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 972   cc_layer_->SetBounds(ConvertSizeToPixel(this, size)); | 963   cc_layer_->SetBounds(ConvertSizeToPixel(this, size)); | 
| 973 } | 964 } | 
| 974 | 965 | 
| 975 void Layer::RecomputePosition() { | 966 void Layer::RecomputePosition() { | 
| 976   cc_layer_->SetPosition(gfx::ScalePoint( | 967   cc_layer_->SetPosition(gfx::ScalePoint( | 
| 977         gfx::PointF(bounds_.x(), bounds_.y()), | 968         gfx::PointF(bounds_.x(), bounds_.y()), | 
| 978         device_scale_factor_)); | 969         device_scale_factor_)); | 
| 979 } | 970 } | 
| 980 | 971 | 
| 981 }  // namespace ui | 972 }  // namespace ui | 
| OLD | NEW | 
|---|