| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkColorMatrixFilterRowMajor255.h" | 8 #include "SkColorMatrixFilterRowMajor255.h" |
| 9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
| 10 #include "SkNx.h" | 10 #include "SkNx.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 enum { | 119 enum { |
| 120 R = SK_R_INDEX, | 120 R = SK_R_INDEX, |
| 121 G = SK_G_INDEX, | 121 G = SK_G_INDEX, |
| 122 B = SK_B_INDEX, | 122 B = SK_B_INDEX, |
| 123 A = SK_A_INDEX, | 123 A = SK_A_INDEX, |
| 124 }; | 124 }; |
| 125 static SkPMColor From4f(const Sk4f& c4) { | 125 static SkPMColor From4f(const Sk4f& c4) { |
| 126 return round(swizzle_rb_if_bgra(c4)); | 126 return round(swizzle_rb_if_bgra(c4)); |
| 127 } | 127 } |
| 128 static Sk4f To4f(SkPMColor c) { | 128 static Sk4f To4f(SkPMColor c) { |
| 129 return to_4f(c) * Sk4f(1.0f/255); | 129 return Sk4f_fromL32(c); |
| 130 } | 130 } |
| 131 }; | 131 }; |
| 132 void SkColorMatrixFilterRowMajor255::filterSpan(const SkPMColor src[], int count
, SkPMColor dst[]) const { | 132 void SkColorMatrixFilterRowMajor255::filterSpan(const SkPMColor src[], int count
, SkPMColor dst[]) const { |
| 133 filter_span<SkPMColorAdaptor>(fTranspose, src, count, dst); | 133 filter_span<SkPMColorAdaptor>(fTranspose, src, count, dst); |
| 134 } | 134 } |
| 135 | 135 |
| 136 struct SkPM4fAdaptor { | 136 struct SkPM4fAdaptor { |
| 137 enum { | 137 enum { |
| 138 R = SkPM4f::R, | 138 R = SkPM4f::R, |
| 139 G = SkPM4f::G, | 139 G = SkPM4f::G, |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 SkColorMatrixFilterRowMajor255::MakeSingleChannelOutput(const SkScalar row[5]) { | 429 SkColorMatrixFilterRowMajor255::MakeSingleChannelOutput(const SkScalar row[5]) { |
| 430 SkASSERT(row); | 430 SkASSERT(row); |
| 431 auto cf = sk_make_sp<SkColorMatrixFilterRowMajor255>(); | 431 auto cf = sk_make_sp<SkColorMatrixFilterRowMajor255>(); |
| 432 static_assert(sizeof(SkScalar) * 5 * 4 == sizeof(cf->fMatrix), "sizes don't
match"); | 432 static_assert(sizeof(SkScalar) * 5 * 4 == sizeof(cf->fMatrix), "sizes don't
match"); |
| 433 for (int i = 0; i < 4; ++i) { | 433 for (int i = 0; i < 4; ++i) { |
| 434 memcpy(cf->fMatrix + 5 * i, row, sizeof(SkScalar) * 5); | 434 memcpy(cf->fMatrix + 5 * i, row, sizeof(SkScalar) * 5); |
| 435 } | 435 } |
| 436 cf->initState(); | 436 cf->initState(); |
| 437 return cf; | 437 return cf; |
| 438 } | 438 } |
| OLD | NEW |