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

Unified Diff: cc/output/filter_operations.cc

Issue 21154002: Add support for converting cc::FilterOperations into an SkImageFilter (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased 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
« no previous file with comments | « cc/output/filter_operations.h ('k') | cc/output/filter_operations_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/filter_operations.cc
diff --git a/cc/output/filter_operations.cc b/cc/output/filter_operations.cc
index e526f5c419bed3ae53cbab223109f19c85ec385b..92ddd684777ef9e71fab6cbd1a3805a0f0db3dd9 100644
--- a/cc/output/filter_operations.cc
+++ b/cc/output/filter_operations.cc
@@ -59,7 +59,10 @@ void FilterOperations::GetOutsets(int* top,
int* left) const {
*top = *right = *bottom = *left = 0;
for (size_t i = 0; i < operations_.size(); ++i) {
- const FilterOperation op = operations_[i];
+ const FilterOperation& op = operations_[i];
+ // TODO(ajuma): Add support for reference filters once SkImageFilter
+ // reports its outsets.
+ DCHECK(op.type() != FilterOperation::REFERENCE);
if (op.type() == FilterOperation::BLUR ||
op.type() == FilterOperation::DROP_SHADOW) {
int spread = SpreadForStdDeviation(op.amount());
@@ -80,11 +83,14 @@ void FilterOperations::GetOutsets(int* top,
bool FilterOperations::HasFilterThatMovesPixels() const {
for (size_t i = 0; i < operations_.size(); ++i) {
- const FilterOperation op = operations_[i];
+ const FilterOperation& op = operations_[i];
+ // TODO(ajuma): Once SkImageFilter reports its outsets, use those here to
+ // determine whether a reference filter really moves pixels.
switch (op.type()) {
case FilterOperation::BLUR:
case FilterOperation::DROP_SHADOW:
case FilterOperation::ZOOM:
+ case FilterOperation::REFERENCE:
return true;
case FilterOperation::OPACITY:
case FilterOperation::COLOR_MATRIX:
@@ -104,12 +110,15 @@ bool FilterOperations::HasFilterThatMovesPixels() const {
bool FilterOperations::HasFilterThatAffectsOpacity() const {
for (size_t i = 0; i < operations_.size(); ++i) {
- const FilterOperation op = operations_[i];
+ const FilterOperation& op = operations_[i];
+ // TODO(ajuma): Make this smarter for reference filters. Once SkImageFilter
+ // can report affectsOpacity(), call that.
switch (op.type()) {
case FilterOperation::OPACITY:
case FilterOperation::BLUR:
case FilterOperation::DROP_SHADOW:
case FilterOperation::ZOOM:
+ case FilterOperation::REFERENCE:
return true;
case FilterOperation::COLOR_MATRIX: {
const SkScalar* matrix = op.matrix();
@@ -135,6 +144,14 @@ bool FilterOperations::HasFilterThatAffectsOpacity() const {
return false;
}
+bool FilterOperations::HasReferenceFilter() const {
+ for (size_t i = 0; i < operations_.size(); ++i) {
+ if (operations_[i].type() == FilterOperation::REFERENCE)
+ return true;
+ }
+ return false;
+}
+
FilterOperations FilterOperations::Blend(const FilterOperations& from,
double progress) const {
FilterOperations blended_filters;
« no previous file with comments | « cc/output/filter_operations.h ('k') | cc/output/filter_operations_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698