| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "cc/output/filter_operation.h" |
| 6 |
| 7 namespace cc { |
| 8 |
| 9 bool FilterOperation::operator==(const FilterOperation& other) const { |
| 10 if (type_ != other.type_) |
| 11 return false; |
| 12 if (type_ == COLOR_MATRIX) |
| 13 return !memcmp(matrix_, other.matrix_, sizeof(matrix_)); |
| 14 if (type_ == DROP_SHADOW) { |
| 15 return amount_ == other.amount_ && |
| 16 drop_shadow_offset_ == other.drop_shadow_offset_ && |
| 17 drop_shadow_color_ == other.drop_shadow_color_; |
| 18 } |
| 19 return amount_ == other.amount_; |
| 20 } |
| 21 |
| 22 FilterOperation::FilterOperation(FilterType type, float amount) |
| 23 : type_(type), |
| 24 amount_(amount), |
| 25 drop_shadow_offset_(0, 0), |
| 26 drop_shadow_color_(0), |
| 27 zoom_inset_(0) { |
| 28 DCHECK_NE(type_, DROP_SHADOW); |
| 29 DCHECK_NE(type_, COLOR_MATRIX); |
| 30 memset(matrix_, 0, sizeof(matrix_)); |
| 31 } |
| 32 |
| 33 FilterOperation::FilterOperation(FilterType type, |
| 34 gfx::Point offset, |
| 35 float stdDeviation, |
| 36 SkColor color) |
| 37 : type_(type), |
| 38 amount_(stdDeviation), |
| 39 drop_shadow_offset_(offset), |
| 40 drop_shadow_color_(color), |
| 41 zoom_inset_(0) { |
| 42 DCHECK_EQ(type_, DROP_SHADOW); |
| 43 memset(matrix_, 0, sizeof(matrix_)); |
| 44 } |
| 45 |
| 46 FilterOperation::FilterOperation(FilterType type, SkScalar matrix[20]) |
| 47 : type_(type), |
| 48 amount_(0), |
| 49 drop_shadow_offset_(0, 0), |
| 50 drop_shadow_color_(0), |
| 51 zoom_inset_(0) { |
| 52 DCHECK_EQ(type_, COLOR_MATRIX); |
| 53 memcpy(matrix_, matrix, sizeof(matrix_)); |
| 54 } |
| 55 |
| 56 FilterOperation::FilterOperation(FilterType type, float amount, int inset) |
| 57 : type_(type), |
| 58 amount_(amount), |
| 59 drop_shadow_offset_(0, 0), |
| 60 drop_shadow_color_(0), |
| 61 zoom_inset_(inset) { |
| 62 DCHECK_EQ(type_, ZOOM); |
| 63 memset(matrix_, 0, sizeof(matrix_)); |
| 64 } |
| 65 |
| 66 } // namespace cc |
| OLD | NEW |