Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | List of all members
SkMaskSwizzler Class Reference

#include <SkMaskSwizzler.h>

Inheritance diagram for SkMaskSwizzler:
SkSampler SkNoncopyable

Public Member Functions

void swizzle (void *dst, const uint8_t *SK_RESTRICT src)
 
int fillWidth () const override
 
int swizzleWidth () const
 
- Public Member Functions inherited from SkSampler
int setSampleX (int sampleX)
 
void setSampleY (int sampleY)
 
int sampleY () const
 
bool rowNeeded (int row) const
 
virtual int fillWidth () const =0
 
 SkSampler ()
 
virtual ~SkSampler ()
 
- Public Member Functions inherited from SkNoncopyable
 SkNoncopyable ()=default
 
 SkNoncopyable (SkNoncopyable &&)=default
 
SkNoncopyableoperator= (SkNoncopyable &&)=default
 

Static Public Member Functions

static SkMaskSwizzlerCreateMaskSwizzler (const SkImageInfo &dstInfo, bool srcIsOpaque, SkMasks *masks, uint32_t bitsPerPixel, const SkCodec::Options &options)
 
- Static Public Member Functions inherited from SkSampler
static void Fill (const SkImageInfo &info, void *dst, size_t rowBytes, SkCodec::ZeroInitialized zeroInit)
 

Detailed Description

Definition at line 25 of file SkMaskSwizzler.h.

Member Function Documentation

◆ CreateMaskSwizzler()

SkMaskSwizzler * SkMaskSwizzler::CreateMaskSwizzler ( const SkImageInfo dstInfo,
bool  srcIsOpaque,
SkMasks masks,
uint32_t  bitsPerPixel,
const SkCodec::Options options 
)
static

Definition at line 394 of file SkMaskSwizzler.cpp.

396 {
397
398 // Choose the appropriate row procedure
399 RowProc proc = nullptr;
400 switch (bitsPerPixel) {
401 case 16:
402 switch (dstInfo.colorType()) {
404 if (srcIsOpaque) {
406 } else {
407 switch (dstInfo.alphaType()) {
410 break;
413 break;
414 default:
415 break;
416 }
417 }
418 break;
420 if (srcIsOpaque) {
422 } else {
423 switch (dstInfo.alphaType()) {
426 break;
429 break;
430 default:
431 break;
432 }
433 }
434 break;
436 proc = &swizzle_mask16_to_565;
437 break;
438 default:
439 break;
440 }
441 break;
442 case 24:
443 switch (dstInfo.colorType()) {
445 if (srcIsOpaque) {
447 } else {
448 switch (dstInfo.alphaType()) {
451 break;
454 break;
455 default:
456 break;
457 }
458 }
459 break;
461 if (srcIsOpaque) {
463 } else {
464 switch (dstInfo.alphaType()) {
467 break;
470 break;
471 default:
472 break;
473 }
474 }
475 break;
477 proc = &swizzle_mask24_to_565;
478 break;
479 default:
480 break;
481 }
482 break;
483 case 32:
484 switch (dstInfo.colorType()) {
486 if (srcIsOpaque) {
488 } else {
489 switch (dstInfo.alphaType()) {
492 break;
495 break;
496 default:
497 break;
498 }
499 }
500 break;
502 if (srcIsOpaque) {
504 } else {
505 switch (dstInfo.alphaType()) {
508 break;
511 break;
512 default:
513 break;
514 }
515 }
516 break;
518 proc = &swizzle_mask32_to_565;
519 break;
520 default:
521 break;
522 }
523 break;
524 default:
525 SkASSERT(false);
526 return nullptr;
527 }
528
529 int srcOffset = 0;
530 int srcWidth = dstInfo.width();
531 if (options.fSubset) {
532 srcOffset = options.fSubset->left();
533 srcWidth = options.fSubset->width();
534 }
535
536 return new SkMaskSwizzler(masks, proc, srcOffset, srcWidth);
537}
const char * options
kUnpremul_SkAlphaType
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
Definition: SkAlphaType.h:29
#define SkASSERT(cond)
Definition: SkAssert.h:116
@ kBGRA_8888_SkColorType
pixel with 8 bits for blue, green, red, alpha; in 32-bit word
Definition: SkColorType.h:26
@ kRGB_565_SkColorType
pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
Definition: SkColorType.h:22
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
Definition: SkColorType.h:24
static void swizzle_mask32_to_rgba_opaque(void *dstRow, const uint8_t *srcRow, int width, SkMasks *masks, uint32_t startX, uint32_t sampleX)
static void swizzle_mask16_to_rgba_opaque(void *dstRow, const uint8_t *srcRow, int width, SkMasks *masks, uint32_t startX, uint32_t sampleX)
static void swizzle_mask24_to_rgba_premul(void *dstRow, const uint8_t *srcRow, int width, SkMasks *masks, uint32_t startX, uint32_t sampleX)
static void swizzle_mask32_to_rgba_premul(void *dstRow, const uint8_t *srcRow, int width, SkMasks *masks, uint32_t startX, uint32_t sampleX)
static void swizzle_mask32_to_rgba_unpremul(void *dstRow, const uint8_t *srcRow, int width, SkMasks *masks, uint32_t startX, uint32_t sampleX)
static void swizzle_mask24_to_rgba_unpremul(void *dstRow, const uint8_t *srcRow, int width, SkMasks *masks, uint32_t startX, uint32_t sampleX)
static void swizzle_mask32_to_bgra_opaque(void *dstRow, const uint8_t *srcRow, int width, SkMasks *masks, uint32_t startX, uint32_t sampleX)
static void swizzle_mask24_to_rgba_opaque(void *dstRow, const uint8_t *srcRow, int width, SkMasks *masks, uint32_t startX, uint32_t sampleX)
static void swizzle_mask16_to_rgba_premul(void *dstRow, const uint8_t *srcRow, int width, SkMasks *masks, uint32_t startX, uint32_t sampleX)
static void swizzle_mask32_to_bgra_premul(void *dstRow, const uint8_t *srcRow, int width, SkMasks *masks, uint32_t startX, uint32_t sampleX)
static void swizzle_mask24_to_bgra_premul(void *dstRow, const uint8_t *srcRow, int width, SkMasks *masks, uint32_t startX, uint32_t sampleX)
static void swizzle_mask16_to_bgra_premul(void *dstRow, const uint8_t *srcRow, int width, SkMasks *masks, uint32_t startX, uint32_t sampleX)
static void swizzle_mask24_to_bgra_unpremul(void *dstRow, const uint8_t *srcRow, int width, SkMasks *masks, uint32_t startX, uint32_t sampleX)
static void swizzle_mask16_to_bgra_opaque(void *dstRow, const uint8_t *srcRow, int width, SkMasks *masks, uint32_t startX, uint32_t sampleX)
static void swizzle_mask24_to_bgra_opaque(void *dstRow, const uint8_t *srcRow, int width, SkMasks *masks, uint32_t startX, uint32_t sampleX)
static void swizzle_mask16_to_rgba_unpremul(void *dstRow, const uint8_t *srcRow, int width, SkMasks *masks, uint32_t startX, uint32_t sampleX)
static void swizzle_mask32_to_bgra_unpremul(void *dstRow, const uint8_t *srcRow, int width, SkMasks *masks, uint32_t startX, uint32_t sampleX)
static void swizzle_mask16_to_bgra_unpremul(void *dstRow, const uint8_t *srcRow, int width, SkMasks *masks, uint32_t startX, uint32_t sampleX)
static void swizzle_mask24_to_565(void *dstRow, const uint8_t *srcRow, int width, SkMasks *masks, uint32_t startX, uint32_t sampleX)
static void swizzle_mask16_to_565(void *dstRow, const uint8_t *srcRow, int width, SkMasks *masks, uint32_t startX, uint32_t sampleX)
static void swizzle_mask32_to_565(void *dstRow, const uint8_t *srcRow, int width, SkMasks *masks, uint32_t startX, uint32_t sampleX)
int width() const
Definition: SkImageInfo.h:365
SkAlphaType alphaType() const
Definition: SkImageInfo.h:375
SkColorType colorType() const
Definition: SkImageInfo.h:373

◆ fillWidth()

int SkMaskSwizzler::fillWidth ( ) const
inlineoverridevirtual

Implements SkSampler.

Definition at line 42 of file SkMaskSwizzler.h.

42 {
43 return fDstWidth;
44 }

◆ swizzle()

void SkMaskSwizzler::swizzle ( void *  dst,
const uint8_t *SK_RESTRICT  src 
)

Definition at line 572 of file SkMaskSwizzler.cpp.

572 {
573 SkASSERT(nullptr != dst && nullptr != src);
574 fRowProc(dst, src, fDstWidth, fMasks, fX0, fSampleX);
575}
dst
Definition: cp.py:12

◆ swizzleWidth()

int SkMaskSwizzler::swizzleWidth ( ) const
inline

Returns the byte offset at which we write to destination memory, taking scaling, subsetting, and partial frames into account. A similar function exists on SkSwizzler.

Definition at line 51 of file SkMaskSwizzler.h.

51{ return fDstWidth; }

The documentation for this class was generated from the following files: