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

Side by Side Diff: src/opts/SkPMFloat_neon.h

Issue 1295873004: SkColorCubeFilter: require alpha == 0xFF. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: just perf Created 5 years, 4 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 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 namespace { // See SkPMFloat.h 8 namespace { // See SkPMFloat.h
9 9
10 static_assert(SK_A32_SHIFT == 24, "This file assumes little-endian."); 10 static_assert(SK_A32_SHIFT == 24, "This file assumes little-endian.");
(...skipping 15 matching lines...) Expand all
26 uint8x8_t fix8 = vqmovn_u16(vcombine_u16(fix8_16, vdup_n_u16(0))); 26 uint8x8_t fix8 = vqmovn_u16(vcombine_u16(fix8_16, vdup_n_u16(0)));
27 SkPMColor c = vget_lane_u32((uint32x2_t)fix8, 0); 27 SkPMColor c = vget_lane_u32((uint32x2_t)fix8, 0);
28 SkPMColorAssert(c); 28 SkPMColorAssert(c);
29 return c; 29 return c;
30 } 30 }
31 31
32 inline Sk4f SkPMFloat::alphas() const { 32 inline Sk4f SkPMFloat::alphas() const {
33 return vdupq_lane_f32(vget_high_f32(fVec), 1); // Duplicate high lane of hi gh half i.e. lane 3. 33 return vdupq_lane_f32(vget_high_f32(fVec), 1); // Duplicate high lane of hi gh half i.e. lane 3.
34 } 34 }
35 35
36 inline SkPMFloat SkPMFloat::FromBGRx(SkColor c) { 36 inline SkPMFloat SkPMFloat::FromOpaqueColor(SkColor c) {
37 SkASSERT(SkColorGetA(c) == 0xFF);
37 uint8x8_t fix8 = (uint8x8_t)vdup_n_u32(c); 38 uint8x8_t fix8 = (uint8x8_t)vdup_n_u32(c);
38 #if defined(SK_PMCOLOR_IS_RGBA) 39 #if defined(SK_PMCOLOR_IS_RGBA)
39 fix8 = vtbl1_u8(fix8, vcreate_u8(0x0300010203000102ULL)); // 03 00 01 02, 2 x, i.e. swap R&B. 40 fix8 = vtbl1_u8(fix8, vcreate_u8(0x0300010203000102ULL)); // 03 00 01 02, 2 x, i.e. swap R&B.
40 #endif 41 #endif
41 uint16x8_t fix8_16 = vmovl_u8(fix8); 42 uint16x8_t fix8_16 = vmovl_u8(fix8);
42 uint32x4_t fix8_32 = vmovl_u16(vget_low_u16(fix8_16)); 43 uint32x4_t fix8_32 = vmovl_u16(vget_low_u16(fix8_16));
43 fix8_32 = vsetq_lane_u32(0xFF, fix8_32, 3); // Force alpha to 1.
44 44
45 SkPMFloat pmf = Sk4f(vmulq_f32(vcvtq_f32_u32(fix8_32), vdupq_n_f32(1.0f/255) )); 45 SkPMFloat pmf = Sk4f(vmulq_f32(vcvtq_f32_u32(fix8_32), vdupq_n_f32(1.0f/255) ));
46 SkASSERT(pmf.isValid()); 46 SkASSERT(pmf.isValid());
47 return pmf; 47 return pmf;
48 } 48 }
49 49
50 } // namespace 50 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698