Commit ce39bc79 authored by piman@chromium.org's avatar piman@chromium.org

aura: apply brightness filter last to improve perf

https://bugs.webkit.org/show_bug.cgi?id=92059 adds an optimization on color
matrix filters so that they can be combined in a single pass as long as the
resulting colors don't need to be clamped. Brightness needs clamping, so it
should go last.

This also fixes an uninitialized value that made us stick a grayscale filter randomly on layers.

BUG=138645
TEST=new startup animation


Review URL: https://chromiumcodereview.appspot.com/10833027

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148837 0039d316-1c4b-4281-b951-d872f2087c98
parent af34e86b
...@@ -78,6 +78,7 @@ Layer::Layer(LayerType type) ...@@ -78,6 +78,7 @@ Layer::Layer(LayerType type)
background_blur_radius_(0), background_blur_radius_(0),
layer_saturation_(0.0f), layer_saturation_(0.0f),
layer_brightness_(0.0f), layer_brightness_(0.0f),
layer_grayscale_(0.0f),
layer_inverted_(false), layer_inverted_(false),
layer_mask_(NULL), layer_mask_(NULL),
layer_mask_back_link_(NULL), layer_mask_back_link_(NULL),
...@@ -288,16 +289,19 @@ void Layer::SetLayerFilters() { ...@@ -288,16 +289,19 @@ void Layer::SetLayerFilters() {
filters.append(WebKit::WebFilterOperation::createSaturateFilter( filters.append(WebKit::WebFilterOperation::createSaturateFilter(
layer_saturation_)); layer_saturation_));
} }
if (layer_brightness_) {
filters.append(WebKit::WebFilterOperation::createBrightnessFilter(
layer_brightness_));
}
if (layer_grayscale_) { if (layer_grayscale_) {
filters.append(WebKit::WebFilterOperation::createGrayscaleFilter( filters.append(WebKit::WebFilterOperation::createGrayscaleFilter(
layer_grayscale_)); layer_grayscale_));
} }
if (layer_inverted_) if (layer_inverted_)
filters.append(WebKit::WebFilterOperation::createInvertFilter(1.0)); filters.append(WebKit::WebFilterOperation::createInvertFilter(1.0));
// Brightness goes last, because the resulting colors neeed clamping, which
// cause further color matrix filters to be applied separately. In this order,
// they all can be combined in a single pass.
if (layer_brightness_) {
filters.append(WebKit::WebFilterOperation::createBrightnessFilter(
layer_brightness_));
}
web_layer_.setFilters(filters); web_layer_.setFilters(filters);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment