summaryrefslogtreecommitdiffstats
path: root/cc/output/filter_operation.cc
diff options
context:
space:
mode:
authorajuma@chromium.org <ajuma@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-25 18:49:29 +0000
committerajuma@chromium.org <ajuma@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-25 18:49:29 +0000
commitae6b1a7f60846352cc37858778d30886970f1582 (patch)
tree63f3db7cd40160fc2f978ccb1c86f36f589a8a13 /cc/output/filter_operation.cc
parent5e2c4d7c13baad8a246dd1f200636235f07b38d7 (diff)
downloadchromium_src-ae6b1a7f60846352cc37858778d30886970f1582.zip
chromium_src-ae6b1a7f60846352cc37858778d30886970f1582.tar.gz
chromium_src-ae6b1a7f60846352cc37858778d30886970f1582.tar.bz2
Move implementation of WebFilterOperations into cc
This moves the implementation of WebFilterOperations into cc, and (behind an #ifdef) defines a WebFilterOperationsImpl class that implements the WebFilterOperations interface by wrapping a cc::FilterOperations. With this change, cc and ui/compositor no longer need to include WebFilterOperations.h. BUG=181613 Review URL: https://chromiumcodereview.appspot.com/16968002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@208531 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/output/filter_operation.cc')
-rw-r--r--cc/output/filter_operation.cc66
1 files changed, 66 insertions, 0 deletions
diff --git a/cc/output/filter_operation.cc b/cc/output/filter_operation.cc
new file mode 100644
index 0000000..c3a76dc
--- /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