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

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

Issue 11275088: Remove implicit scoped_refptr operator T* Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 8 years, 1 month 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
« no previous file with comments | « sync/tools/sync_client.cc ('k') | webkit/appcache/appcache.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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 delegate_(NULL), 88 delegate_(NULL),
89 scale_content_(true), 89 scale_content_(true),
90 device_scale_factor_(1.0f) { 90 device_scale_factor_(1.0f) {
91 CreateWebLayer(); 91 CreateWebLayer();
92 } 92 }
93 93
94 Layer::~Layer() { 94 Layer::~Layer() {
95 // Destroying the animator may cause observers to use the layer (and 95 // Destroying the animator may cause observers to use the layer (and
96 // indirectly the WebLayer). Destroy the animator first so that the WebLayer 96 // indirectly the WebLayer). Destroy the animator first so that the WebLayer
97 // is still around. 97 // is still around.
98 if (animator_) 98 if (animator_.get())
99 animator_->SetDelegate(NULL); 99 animator_->SetDelegate(NULL);
100 animator_ = NULL; 100 animator_ = NULL;
101 if (compositor_) 101 if (compositor_)
102 compositor_->SetRootLayer(NULL); 102 compositor_->SetRootLayer(NULL);
103 if (parent_) 103 if (parent_)
104 parent_->Remove(this); 104 parent_->Remove(this);
105 if (layer_mask_) 105 if (layer_mask_)
106 SetMaskLayer(NULL); 106 SetMaskLayer(NULL);
107 if (layer_mask_back_link_) 107 if (layer_mask_back_link_)
108 layer_mask_back_link_->SetMaskLayer(NULL); 108 layer_mask_back_link_->SetMaskLayer(NULL);
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 RecomputeDebugBorderColor(); 421 RecomputeDebugBorderColor();
422 } 422 }
423 RecomputeDrawsContentAndUVRect(); 423 RecomputeDrawsContentAndUVRect();
424 } 424 }
425 425
426 void Layer::SetColor(SkColor color) { 426 void Layer::SetColor(SkColor color) {
427 GetAnimator()->SetColor(color); 427 GetAnimator()->SetColor(color);
428 } 428 }
429 429
430 bool Layer::SchedulePaint(const gfx::Rect& invalid_rect) { 430 bool Layer::SchedulePaint(const gfx::Rect& invalid_rect) {
431 if (type_ == LAYER_SOLID_COLOR || (!delegate_ && !texture_)) 431 if (type_ == LAYER_SOLID_COLOR || (!delegate_ && !texture_.get()))
432 return false; 432 return false;
433 433
434 damaged_region_.op(invalid_rect.x(), 434 damaged_region_.op(invalid_rect.x(),
435 invalid_rect.y(), 435 invalid_rect.y(),
436 invalid_rect.right(), 436 invalid_rect.right(),
437 invalid_rect.bottom(), 437 invalid_rect.bottom(),
438 SkRegion::kUnion_Op); 438 SkRegion::kUnion_Op);
439 ScheduleDraw(); 439 ScheduleDraw();
440 return true; 440 return true;
441 } 441 }
442 442
443 void Layer::ScheduleDraw() { 443 void Layer::ScheduleDraw() {
444 Compositor* compositor = GetCompositor(); 444 Compositor* compositor = GetCompositor();
445 if (compositor) 445 if (compositor)
446 compositor->ScheduleDraw(); 446 compositor->ScheduleDraw();
447 } 447 }
448 448
449 void Layer::SendDamagedRects() { 449 void Layer::SendDamagedRects() {
450 if ((delegate_ || texture_) && !damaged_region_.isEmpty()) { 450 if ((delegate_ || texture_.get()) && !damaged_region_.isEmpty()) {
451 for (SkRegion::Iterator iter(damaged_region_); 451 for (SkRegion::Iterator iter(damaged_region_);
452 !iter.done(); iter.next()) { 452 !iter.done(); iter.next()) {
453 const SkIRect& sk_damaged = iter.rect(); 453 const SkIRect& sk_damaged = iter.rect();
454 gfx::Rect damaged( 454 gfx::Rect damaged(
455 sk_damaged.x(), 455 sk_damaged.x(),
456 sk_damaged.y(), 456 sk_damaged.y(),
457 sk_damaged.width(), 457 sk_damaged.width(),
458 sk_damaged.height()); 458 sk_damaged.height());
459 459
460 gfx::Rect damaged_in_pixel = ConvertRectToPixel(this, damaged); 460 gfx::Rect damaged_in_pixel = ConvertRectToPixel(this, damaged);
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 return; 788 return;
789 unsigned int color = 0xFF000000; 789 unsigned int color = 0xFF000000;
790 color |= web_layer_is_accelerated_ ? 0x0000FF00 : 0x00FF0000; 790 color |= web_layer_is_accelerated_ ? 0x0000FF00 : 0x00FF0000;
791 bool opaque = fills_bounds_opaquely_ && (GetCombinedOpacity() == 1.f); 791 bool opaque = fills_bounds_opaquely_ && (GetCombinedOpacity() == 1.f);
792 if (!opaque) 792 if (!opaque)
793 color |= 0xFF; 793 color |= 0xFF;
794 web_layer_->setDebugBorderColor(color); 794 web_layer_->setDebugBorderColor(color);
795 } 795 }
796 796
797 } // namespace ui 797 } // namespace ui
OLDNEW
« no previous file with comments | « sync/tools/sync_client.cc ('k') | webkit/appcache/appcache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698