Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | List of all members
GrPixmapBase< T, DERIVED > Class Template Reference

#include <GrPixmap.h>

Public Member Functions

const GrImageInfoinfo () const
 
const GrColorInfocolorInfo () const
 
Taddr () const
 
size_t rowBytes () const
 
bool hasPixels () const
 
bool ownsPixels () const
 
sk_sp< SkDatapixelStorage () const
 
int width () const
 
int height () const
 
SkISize dimensions () const
 
GrColorType colorType () const
 
SkAlphaType alphaType () const
 
SkColorSpacecolorSpace () const
 
sk_sp< SkColorSpacerefColorSpace () const
 
DERIVED clip (SkISize surfaceDims, SkIPoint *surfacePt)
 

Protected Member Functions

 GrPixmapBase ()=default
 
 GrPixmapBase (const GrPixmapBase &that)=default
 
 GrPixmapBase (GrPixmapBase &&that)=default
 
GrPixmapBaseoperator= (const GrPixmapBase &that)=default
 
GrPixmapBaseoperator= (GrPixmapBase &&that)=default
 
 GrPixmapBase (GrImageInfo info, T *addr, size_t rowBytes)
 
 GrPixmapBase (GrImageInfo info, sk_sp< SkData > storage, size_t rowBytes)
 

Detailed Description

template<typename T, typename DERIVED>
class GrPixmapBase< T, DERIVED >

Definition at line 15 of file GrPixmap.h.

Constructor & Destructor Documentation

◆ GrPixmapBase() [1/5]

template<typename T , typename DERIVED >
GrPixmapBase< T, DERIVED >::GrPixmapBase ( )
protecteddefault

◆ GrPixmapBase() [2/5]

template<typename T , typename DERIVED >
GrPixmapBase< T, DERIVED >::GrPixmapBase ( const GrPixmapBase< T, DERIVED > &  that)
protecteddefault

◆ GrPixmapBase() [3/5]

template<typename T , typename DERIVED >
GrPixmapBase< T, DERIVED >::GrPixmapBase ( GrPixmapBase< T, DERIVED > &&  that)
protecteddefault

◆ GrPixmapBase() [4/5]

template<typename T , typename DERIVED >
GrPixmapBase< T, DERIVED >::GrPixmapBase ( GrImageInfo  info,
T addr,
size_t  rowBytes 
)
inlineprotected

Definition at line 63 of file GrPixmap.h.

64 : fAddr(addr), fRowBytes(rowBytes), fInfo(std::move(info)) {
65 if (fRowBytes < fInfo.minRowBytes() || !addr) {
66 *this = {};
67 }
68 }
size_t minRowBytes() const
Definition: GrImageInfo.h:60
const GrImageInfo & info() const
Definition: GrPixmap.h:17
size_t rowBytes() const
Definition: GrPixmap.h:21
T * addr() const
Definition: GrPixmap.h:20

◆ GrPixmapBase() [5/5]

template<typename T , typename DERIVED >
GrPixmapBase< T, DERIVED >::GrPixmapBase ( GrImageInfo  info,
sk_sp< SkData storage,
size_t  rowBytes 
)
inlineprotected

Definition at line 70 of file GrPixmap.h.

71 : GrPixmapBase(std::move(info), const_cast<void*>(storage->data()), rowBytes) {
72 fPixelStorage = std::move(storage);
73 }
GrPixmapBase()=default
const void * data() const
Definition: SkData.h:37

Member Function Documentation

◆ addr()

template<typename T , typename DERIVED >
T * GrPixmapBase< T, DERIVED >::addr ( ) const
inline

Definition at line 20 of file GrPixmap.h.

20{ return fAddr; }

◆ alphaType()

template<typename T , typename DERIVED >
SkAlphaType GrPixmapBase< T, DERIVED >::alphaType ( ) const
inline

Definition at line 31 of file GrPixmap.h.

31{ return fInfo.alphaType(); }
SkAlphaType alphaType() const
Definition: GrImageInfo.h:46

◆ clip()

template<typename T , typename DERIVED >
DERIVED GrPixmapBase< T, DERIVED >::clip ( SkISize  surfaceDims,
SkIPoint surfacePt 
)
inline

Map this pixmap to a rect in a surface of indicated dimensions at offset surfacePt. Clip the logical rectangle to the bounds of the surface. If the rect does not intersect the surface bounds or is empty then return a default GrPixmap. Otherwise, surfacePt is updated to refer to the upper left of the clipped rectangle. The returned pixmap will refer to the portion of the original pixmap inside the surface bounds.

Definition at line 42 of file GrPixmap.h.

42 {
43 auto bounds = SkIRect::MakeSize(surfaceDims);
44 auto rect = SkIRect::MakePtSize(*surfacePt, this->dimensions());
45 if (!rect.intersect(bounds)) {
46 return {};
47 }
48 T* addr = static_cast<sknonstd::copy_const_t<char, T>*>(fAddr) +
49 (rect.fTop - surfacePt->fY) * fRowBytes +
50 (rect.fLeft - surfacePt->fX) * fInfo.bpp();
51 surfacePt->fX = rect.fLeft;
52 surfacePt->fY = rect.fTop;
53 return DERIVED{this->info().makeDimensions(rect.size()), addr, fRowBytes};
54 }
GrImageInfo makeDimensions(SkISize dimensions) const
Definition: GrImageInfo.cpp:50
size_t bpp() const
Definition: GrImageInfo.h:58
SkISize dimensions() const
Definition: GrPixmap.h:29
Optional< SkRect > bounds
Definition: SkRecords.h:189
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350
typename copy_const< D, S >::type copy_const_t
Definition: SkTLogic.h:29
#define T
Definition: precompiler.cc:65
int32_t fX
x-axis value
Definition: SkPoint_impl.h:29
int32_t fY
y-axis value
Definition: SkPoint_impl.h:30
static constexpr SkIRect MakeSize(const SkISize &size)
Definition: SkRect.h:66
static constexpr SkIRect MakePtSize(SkIPoint pt, SkISize size)
Definition: SkRect.h:78

◆ colorInfo()

template<typename T , typename DERIVED >
const GrColorInfo & GrPixmapBase< T, DERIVED >::colorInfo ( ) const
inline

Definition at line 18 of file GrPixmap.h.

18{ return fInfo.colorInfo(); }
const GrColorInfo & colorInfo() const
Definition: GrImageInfo.h:42

◆ colorSpace()

template<typename T , typename DERIVED >
SkColorSpace * GrPixmapBase< T, DERIVED >::colorSpace ( ) const
inline

Definition at line 32 of file GrPixmap.h.

32{ return fInfo.colorSpace(); }
SkColorSpace * colorSpace() const
Definition: GrImageInfo.h:48

◆ colorType()

template<typename T , typename DERIVED >
GrColorType GrPixmapBase< T, DERIVED >::colorType ( ) const
inline

Definition at line 30 of file GrPixmap.h.

30{ return fInfo.colorType(); }
GrColorType colorType() const
Definition: GrImageInfo.h:44

◆ dimensions()

template<typename T , typename DERIVED >
SkISize GrPixmapBase< T, DERIVED >::dimensions ( ) const
inline

Definition at line 29 of file GrPixmap.h.

29{ return fInfo.dimensions(); }
SkISize dimensions() const
Definition: GrImageInfo.h:52

◆ hasPixels()

template<typename T , typename DERIVED >
bool GrPixmapBase< T, DERIVED >::hasPixels ( ) const
inline

Definition at line 23 of file GrPixmap.h.

23{ return SkToBool(fAddr); }
static constexpr bool SkToBool(const T &x)
Definition: SkTo.h:35

◆ height()

template<typename T , typename DERIVED >
int GrPixmapBase< T, DERIVED >::height ( ) const
inline

Definition at line 28 of file GrPixmap.h.

28{ return fInfo.height(); }
int height() const
Definition: GrImageInfo.h:56

◆ info()

template<typename T , typename DERIVED >
const GrImageInfo & GrPixmapBase< T, DERIVED >::info ( ) const
inline

Definition at line 17 of file GrPixmap.h.

17{ return fInfo; }

◆ operator=() [1/2]

template<typename T , typename DERIVED >
GrPixmapBase & GrPixmapBase< T, DERIVED >::operator= ( const GrPixmapBase< T, DERIVED > &  that)
protecteddefault

◆ operator=() [2/2]

template<typename T , typename DERIVED >
GrPixmapBase & GrPixmapBase< T, DERIVED >::operator= ( GrPixmapBase< T, DERIVED > &&  that)
protecteddefault

◆ ownsPixels()

template<typename T , typename DERIVED >
bool GrPixmapBase< T, DERIVED >::ownsPixels ( ) const
inline

Definition at line 24 of file GrPixmap.h.

24{ return SkToBool(fPixelStorage); }

◆ pixelStorage()

template<typename T , typename DERIVED >
sk_sp< SkData > GrPixmapBase< T, DERIVED >::pixelStorage ( ) const
inline

Definition at line 25 of file GrPixmap.h.

25{ return fPixelStorage; }

◆ refColorSpace()

template<typename T , typename DERIVED >
sk_sp< SkColorSpace > GrPixmapBase< T, DERIVED >::refColorSpace ( ) const
inline

Definition at line 33 of file GrPixmap.h.

33{ return fInfo.refColorSpace(); }
sk_sp< SkColorSpace > refColorSpace() const
Definition: GrImageInfo.cpp:58

◆ rowBytes()

template<typename T , typename DERIVED >
size_t GrPixmapBase< T, DERIVED >::rowBytes ( ) const
inline

Definition at line 21 of file GrPixmap.h.

21{ return fRowBytes; }

◆ width()

template<typename T , typename DERIVED >
int GrPixmapBase< T, DERIVED >::width ( ) const
inline

Definition at line 27 of file GrPixmap.h.

27{ return fInfo.width(); }
int width() const
Definition: GrImageInfo.h:54

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