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

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

Issue 12774006: cc: Chromify Layer and LayerImpl classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: MoreAndroidCompilings Created 7 years, 9 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 | « content/renderer/gpu/render_widget_compositor.cc ('k') | ui/compositor/layer.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/compositor.h" 5 #include "ui/compositor/compositor.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <deque> 8 #include <deque>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 gfx::AcceleratedWidget widget) 355 gfx::AcceleratedWidget widget)
356 : delegate_(delegate), 356 : delegate_(delegate),
357 root_layer_(NULL), 357 root_layer_(NULL),
358 widget_(widget), 358 widget_(widget),
359 posted_swaps_(new PostedSwapQueue()), 359 posted_swaps_(new PostedSwapQueue()),
360 device_scale_factor_(0.0f), 360 device_scale_factor_(0.0f),
361 last_started_frame_(0), 361 last_started_frame_(0),
362 last_ended_frame_(0), 362 last_ended_frame_(0),
363 disable_schedule_composite_(false), 363 disable_schedule_composite_(false),
364 compositor_lock_(NULL) { 364 compositor_lock_(NULL) {
365 root_web_layer_ = cc::Layer::create(); 365 root_web_layer_ = cc::Layer::Create();
366 root_web_layer_->setAnchorPoint(gfx::PointF(0.f, 0.f)); 366 root_web_layer_->SetAnchorPoint(gfx::PointF(0.f, 0.f));
367 367
368 CommandLine* command_line = CommandLine::ForCurrentProcess(); 368 CommandLine* command_line = CommandLine::ForCurrentProcess();
369 cc::LayerTreeSettings settings; 369 cc::LayerTreeSettings settings;
370 settings.initialDebugState.showFPSCounter = 370 settings.initialDebugState.showFPSCounter =
371 command_line->HasSwitch(switches::kUIShowFPSCounter); 371 command_line->HasSwitch(switches::kUIShowFPSCounter);
372 settings.initialDebugState.showPlatformLayerTree = 372 settings.initialDebugState.showPlatformLayerTree =
373 command_line->HasSwitch(switches::kUIShowLayerTree); 373 command_line->HasSwitch(switches::kUIShowLayerTree);
374 settings.refreshRate = 374 settings.refreshRate =
375 g_test_compositor_enabled ? kTestRefreshRate : kDefaultRefreshRate; 375 g_test_compositor_enabled ? kTestRefreshRate : kDefaultRefreshRate;
376 settings.initialDebugState.showDebugBorders = 376 settings.initialDebugState.showDebugBorders =
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 } 431 }
432 432
433 void Compositor::SetRootLayer(Layer* root_layer) { 433 void Compositor::SetRootLayer(Layer* root_layer) {
434 if (root_layer_ == root_layer) 434 if (root_layer_ == root_layer)
435 return; 435 return;
436 if (root_layer_) 436 if (root_layer_)
437 root_layer_->SetCompositor(NULL); 437 root_layer_->SetCompositor(NULL);
438 root_layer_ = root_layer; 438 root_layer_ = root_layer;
439 if (root_layer_ && !root_layer_->GetCompositor()) 439 if (root_layer_ && !root_layer_->GetCompositor())
440 root_layer_->SetCompositor(this); 440 root_layer_->SetCompositor(this);
441 root_web_layer_->removeAllChildren(); 441 root_web_layer_->RemoveAllChildren();
442 if (root_layer_) 442 if (root_layer_)
443 root_web_layer_->addChild(root_layer_->cc_layer()); 443 root_web_layer_->AddChild(root_layer_->cc_layer());
444 } 444 }
445 445
446 void Compositor::SetHostHasTransparentBackground( 446 void Compositor::SetHostHasTransparentBackground(
447 bool host_has_transparent_background) { 447 bool host_has_transparent_background) {
448 host_->setHasTransparentBackground(host_has_transparent_background); 448 host_->setHasTransparentBackground(host_has_transparent_background);
449 } 449 }
450 450
451 void Compositor::Draw(bool force_clear) { 451 void Compositor::Draw(bool force_clear) {
452 DCHECK(!g_compositor_thread); 452 DCHECK(!g_compositor_thread);
453 453
(...skipping 29 matching lines...) Expand all
483 CancelCompositorLock(); 483 CancelCompositorLock();
484 PendingSwap pending_swap(READPIXELS_SWAP, posted_swaps_.get()); 484 PendingSwap pending_swap(READPIXELS_SWAP, posted_swaps_.get());
485 return host_->compositeAndReadback(pixels, bounds_in_pixel); 485 return host_->compositeAndReadback(pixels, bounds_in_pixel);
486 } 486 }
487 487
488 void Compositor::SetScaleAndSize(float scale, const gfx::Size& size_in_pixel) { 488 void Compositor::SetScaleAndSize(float scale, const gfx::Size& size_in_pixel) {
489 DCHECK_GT(scale, 0); 489 DCHECK_GT(scale, 0);
490 if (!size_in_pixel.IsEmpty()) { 490 if (!size_in_pixel.IsEmpty()) {
491 size_ = size_in_pixel; 491 size_ = size_in_pixel;
492 host_->setViewportSize(size_in_pixel, size_in_pixel); 492 host_->setViewportSize(size_in_pixel, size_in_pixel);
493 root_web_layer_->setBounds(size_in_pixel); 493 root_web_layer_->SetBounds(size_in_pixel);
494 } 494 }
495 if (device_scale_factor_ != scale) { 495 if (device_scale_factor_ != scale) {
496 device_scale_factor_ = scale; 496 device_scale_factor_ = scale;
497 if (root_layer_) 497 if (root_layer_)
498 root_layer_->OnDeviceScaleFactorChanged(scale); 498 root_layer_->OnDeviceScaleFactorChanged(scale);
499 } 499 }
500 } 500 }
501 501
502 void Compositor::AddObserver(CompositorObserver* observer) { 502 void Compositor::AddObserver(CompositorObserver* observer) {
503 observer_list_.AddObserver(observer); 503 observer_list_.AddObserver(observer);
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 691
692 COMPOSITOR_EXPORT void DisableTestCompositor() { 692 COMPOSITOR_EXPORT void DisableTestCompositor() {
693 g_test_compositor_enabled = false; 693 g_test_compositor_enabled = false;
694 } 694 }
695 695
696 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() { 696 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() {
697 return g_test_compositor_enabled; 697 return g_test_compositor_enabled;
698 } 698 }
699 699
700 } // namespace ui 700 } // namespace ui
OLDNEW
« no previous file with comments | « content/renderer/gpu/render_widget_compositor.cc ('k') | ui/compositor/layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698