Flutter Engine
The Flutter Engine
Namespaces | Typedefs | Functions | Variables
SkSwizzlePriv.h File Reference
#include "include/private/SkColorData.h"
#include "src/base/SkVx.h"
#include <cstdint>

Go to the source code of this file.

Namespaces

namespace  SkOpts
 

Typedefs

using SkOpts::Swizzle_8888_u32 = void(*)(uint32_t *, const uint32_t *, int)
 
using SkOpts::Swizzle_8888_u8 = void(*)(uint32_t *, const uint8_t *, int)
 

Functions

void SkOpts::Init_Swizzler ()
 
static skvx::float4 swizzle_rb (const skvx::float4 &x)
 
static skvx::float4 swizzle_rb_if_bgra (const skvx::float4 &x)
 
static skvx::float4 Sk4f_fromL32 (uint32_t px)
 
static uint32_t Sk4f_toL32 (const skvx::float4 &px)
 

Variables

Swizzle_8888_u32 SkOpts::RGBA_to_BGRA
 
Swizzle_8888_u32 SkOpts::RGBA_to_rgbA
 
Swizzle_8888_u32 SkOpts::RGBA_to_bgrA
 
Swizzle_8888_u32 SkOpts::rgbA_to_RGBA
 
Swizzle_8888_u32 SkOpts::rgbA_to_BGRA
 
Swizzle_8888_u32 SkOpts::inverted_CMYK_to_RGB1
 
Swizzle_8888_u32 SkOpts::inverted_CMYK_to_BGR1
 
Swizzle_8888_u8 SkOpts::RGB_to_RGB1
 
Swizzle_8888_u8 SkOpts::RGB_to_BGR1
 
Swizzle_8888_u8 SkOpts::gray_to_RGB1
 
Swizzle_8888_u8 SkOpts::grayA_to_RGBA
 
Swizzle_8888_u8 SkOpts::grayA_to_rgbA
 

Function Documentation

◆ Sk4f_fromL32()

static skvx::float4 Sk4f_fromL32 ( uint32_t  px)
inlinestatic

Definition at line 49 of file SkSwizzlePriv.h.

49 {
50 return skvx::cast<float>(skvx::byte4::Load(&px)) * (1 / 255.0f);
51}
static SKVX_ALWAYS_INLINE Vec Load(const void *ptr)
Definition: SkVx.h:109

◆ Sk4f_toL32()

static uint32_t Sk4f_toL32 ( const skvx::float4 px)
inlinestatic

Definition at line 53 of file SkSwizzlePriv.h.

53 {
54 uint32_t l32;
55 // For the expected positive color values, the +0.5 before the pin and cast effectively rounds
56 // to the nearest int without having to call round() or lrint().
57 skvx::cast<uint8_t>(skvx::pin(px * 255.f + 0.5f, skvx::float4(0.f), skvx::float4(255.f)))
58 .store(&l32);
59 return l32;
60}
SINT Vec< N, T > pin(const Vec< N, T > &x, const Vec< N, T > &lo, const Vec< N, T > &hi)
Definition: SkVx.h:655
Definition: SkVx.h:83

◆ swizzle_rb()

static skvx::float4 swizzle_rb ( const skvx::float4 x)
inlinestatic

Definition at line 37 of file SkSwizzlePriv.h.

37 {
38 return skvx::shuffle<2, 1, 0, 3>(x);
39}
double x

◆ swizzle_rb_if_bgra()

static skvx::float4 swizzle_rb_if_bgra ( const skvx::float4 x)
inlinestatic

Definition at line 41 of file SkSwizzlePriv.h.

41 {
42#if defined(SK_PMCOLOR_IS_BGRA)
43 return swizzle_rb(x);
44#else
45 return x;
46#endif
47}
static skvx::float4 swizzle_rb(const skvx::float4 &x)
Definition: SkSwizzlePriv.h:37