 Chromium Code Reviews
 Chromium Code Reviews Issue 16968002:
  Move implementation of WebFilterOperations into cc  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 16968002:
  Move implementation of WebFilterOperations into cc  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| Index: cc/output/filter_operation.cc | 
| diff --git a/cc/output/filter_operation.cc b/cc/output/filter_operation.cc | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..ecc4184eb5d233f87a3dc1f7d1f4a055dc0b0115 | 
| --- /dev/null | 
| +++ b/cc/output/filter_operation.cc | 
| @@ -0,0 +1,65 @@ | 
| +// Copyright 2013 The Chromium Authors. All rights reserved. | 
| +// Use of this source code is governed by a BSD-style license that can be | 
| +// found in the LICENSE file. | 
| + | 
| +#include "cc/output/filter_operation.h" | 
| + | 
| +namespace cc { | 
| + | 
| +bool FilterOperation::operator==(const FilterOperation& other) const { | 
| + if (type_ != other.type_) | 
| + return false; | 
| + if (type_ == FilterTypeColorMatrix) | 
| + return !memcmp(matrix_, other.matrix_, sizeof(matrix_)); | 
| + if (type_ == FilterTypeDropShadow) { | 
| + return amount_ == other.amount_ && | 
| + drop_shadow_offset_ == other.drop_shadow_offset_ && | 
| + drop_shadow_color_ == other.drop_shadow_color_; | 
| + } | 
| + return amount_ == other.amount_; | 
| +} | 
| + | 
| +FilterOperation::FilterOperation(FilterType type, float amount) | 
| + : type_(type), | 
| + amount_(amount), | 
| + drop_shadow_offset_(0, 0), | 
| + drop_shadow_color_(0), | 
| + zoom_inset_(0) { | 
| + DCHECK(type_ != FilterTypeDropShadow && type_ != FilterTypeColorMatrix); | 
| 
jamesr
2013/06/18 23:08:52
would be better as two checks using DCHECK_NE
 
ajuma
2013/06/19 17:08:30
Done.
 | 
| + memset(matrix_, 0, sizeof(matrix_)); | 
| +} | 
| + | 
| +FilterOperation::FilterOperation(FilterType type, | 
| + gfx::Point offset, | 
| + float stdDeviation, | 
| + SkColor color) | 
| + : type_(type), | 
| + amount_(stdDeviation), | 
| + drop_shadow_offset_(offset), | 
| + drop_shadow_color_(color), | 
| + zoom_inset_(0) { | 
| + DCHECK(type_ == FilterTypeDropShadow); | 
| + memset(matrix_, 0, sizeof(matrix_)); | 
| +} | 
| + | 
| +FilterOperation::FilterOperation(FilterType type, SkScalar matrix[20]) | 
| + : type_(type), | 
| + amount_(0), | 
| + drop_shadow_offset_(0, 0), | 
| + drop_shadow_color_(0), | 
| + zoom_inset_(0) { | 
| + DCHECK(type_ == FilterTypeColorMatrix); | 
| + memcpy(matrix_, matrix, sizeof(matrix_)); | 
| +} | 
| + | 
| +FilterOperation::FilterOperation(FilterType type, float amount, int inset) | 
| + : type_(type), | 
| + amount_(amount), | 
| + drop_shadow_offset_(0, 0), | 
| + drop_shadow_color_(0), | 
| + zoom_inset_(inset) { | 
| + DCHECK(type_ == FilterTypeZoom); | 
| + memset(matrix_, 0, sizeof(matrix_)); | 
| +} | 
| + | 
| +} // namespace cc |