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

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

Issue 7597001: Ensure that blending is disabled for layers with no alpha (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: use fills_bounds_opaquely() rather than adding HasAlpha Created 9 years, 4 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 | « no previous file | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/gfx/compositor/layer.h" 5 #include "ui/gfx/compositor/layer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 10
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 82
83 void Layer::Draw() { 83 void Layer::Draw() {
84 ui::TextureDrawParams texture_draw_params; 84 ui::TextureDrawParams texture_draw_params;
85 for (Layer* layer = this; layer; layer = layer->parent_) { 85 for (Layer* layer = this; layer; layer = layer->parent_) {
86 texture_draw_params.transform.ConcatTransform(layer->transform_); 86 texture_draw_params.transform.ConcatTransform(layer->transform_);
87 texture_draw_params.transform.ConcatTranslate( 87 texture_draw_params.transform.ConcatTranslate(
88 static_cast<float>(layer->bounds_.x()), 88 static_cast<float>(layer->bounds_.x()),
89 static_cast<float>(layer->bounds_.y())); 89 static_cast<float>(layer->bounds_.y()));
90 } 90 }
91 91
92 // Only blend for child layers. The root layer will clobber the cleared bg. 92 // Only blend for transparent child layers.
93 texture_draw_params.blend = parent_ != NULL; 93 // The root layer will clobber the cleared bg.
94 texture_draw_params.blend = parent_ != NULL && !fills_bounds_opaquely_;
94 95
95 #if defined(OS_WIN) 96 #if defined(OS_WIN)
96 texture_->Draw(texture_draw_params); 97 texture_->Draw(texture_draw_params);
97 #else 98 #else
98 hole_rect_ = hole_rect_.Intersect( 99 hole_rect_ = hole_rect_.Intersect(
99 gfx::Rect(0, 0, bounds_.width(), bounds_.height())); 100 gfx::Rect(0, 0, bounds_.width(), bounds_.height()));
100 101
101 // top 102 // top
102 DrawRegion(texture_draw_params, gfx::Rect(0, 103 DrawRegion(texture_draw_params, gfx::Rect(0,
103 0, 104 0,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 !children_[i]->transform().HasChange()) { 137 !children_[i]->transform().HasChange()) {
137 hole_rect_ = children_[i]->bounds(); 138 hole_rect_ = children_[i]->bounds();
138 return; 139 return;
139 } 140 }
140 } 141 }
141 // no opaque child layers, set hole_rect_ to empty 142 // no opaque child layers, set hole_rect_ to empty
142 hole_rect_ = gfx::Rect(); 143 hole_rect_ = gfx::Rect();
143 } 144 }
144 145
145 } // namespace ui 146 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698