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

Unified Diff: cc/output/filter_operation.h

Issue 21154002: Add support for converting cc::FilterOperations into an SkImageFilter (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 | « no previous file | cc/output/filter_operation.cc » ('j') | cc/output/filter_operation.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/filter_operation.h
diff --git a/cc/output/filter_operation.h b/cc/output/filter_operation.h
index ad25cf48f6cb43438590b1aeb18e5782ddb2ac44..3855f4ba8c89fd56263bf19fa94a6b3eebbd0cf3 100644
--- a/cc/output/filter_operation.h
+++ b/cc/output/filter_operation.h
@@ -7,7 +7,9 @@
#include "base/logging.h"
#include "cc/base/cc_export.h"
+#include "skia/ext/refptr.h"
#include "third_party/skia/include/core/SkColor.h"
+#include "third_party/skia/include/core/SkImageFilter.h"
#include "third_party/skia/include/core/SkScalar.h"
#include "ui/gfx/point.h"
@@ -28,13 +30,19 @@ class CC_EXPORT FilterOperation {
DROP_SHADOW,
COLOR_MATRIX,
ZOOM,
+ REFERENCE,
SATURATING_BRIGHTNESS, // Not used in CSS/SVG.
};
+ FilterOperation(const FilterOperation& other);
+
+ ~FilterOperation();
+
FilterType type() const { return type_; }
float amount() const {
DCHECK_NE(type_, COLOR_MATRIX);
+ DCHECK_NE(type_, REFERENCE);
return amount_;
}
@@ -48,6 +56,11 @@ class CC_EXPORT FilterOperation {
return drop_shadow_color_;
}
+ skia::RefPtr<SkImageFilter> image_filter() const {
+ DCHECK_EQ(type_, REFERENCE);
+ return image_filter_;
+ }
+
const SkScalar* matrix() const {
DCHECK_EQ(type_, COLOR_MATRIX);
return matrix_;
@@ -108,6 +121,11 @@ class CC_EXPORT FilterOperation {
return FilterOperation(ZOOM, amount, inset);
}
+ static FilterOperation CreateReferenceFilter(
+ const skia::RefPtr<SkImageFilter> image_filter) {
+ return FilterOperation(REFERENCE, image_filter);
+ }
+
static FilterOperation CreateSaturatingBrightnessFilter(float amount) {
return FilterOperation(SATURATING_BRIGHTNESS, amount);
}
@@ -127,6 +145,7 @@ class CC_EXPORT FilterOperation {
void set_amount(float amount) {
DCHECK_NE(type_, COLOR_MATRIX);
+ DCHECK_NE(type_, REFERENCE);
amount_ = amount;
}
@@ -140,6 +159,11 @@ class CC_EXPORT FilterOperation {
drop_shadow_color_ = color;
}
+ void set_image_filter(const skia::RefPtr<SkImageFilter>& image_filter) {
+ DCHECK_EQ(type_, REFERENCE);
+ image_filter_ = image_filter;
+ }
+
void set_matrix(const SkScalar matrix[20]) {
DCHECK_EQ(type_, COLOR_MATRIX);
for (unsigned i = 0; i < 20; ++i)
@@ -173,10 +197,14 @@ class CC_EXPORT FilterOperation {
FilterOperation(FilterType type, float amount, int inset);
+ FilterOperation(FilterType type,
+ const skia::RefPtr<SkImageFilter>& image_filter);
+
FilterType type_;
float amount_;
gfx::Point drop_shadow_offset_;
SkColor drop_shadow_color_;
+ skia::RefPtr<SkImageFilter> image_filter_;
SkScalar matrix_[20];
int zoom_inset_;
};
« no previous file with comments | « no previous file | cc/output/filter_operation.cc » ('j') | cc/output/filter_operation.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698