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

Unified Diff: cc/output/filter_operations.cc

Issue 64123005: Update filter blending to match spec draft. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/output/filter_operations.h ('k') | cc/output/filter_operations_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/filter_operations.cc
diff --git a/cc/output/filter_operations.cc b/cc/output/filter_operations.cc
index 92ddd684777ef9e71fab6cbd1a3805a0f0db3dd9..21d222e94bfca12b5396679e01334338e22dabe8 100644
--- a/cc/output/filter_operations.cc
+++ b/cc/output/filter_operations.cc
@@ -154,34 +154,43 @@ bool FilterOperations::HasReferenceFilter() const {
FilterOperations FilterOperations::Blend(const FilterOperations& from,
double progress) const {
- FilterOperations blended_filters;
- if (from.size() == 0) {
- for (size_t i = 0; i < size(); i++)
- blended_filters.Append(FilterOperation::Blend(NULL, &at(i), progress));
- return blended_filters;
- }
+ if (HasReferenceFilter() || from.HasReferenceFilter())
+ return *this;
- if (size() == 0) {
- for (size_t i = 0; i < from.size(); i++) {
- blended_filters.Append(
- FilterOperation::Blend(&from.at(i), NULL, progress));
- }
- return blended_filters;
+ bool from_is_longer = from.size() > size();
+
+ size_t shorter_size, longer_size;
+ if (size() == from.size()) {
+ shorter_size = longer_size = size();
+ } else if (from_is_longer) {
+ longer_size = from.size();
+ shorter_size = size();
+ } else {
+ longer_size = size();
+ shorter_size = from.size();
}
- if (from.size() != size())
- return *this;
-
- for (size_t i = 0; i < size(); i++) {
+ for (size_t i = 0; i < shorter_size; i++) {
if (from.at(i).type() != at(i).type())
return *this;
}
- for (size_t i = 0; i < size(); i++) {
+ FilterOperations blended_filters;
+ for (size_t i = 0; i < shorter_size; i++) {
blended_filters.Append(
FilterOperation::Blend(&from.at(i), &at(i), progress));
}
+ if (from_is_longer) {
+ for (size_t i = shorter_size; i < longer_size; i++) {
+ blended_filters.Append(
+ FilterOperation::Blend(&from.at(i), NULL, progress));
+ }
+ } else {
+ for (size_t i = shorter_size; i < longer_size; i++)
+ blended_filters.Append(FilterOperation::Blend(NULL, &at(i), progress));
+ }
+
return blended_filters;
}
« no previous file with comments | « cc/output/filter_operations.h ('k') | cc/output/filter_operations_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698