Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(340)

Side by Side Diff: ui/compositor/layer.cc

Issue 26023004: aura: Allow delegated frames to be used by more than one impl layer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: frameprovider: are_layers_attached checks Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/compositor/layer.h ('k') | ui/compositor/layer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « ui/compositor/layer.h ('k') | ui/compositor/layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698