OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "SkColorFilter.h" | 8 #include "SkColorFilter.h" |
9 #include "SkHalf.h" | 9 #include "SkHalf.h" |
10 #include "SkNx.h" | 10 #include "SkNx.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 swizzle_rb_if_bgra(Sk4f_fromS32(addr[i])).store(span[i].fVec); | 35 swizzle_rb_if_bgra(Sk4f_fromS32(addr[i])).store(span[i].fVec); |
36 } | 36 } |
37 } | 37 } |
38 | 38 |
39 static void load_f16(const SkPixmap& src, int x, int y, SkPM4f span[], int count
) { | 39 static void load_f16(const SkPixmap& src, int x, int y, SkPM4f span[], int count
) { |
40 SkASSERT(count > 0); | 40 SkASSERT(count > 0); |
41 const uint64_t* addr = src.addr64(x, y); | 41 const uint64_t* addr = src.addr64(x, y); |
42 SkASSERT(src.addr64(x + count - 1, y)); | 42 SkASSERT(src.addr64(x + count - 1, y)); |
43 | 43 |
44 for (int i = 0; i < count; ++i) { | 44 for (int i = 0; i < count; ++i) { |
45 SkHalfToFloat_finite(addr[i]).store(span[i].fVec); | 45 SkHalfToFloat_finite_ftz(addr[i]).store(span[i].fVec); |
46 } | 46 } |
47 } | 47 } |
48 | 48 |
49 SkLoadSpanProc SkLoadSpanProc_Choose(const SkImageInfo& info) { | 49 SkLoadSpanProc SkLoadSpanProc_Choose(const SkImageInfo& info) { |
50 switch (info.colorType()) { | 50 switch (info.colorType()) { |
51 case kN32_SkColorType: | 51 case kN32_SkColorType: |
52 return info.gammaCloseToSRGB() ? load_s32 : load_l32; | 52 return info.gammaCloseToSRGB() ? load_s32 : load_l32; |
53 case kRGBA_F16_SkColorType: | 53 case kRGBA_F16_SkColorType: |
54 return load_f16; | 54 return load_f16; |
55 default: | 55 default: |
(...skipping 30 matching lines...) Expand all Loading... |
86 paint.getColorFilter()->filterSpan4f(span, count, span); | 86 paint.getColorFilter()->filterSpan4f(span, count, span); |
87 } | 87 } |
88 | 88 |
89 SkFilterSpanProc SkFilterSpanProc_Choose(const SkPaint& paint) { | 89 SkFilterSpanProc SkFilterSpanProc_Choose(const SkPaint& paint) { |
90 if (paint.getColorFilter()) { | 90 if (paint.getColorFilter()) { |
91 return 0xFF == paint.getAlpha() ? colorfilter_filterspan : colorfilter_a
lpha_filterspan; | 91 return 0xFF == paint.getAlpha() ? colorfilter_filterspan : colorfilter_a
lpha_filterspan; |
92 } else { | 92 } else { |
93 return 0xFF == paint.getAlpha() ? noop_filterspan : alpha_filterspan; | 93 return 0xFF == paint.getAlpha() ? noop_filterspan : alpha_filterspan; |
94 } | 94 } |
95 } | 95 } |
OLD | NEW |