Index: cc/output/filter_operation.cc |
diff --git a/cc/output/filter_operation.cc b/cc/output/filter_operation.cc |
index de59cfc1c0d4102290177bfa820f588c970eaad2..27106fac0c679ef84f83be61fc6c9f28058ba2da 100644 |
--- a/cc/output/filter_operation.cc |
+++ b/cc/output/filter_operation.cc |
@@ -20,6 +20,8 @@ bool FilterOperation::operator==(const FilterOperation& other) const { |
drop_shadow_offset_ == other.drop_shadow_offset_ && |
drop_shadow_color_ == other.drop_shadow_color_; |
} |
+ if (type_ == REFERENCE) |
+ return image_filter_.get() == other.image_filter_.get(); |
return amount_ == other.amount_; |
} |
@@ -31,6 +33,7 @@ FilterOperation::FilterOperation(FilterType type, float amount) |
zoom_inset_(0) { |
DCHECK_NE(type_, DROP_SHADOW); |
DCHECK_NE(type_, COLOR_MATRIX); |
+ DCHECK_NE(type_, REFERENCE); |
memset(matrix_, 0, sizeof(matrix_)); |
} |
@@ -67,6 +70,33 @@ FilterOperation::FilterOperation(FilterType type, float amount, int inset) |
memset(matrix_, 0, sizeof(matrix_)); |
} |
+FilterOperation::FilterOperation( |
+ FilterType type, |
+ const skia::RefPtr<SkImageFilter>& image_filter) |
+ : type_(type), |
+ amount_(0), |
+ drop_shadow_offset_(0, 0), |
+ drop_shadow_color_(0), |
+ image_filter_(image_filter), |
+ zoom_inset_(0) { |
+ DCHECK_EQ(type_, REFERENCE); |
+ DCHECK(image_filter.get()); |
+ memset(matrix_, 0, sizeof(matrix_)); |
+} |
+ |
+FilterOperation::FilterOperation(const FilterOperation& other) |
+ : type_(other.type_), |
+ amount_(other.amount_), |
+ drop_shadow_offset_(other.drop_shadow_offset_), |
+ drop_shadow_color_(other.drop_shadow_color_), |
+ image_filter_(other.image_filter_), |
+ zoom_inset_(other.zoom_inset_) { |
+ memcpy(matrix_, other.matrix_, sizeof(matrix_)); |
+} |
+ |
+FilterOperation::~FilterOperation() { |
+} |
+ |
// TODO(ajuma): Define a version of ui::Tween::ValueBetween for floats, and use |
// that instead. |
static float BlendFloats(float from, float to, double progress) { |
@@ -146,6 +176,7 @@ static FilterOperation CreateNoOpFilter(FilterOperation::FilterType type) { |
return FilterOperation::CreateZoomFilter(1.f, 0); |
case FilterOperation::SATURATING_BRIGHTNESS: |
return FilterOperation::CreateSaturatingBrightnessFilter(0.f); |
+ case FilterOperation::REFERENCE: |
default: |
NOTREACHED(); |
return FilterOperation::CreateEmptyFilter(); |
@@ -172,6 +203,7 @@ static float ClampAmountForFilterType(float amount, |
case FilterOperation::SATURATING_BRIGHTNESS: |
return amount; |
case FilterOperation::COLOR_MATRIX: |
+ case FilterOperation::REFERENCE: |
default: |
NOTREACHED(); |
return amount; |
@@ -187,6 +219,14 @@ FilterOperation FilterOperation::Blend(const FilterOperation* from, |
if (!from && !to) |
return blended_filter; |
+ if ((from && from->type() == FilterOperation::REFERENCE) || |
+ (to && to->type() == FilterOperation::REFERENCE)) { |
+ if (progress > 0.5) |
Stephen White
2013/07/31 19:18:51
Heh.. I guess it's better than nothing! :)
|
+ return to ? *to : blended_filter; |
+ else |
+ return from ? *from : blended_filter; |
+ } |
+ |
const FilterOperation& from_op = from ? *from : CreateNoOpFilter(to->type()); |
const FilterOperation& to_op = to ? *to : CreateNoOpFilter(from->type()); |