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

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: Fix nit 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_operations.cc
diff --git a/cc/output/filter_operations.cc b/cc/output/filter_operations.cc
index e526f5c419bed3ae53cbab223109f19c85ec385b..34a4c184b17df78f9488fc840744e9a08ddca62b 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,15 @@ 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): Add support for reference filters once SkImageFilter
+ // reports its outsets.
+ DCHECK(op.type() != FilterOperation::REFERENCE);
enne (OOO) 2013/09/11 17:57:24 This is a little awkward to DCHECK here because it
danakj 2013/09/11 18:01:55 I'd agree if the damage tracker didn't use invalid
enne (OOO) 2013/09/11 18:06:33 So DCHECK in GetOutsets, but don't DCHECK here?
danakj 2013/09/11 18:18:17 Hm, ya okay. I hadn't considered that originally.
ajuma 2013/09/11 18:24:56 Done.
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 +111,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 +145,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;

Powered by Google App Engine
This is Rietveld 408576698