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

Unified Diff: cc/output/filter_operation.cc

Issue 20667002: cc: Add frame data to LTHI tracing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 4 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
index de59cfc1c0d4102290177bfa820f588c970eaad2..6a778388ae5162ebe7a2ae6298414ff698ba7662 100644
--- a/cc/output/filter_operation.cc
+++ b/cc/output/filter_operation.cc
@@ -4,6 +4,7 @@
#include <algorithm>
+#include "base/values.h"
#include "cc/base/math_util.h"
#include "cc/output/filter_operation.h"
#include "third_party/skia/include/core/SkMath.h"
@@ -217,4 +218,40 @@ FilterOperation FilterOperation::Blend(const FilterOperation* from,
return blended_filter;
}
+scoped_ptr<base::Value> FilterOperation::AsValue() const {
+ scoped_ptr<base::DictionaryValue> value(new DictionaryValue);
+ value->SetInteger("type", type_);
+ switch (type_) {
+ case FilterOperation::GRAYSCALE:
+ case FilterOperation::SEPIA:
+ case FilterOperation::SATURATE:
+ case FilterOperation::HUE_ROTATE:
+ case FilterOperation::INVERT:
+ case FilterOperation::BRIGHTNESS:
+ case FilterOperation::CONTRAST:
+ case FilterOperation::OPACITY:
+ case FilterOperation::BLUR:
+ case FilterOperation::SATURATING_BRIGHTNESS:
+ value->SetDouble("amount", amount_);
+ break;
+ case FilterOperation::DROP_SHADOW:
+ value->SetDouble("std_deviation", amount_);
+ value->Set("offset", MathUtil::AsValue(drop_shadow_offset_).release());
+ value->SetInteger("color", drop_shadow_color_);
+ break;
+ case FilterOperation::COLOR_MATRIX: {
+ scoped_ptr<ListValue> matrix(new ListValue);
+ for (size_t i = 0; i < arraysize(matrix_); ++i)
+ matrix->AppendDouble(matrix_[i]);
+ value->Set("matrix", matrix.release());
+ break;
+ }
+ case FilterOperation::ZOOM:
+ value->SetDouble("amount", amount_);
+ value->SetDouble("inset", zoom_inset_);
+ break;
+ }
+ return value.PassAs<base::Value>();
+}
+
} // 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