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

Unified Diff: cc/render_surface_filters.cc

Issue 12033075: Switch back to the original brightness filter implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed temporary build crutches Created 7 years, 10 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/render_surface_filters_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/render_surface_filters.cc
diff --git a/cc/render_surface_filters.cc b/cc/render_surface_filters.cc
index ee72f6a6f4ee79e992bc97cc40e2067b2934e36b..29c031cf5089319674a448d383e8c2855e9e5dc0 100644
--- a/cc/render_surface_filters.cc
+++ b/cc/render_surface_filters.cc
@@ -23,15 +23,19 @@ namespace {
void getBrightnessMatrix(float amount, SkScalar matrix[20])
{
+ // Spec implementation
+ // (http://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html#brightnessEquivalent)
+ // <feFunc[R|G|B] type="linear" slope="[amount]">
+ memset(matrix, 0, 20 * sizeof(SkScalar));
+ matrix[0] = matrix[6] = matrix[12] = amount;
+ matrix[18] = 1;
+}
+
+void getSaturatingBrightnessMatrix(float amount, SkScalar matrix[20])
+{
+ // Legacy implementation used by internal clients.
+ // <feFunc[R|G|B] type="linear" intercept="[amount]"/>
memset(matrix, 0, 20 * sizeof(SkScalar));
- // Old implementation, a la the draft spec, a straight-up scale,
- // representing <feFunc[R|G|B] type="linear" slope="[amount]">
- // (See http://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html#brightnessEquivalent)
- // matrix[0] = matrix[6] = matrix[12] = amount;
- // matrix[18] = 1;
- // New implementation, a translation in color space, representing
- // <feFunc[R|G|B] type="linear" intercept="[amount]"/>
- // (See https://www.w3.org/Bugs/Public/show_bug.cgi?id=15647)
matrix[0] = matrix[6] = matrix[12] = matrix[18] = 1;
matrix[4] = matrix[9] = matrix[14] = amount * 255;
}
@@ -198,6 +202,10 @@ bool getColorMatrix(const WebKit::WebFilterOperation& op, SkScalar matrix[20])
getBrightnessMatrix(op.amount(), matrix);
return true;
}
+ case WebKit::WebFilterOperation::FilterTypeSaturatingBrightness: {
+ getSaturatingBrightnessMatrix(op.amount(), matrix);
+ return true;
+ }
case WebKit::WebFilterOperation::FilterTypeContrast: {
getContrastMatrix(op.amount(), matrix);
return true;
@@ -352,6 +360,7 @@ WebKit::WebFilterOperations RenderSurfaceFilters::optimize(const WebKit::WebFilt
newList.append(op);
break;
case WebKit::WebFilterOperation::FilterTypeBrightness:
+ case WebKit::WebFilterOperation::FilterTypeSaturatingBrightness:
case WebKit::WebFilterOperation::FilterTypeContrast:
case WebKit::WebFilterOperation::FilterTypeGrayscale:
case WebKit::WebFilterOperation::FilterTypeSepia:
@@ -360,7 +369,6 @@ WebKit::WebFilterOperations RenderSurfaceFilters::optimize(const WebKit::WebFilt
case WebKit::WebFilterOperation::FilterTypeInvert:
case WebKit::WebFilterOperation::FilterTypeOpacity:
case WebKit::WebFilterOperation::FilterTypeColorMatrix:
- default: // FIXME: temporary place holder to prevent build failures
break;
}
}
@@ -427,6 +435,7 @@ SkBitmap RenderSurfaceFilters::apply(const WebKit::WebFilterOperations& filters,
break;
}
case WebKit::WebFilterOperation::FilterTypeBrightness:
+ case WebKit::WebFilterOperation::FilterTypeSaturatingBrightness:
case WebKit::WebFilterOperation::FilterTypeContrast:
case WebKit::WebFilterOperation::FilterTypeGrayscale:
case WebKit::WebFilterOperation::FilterTypeSepia:
@@ -434,7 +443,6 @@ SkBitmap RenderSurfaceFilters::apply(const WebKit::WebFilterOperations& filters,
case WebKit::WebFilterOperation::FilterTypeHueRotate:
case WebKit::WebFilterOperation::FilterTypeInvert:
case WebKit::WebFilterOperation::FilterTypeOpacity:
- default: // FIXME: temporary place holder to prevent build failures
NOTREACHED();
break;
}
« no previous file with comments | « no previous file | cc/render_surface_filters_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698