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

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

Issue 10833027: aura: apply brightness filter last to improve perf (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 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) 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 compositor_(NULL), 71 compositor_(NULL),
72 parent_(NULL), 72 parent_(NULL),
73 visible_(true), 73 visible_(true),
74 force_render_surface_(false), 74 force_render_surface_(false),
75 fills_bounds_opaquely_(true), 75 fills_bounds_opaquely_(true),
76 layer_updated_externally_(false), 76 layer_updated_externally_(false),
77 opacity_(1.0f), 77 opacity_(1.0f),
78 background_blur_radius_(0), 78 background_blur_radius_(0),
79 layer_saturation_(0.0f), 79 layer_saturation_(0.0f),
80 layer_brightness_(0.0f), 80 layer_brightness_(0.0f),
81 layer_grayscale_(0.0f),
81 layer_inverted_(false), 82 layer_inverted_(false),
82 layer_mask_(NULL), 83 layer_mask_(NULL),
83 layer_mask_back_link_(NULL), 84 layer_mask_back_link_(NULL),
84 delegate_(NULL), 85 delegate_(NULL),
85 scale_content_(true), 86 scale_content_(true),
86 device_scale_factor_(1.0f) { 87 device_scale_factor_(1.0f) {
87 CreateWebLayer(); 88 CreateWebLayer();
88 } 89 }
89 90
90 Layer::~Layer() { 91 Layer::~Layer() {
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 if (layer_mask) 282 if (layer_mask)
282 layer_mask->layer_mask_back_link_ = this; 283 layer_mask->layer_mask_back_link_ = this;
283 } 284 }
284 285
285 void Layer::SetLayerFilters() { 286 void Layer::SetLayerFilters() {
286 WebKit::WebFilterOperations filters; 287 WebKit::WebFilterOperations filters;
287 if (layer_saturation_) { 288 if (layer_saturation_) {
288 filters.append(WebKit::WebFilterOperation::createSaturateFilter( 289 filters.append(WebKit::WebFilterOperation::createSaturateFilter(
289 layer_saturation_)); 290 layer_saturation_));
290 } 291 }
291 if (layer_brightness_) {
292 filters.append(WebKit::WebFilterOperation::createBrightnessFilter(
293 layer_brightness_));
294 }
295 if (layer_grayscale_) { 292 if (layer_grayscale_) {
296 filters.append(WebKit::WebFilterOperation::createGrayscaleFilter( 293 filters.append(WebKit::WebFilterOperation::createGrayscaleFilter(
297 layer_grayscale_)); 294 layer_grayscale_));
298 } 295 }
299 if (layer_inverted_) 296 if (layer_inverted_)
300 filters.append(WebKit::WebFilterOperation::createInvertFilter(1.0)); 297 filters.append(WebKit::WebFilterOperation::createInvertFilter(1.0));
298 // Brightness goes last, because the resulting colors neeed clamping, which
299 // cause further color matrix filters to be applied separately. In this order,
300 // they all can be combined in a single pass.
301 if (layer_brightness_) {
302 filters.append(WebKit::WebFilterOperation::createBrightnessFilter(
303 layer_brightness_));
304 }
301 305
302 web_layer_.setFilters(filters); 306 web_layer_.setFilters(filters);
303 } 307 }
304 308
305 float Layer::GetTargetOpacity() const { 309 float Layer::GetTargetOpacity() const {
306 if (animator_.get() && animator_->IsAnimatingProperty( 310 if (animator_.get() && animator_->IsAnimatingProperty(
307 LayerAnimationElement::OPACITY)) 311 LayerAnimationElement::OPACITY))
308 return animator_->GetTargetOpacity(); 312 return animator_->GetTargetOpacity();
309 return opacity_; 313 return opacity_;
310 } 314 }
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 return; 769 return;
766 unsigned int color = 0xFF000000; 770 unsigned int color = 0xFF000000;
767 color |= web_layer_is_accelerated_ ? 0x0000FF00 : 0x00FF0000; 771 color |= web_layer_is_accelerated_ ? 0x0000FF00 : 0x00FF0000;
768 bool opaque = fills_bounds_opaquely_ && (GetCombinedOpacity() == 1.f); 772 bool opaque = fills_bounds_opaquely_ && (GetCombinedOpacity() == 1.f);
769 if (!opaque) 773 if (!opaque)
770 color |= 0xFF; 774 color |= 0xFF;
771 web_layer_.setDebugBorderColor(color); 775 web_layer_.setDebugBorderColor(color);
772 } 776 }
773 777
774 } // namespace ui 778 } // 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