Flutter Engine
The Flutter Engine
third_party
skia
src
codec
SkMaskSwizzler.h
Go to the documentation of this file.
1
/*
2
* Copyright 2015 Google Inc.
3
*
4
* Use of this source code is governed by a BSD-style license that can be
5
* found in the LICENSE file.
6
*/
7
#ifndef SkMaskSwizzler_DEFINED
8
#define SkMaskSwizzler_DEFINED
9
10
#include "
include/codec/SkCodec.h
"
11
#include "
include/core/SkTypes.h
"
12
#include "
src/codec/SkSampler.h
"
13
14
#include <cstdint>
15
16
class
SkMasks
;
17
struct
SkImageInfo
;
18
19
/*
20
*
21
* Used to swizzle images whose pixel components are extracted by bit masks
22
* Currently only used by bmp
23
*
24
*/
25
class
SkMaskSwizzler
:
public
SkSampler
{
26
public
:
27
28
/*
29
* @param masks Unowned pointer to helper class
30
*/
31
static
SkMaskSwizzler
*
CreateMaskSwizzler
(
const
SkImageInfo
& dstInfo,
32
bool
srcIsOpaque,
33
SkMasks
* masks,
34
uint32_t bitsPerPixel,
35
const
SkCodec::Options
&
options
);
36
37
/*
38
* Swizzle a row
39
*/
40
void
swizzle
(
void
*
dst
,
const
uint8_t*
SK_RESTRICT
src
);
41
42
int
fillWidth
()
const override
{
43
return
fDstWidth;
44
}
45
46
/**
47
* Returns the byte offset at which we write to destination memory, taking
48
* scaling, subsetting, and partial frames into account.
49
* A similar function exists on SkSwizzler.
50
*/
51
int
swizzleWidth
()
const
{
return
fDstWidth; }
52
53
private
:
54
55
/*
56
* Row procedure used for swizzle
57
*/
58
typedef
void (*RowProc)(
void
* dstRow,
const
uint8_t* srcRow,
int
width
,
59
SkMasks
* masks, uint32_t startX, uint32_t sampleX);
60
61
SkMaskSwizzler
(
SkMasks
* masks, RowProc proc,
int
subsetWidth,
int
srcOffset);
62
63
int
onSetSampleX(
int
)
override
;
64
65
SkMasks
* fMasks;
// unowned
66
const
RowProc fRowProc;
67
68
// FIXME: Can this class share more with SkSwizzler? These variables are all the same.
69
const
int
fSubsetWidth;
// Width of the subset of source before any sampling.
70
int
fDstWidth;
// Width of dst, which may differ with sampling.
71
int
fSampleX;
72
int
fSrcOffset;
73
int
fX0;
74
};
75
76
#endif
options
const char * options
Definition:
CommonFlagsConfig.cpp:43
SkCodec.h
SK_RESTRICT
#define SK_RESTRICT
Definition:
SkFeatures.h:42
SkSampler.h
SkTypes.h
SkMaskSwizzler
Definition:
SkMaskSwizzler.h:25
SkMaskSwizzler::swizzleWidth
int swizzleWidth() const
Definition:
SkMaskSwizzler.h:51
SkMaskSwizzler::swizzle
void swizzle(void *dst, const uint8_t *SK_RESTRICT src)
Definition:
SkMaskSwizzler.cpp:572
SkMaskSwizzler::fillWidth
int fillWidth() const override
Definition:
SkMaskSwizzler.h:42
SkMaskSwizzler::CreateMaskSwizzler
static SkMaskSwizzler * CreateMaskSwizzler(const SkImageInfo &dstInfo, bool srcIsOpaque, SkMasks *masks, uint32_t bitsPerPixel, const SkCodec::Options &options)
Definition:
SkMaskSwizzler.cpp:394
SkMasks
Definition:
SkMasks.h:14
SkSampler
Definition:
SkSampler.h:19
gn.cp.dst
dst
Definition:
cp.py:12
mskp_parser.src
src
Definition:
mskp_parser.py:22
width
int32_t width
Definition:
serialization_callbacks.cc:0
SkCodec::Options
Definition:
SkCodec.h:321
SkImageInfo
Definition:
SkImageInfo.h:208
Generated on Sun Jun 23 2024 21:56:10 for Flutter Engine by
1.9.4