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 "SkBlitter.h" | 8 #include "SkBlitter.h" |
9 #include "SkColor.h" | 9 #include "SkColor.h" |
10 #include "SkColorFilter.h" | 10 #include "SkColorFilter.h" |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 *ptr = to_565(r,g,b)[0]; | 189 *ptr = to_565(r,g,b)[0]; |
190 } | 190 } |
191 | 191 |
192 // Load 4 F16 pixels. | 192 // Load 4 F16 pixels. |
193 SK_RASTER_STAGE(load_d_f16) { | 193 SK_RASTER_STAGE(load_d_f16) { |
194 auto ptr = (const uint64_t*)ctx + x; | 194 auto ptr = (const uint64_t*)ctx + x; |
195 | 195 |
196 Sk4h rh, gh, bh, ah; | 196 Sk4h rh, gh, bh, ah; |
197 Sk4h_load4(ptr, &rh, &gh, &bh, &ah); | 197 Sk4h_load4(ptr, &rh, &gh, &bh, &ah); |
198 | 198 |
199 dr = SkHalfToFloat_finite(rh); | 199 dr = SkHalfToFloat_finite_ftz(rh); |
200 dg = SkHalfToFloat_finite(gh); | 200 dg = SkHalfToFloat_finite_ftz(gh); |
201 db = SkHalfToFloat_finite(bh); | 201 db = SkHalfToFloat_finite_ftz(bh); |
202 da = SkHalfToFloat_finite(ah); | 202 da = SkHalfToFloat_finite_ftz(ah); |
203 } | 203 } |
204 | 204 |
205 // Load 1 F16 pixel. | 205 // Load 1 F16 pixel. |
206 SK_RASTER_STAGE(load_d_f16_1) { | 206 SK_RASTER_STAGE(load_d_f16_1) { |
207 auto ptr = (const uint64_t*)ctx + x; | 207 auto ptr = (const uint64_t*)ctx + x; |
208 | 208 |
209 auto p0 = SkHalfToFloat_finite(ptr[0]); | 209 auto p0 = SkHalfToFloat_finite_ftz(ptr[0]); |
210 dr = { p0[0],0,0,0 }; | 210 dr = { p0[0],0,0,0 }; |
211 dg = { p0[1],0,0,0 }; | 211 dg = { p0[1],0,0,0 }; |
212 db = { p0[2],0,0,0 }; | 212 db = { p0[2],0,0,0 }; |
213 da = { p0[3],0,0,0 }; | 213 da = { p0[3],0,0,0 }; |
214 } | 214 } |
215 | 215 |
216 // Store 4 F16 pixels. | 216 // Store 4 F16 pixels. |
217 SK_RASTER_STAGE(store_f16) { | 217 SK_RASTER_STAGE(store_f16) { |
218 auto ptr = (uint64_t*)ctx + x; | 218 auto ptr = (uint64_t*)ctx + x; |
219 | 219 |
220 Sk4h_store4(ptr, SkFloatToHalf_finite(r), SkFloatToHalf_finite(g), | 220 Sk4h_store4(ptr, SkFloatToHalf_finite_ftz(r), SkFloatToHalf_finite_ftz(g), |
221 SkFloatToHalf_finite(b), SkFloatToHalf_finite(a)); | 221 SkFloatToHalf_finite_ftz(b), SkFloatToHalf_finite_ftz(a)); |
222 } | 222 } |
223 | 223 |
224 // Store 1 F16 pixel. | 224 // Store 1 F16 pixel. |
225 SK_RASTER_STAGE(store_f16_1) { | 225 SK_RASTER_STAGE(store_f16_1) { |
226 auto ptr = (uint64_t*)ctx + x; | 226 auto ptr = (uint64_t*)ctx + x; |
227 | 227 |
228 SkFloatToHalf_finite({r[0], g[0], b[0], a[0]}).store(ptr); | 228 SkFloatToHalf_finite_ftz({r[0], g[0], b[0], a[0]}).store(ptr); |
229 } | 229 } |
230 | 230 |
231 // Load 4 8-bit sRGB pixels from SkPMColor order to RGBA. | 231 // Load 4 8-bit sRGB pixels from SkPMColor order to RGBA. |
232 SK_RASTER_STAGE(load_d_srgb) { | 232 SK_RASTER_STAGE(load_d_srgb) { |
233 auto ptr = (const uint32_t*)ctx + x; | 233 auto ptr = (const uint32_t*)ctx + x; |
234 | 234 |
235 dr = { sk_linear_from_srgb[(ptr[0] >> SK_R32_SHIFT) & 0xff], | 235 dr = { sk_linear_from_srgb[(ptr[0] >> SK_R32_SHIFT) & 0xff], |
236 sk_linear_from_srgb[(ptr[1] >> SK_R32_SHIFT) & 0xff], | 236 sk_linear_from_srgb[(ptr[1] >> SK_R32_SHIFT) & 0xff], |
237 sk_linear_from_srgb[(ptr[2] >> SK_R32_SHIFT) & 0xff], | 237 sk_linear_from_srgb[(ptr[2] >> SK_R32_SHIFT) & 0xff], |
238 sk_linear_from_srgb[(ptr[3] >> SK_R32_SHIFT) & 0xff] }; | 238 sk_linear_from_srgb[(ptr[3] >> SK_R32_SHIFT) & 0xff] }; |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 case SkMask::kLCD16_Format: | 431 case SkMask::kLCD16_Format: |
432 p.append<lerp_lcd16, lerp_lcd16_1>(mask.getAddrLCD16(x,y)-x); | 432 p.append<lerp_lcd16, lerp_lcd16_1>(mask.getAddrLCD16(x,y)-x); |
433 break; | 433 break; |
434 default: break; | 434 default: break; |
435 } | 435 } |
436 this->append_store(&p, dst); | 436 this->append_store(&p, dst); |
437 | 437 |
438 p.run(x, clip.width()); | 438 p.run(x, clip.width()); |
439 } | 439 } |
440 } | 440 } |
OLD | NEW |