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

Unified Diff: cc/layers/heads_up_display_layer_impl.cc

Issue 1829093002: Use sk_sp-based APIs for SkColorFilter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Respond to reviews Created 4 years, 9 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/layers/heads_up_display_layer_impl.cc
diff --git a/cc/layers/heads_up_display_layer_impl.cc b/cc/layers/heads_up_display_layer_impl.cc
index c5dc2eac158d6ad3d3d26f839af2d8db1f6c6d9e..c2f8a1b543ca3dc4e163fad5777e2c7c25c042ae 100644
--- a/cc/layers/heads_up_display_layer_impl.cc
+++ b/cc/layers/heads_up_display_layer_impl.cc
@@ -40,17 +40,16 @@ static inline SkPaint CreatePaint() {
#if (SK_R32_SHIFT || SK_B32_SHIFT != 16)
// The SkCanvas is in RGBA but the shader is expecting BGRA, so we need to
// swizzle our colors when drawing to the SkCanvas.
- SkColorMatrix swizzle_matrix;
+ SkScalar color_matrix[20];
for (int i = 0; i < 20; ++i)
- swizzle_matrix.fMat[i] = 0;
- swizzle_matrix.fMat[0 + 5 * 2] = 1;
- swizzle_matrix.fMat[1 + 5 * 1] = 1;
- swizzle_matrix.fMat[2 + 5 * 0] = 1;
- swizzle_matrix.fMat[3 + 5 * 3] = 1;
-
- skia::RefPtr<SkColorFilter> filter =
- skia::AdoptRef(SkColorMatrixFilter::Create(swizzle_matrix));
- paint.setColorFilter(filter.get());
+ color_matrix[i] = 0;
+ color_matrix[0 + 5 * 2] = 1;
+ color_matrix[1 + 5 * 1] = 1;
+ color_matrix[2 + 5 * 0] = 1;
+ color_matrix[3 + 5 * 3] = 1;
+
+ paint.setColorFilter(
+ SkColorFilter::MakeMatrixFilterRowMajor255(color_matrix));
#endif
return paint;
}

Powered by Google App Engine
This is Rietveld 408576698