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

Unified Diff: cc/output/filter_operation.cc

Issue 16968002: Move implementation of WebFilterOperations into cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 | « cc/output/filter_operation.h ('k') | cc/output/filter_operations.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..c3a76dce80dcad14c75e020840ff4d8015e40e20
--- /dev/null
+++ b/cc/output/filter_operation.cc
@@ -0,0 +1,66 @@
+// 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_ == COLOR_MATRIX)
+ return !memcmp(matrix_, other.matrix_, sizeof(matrix_));
+ if (type_ == DROP_SHADOW) {
+ 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_NE(type_, DROP_SHADOW);
+ DCHECK_NE(type_, COLOR_MATRIX);
+ 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_EQ(type_, DROP_SHADOW);
+ 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_EQ(type_, COLOR_MATRIX);
+ 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_EQ(type_, ZOOM);
+ memset(matrix_, 0, sizeof(matrix_));
+}
+
+} // namespace cc
« no previous file with comments | « cc/output/filter_operation.h ('k') | cc/output/filter_operations.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698