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

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: Fix cc_messages Created 7 years, 3 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
Index: cc/output/filter_operation.h
diff --git a/cc/output/filter_operation.h b/cc/output/filter_operation.h
index f56176213b14081081361bfc546b544df885eb0d..ac94797d8ed26b9be9ec66c725405a717616d0f3 100644
--- a/cc/output/filter_operation.h
+++ b/cc/output/filter_operation.h
@@ -8,7 +8,9 @@
#include "base/logging.h"
#include "base/memory/scoped_ptr.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"
@@ -33,13 +35,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_;
}
@@ -53,6 +61,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_;
@@ -113,6 +126,11 @@ class CC_EXPORT FilterOperation {
return FilterOperation(ZOOM, amount, inset);
}
+ static FilterOperation CreateReferenceFilter(
+ const skia::RefPtr<SkImageFilter> image_filter) {
danakj 2013/09/09 22:04:50 did you mean const& ?
ajuma 2013/09/10 21:17:58 Done.
+ return FilterOperation(REFERENCE, image_filter);
+ }
+
static FilterOperation CreateSaturatingBrightnessFilter(float amount) {
return FilterOperation(SATURATING_BRIGHTNESS, amount);
}
@@ -132,6 +150,7 @@ class CC_EXPORT FilterOperation {
void set_amount(float amount) {
DCHECK_NE(type_, COLOR_MATRIX);
+ DCHECK_NE(type_, REFERENCE);
amount_ = amount;
}
@@ -145,6 +164,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)
@@ -180,10 +204,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_;
};

Powered by Google App Engine
This is Rietveld 408576698