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

Unified Diff: chrome/browser/android/compositor/layer/content_layer.cc

Issue 1083203002: Stop incorrectly caching brightness values (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Retain FilterOperations to reduce frequency of allocations. Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/android/compositor/layer/content_layer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/compositor/layer/content_layer.cc
diff --git a/chrome/browser/android/compositor/layer/content_layer.cc b/chrome/browser/android/compositor/layer/content_layer.cc
index 3db8a184c8b07400a0e667e51ade1d141382c52c..016c7f1db349eb6d8008054409ecc104e8c1f34a 100644
--- a/chrome/browser/android/compositor/layer/content_layer.cc
+++ b/chrome/browser/android/compositor/layer/content_layer.cc
@@ -131,26 +131,22 @@ void ContentLayer::SetProperties(int id,
// Only worry about saturation on the static layer.
if (static_layer.get()) {
- if (saturation != saturation_) {
- saturation_ = saturation;
- cc::FilterOperations filters;
- if (saturation_ < 1.0f)
- filters.Append(cc::FilterOperation::CreateSaturateFilter(saturation_));
- static_layer->layer()->SetFilters(filters);
+ static_filter_operations_.Clear();
+ if (saturation < 1.0f) {
+ static_filter_operations_.Append(
+ cc::FilterOperation::CreateSaturateFilter(saturation));
}
+ static_layer->layer()->SetFilters(static_filter_operations_);
}
// Only worry about brightness on the content layer.
if (content_layer.get()) {
- if (brightness != brightness_) {
- brightness_ = brightness;
- cc::FilterOperations filters;
- if (brightness_ < 1.f) {
- filters.Append(
- cc::FilterOperation::CreateBrightnessFilter(brightness_));
- }
- content_layer->SetFilters(filters);
+ content_filter_operations_.Clear();
+ if (brightness < 1.0f) {
+ content_filter_operations_.Append(
+ cc::FilterOperation::CreateBrightnessFilter(brightness));
}
+ content_layer->SetFilters(content_filter_operations_);
}
}
@@ -168,8 +164,6 @@ ContentLayer::ContentLayer(TabContentManager* tab_content_manager)
: layer_(cc::Layer::Create()),
content_attached_(false),
static_attached_(false),
- saturation_(1.0f),
- brightness_(1.0f),
tab_content_manager_(tab_content_manager) {
}
@@ -226,7 +220,6 @@ void ContentLayer::SetStaticLayer(
}
static_layer_ = new_static_layer;
static_layer_->AddSelfToParentOrReplaceAt(layer_, content_attached_ ? 1 : 0);
- saturation_ = -1.0f;
static_layer_->layer()->SetIsDrawable(true);
static_attached_ = true;
}
« no previous file with comments | « chrome/browser/android/compositor/layer/content_layer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698