Flutter Engine
The Flutter Engine
Functions
SkConvertPixels.h File Reference
#include <cstddef>

Go to the source code of this file.

Functions

bool SkConvertPixels (const SkImageInfo &dstInfo, void *dstPixels, size_t dstRowBytes, const SkImageInfo &srcInfo, const void *srcPixels, size_t srcRowBytes)
 

Function Documentation

◆ SkConvertPixels()

bool SkConvertPixels ( const SkImageInfo dstInfo,
void *  dstPixels,
size_t  dstRowBytes,
const SkImageInfo srcInfo,
const void *  srcPixels,
size_t  srcRowBytes 
)

Definition at line 259 of file SkConvertPixels.cpp.

260 {
261 SkASSERT(dstInfo.dimensions() == srcInfo.dimensions());
262 SkASSERT(SkImageInfoValidConversion(dstInfo, srcInfo));
263
264 int srcStride = (int)(srcRB / srcInfo.bytesPerPixel());
265 int dstStride = (int)(dstRB / dstInfo.bytesPerPixel());
266 if ((size_t)srcStride * srcInfo.bytesPerPixel() != srcRB ||
267 (size_t)dstStride * dstInfo.bytesPerPixel() != dstRB) {
268 return false;
269 }
270
271 SkColorSpaceXformSteps steps{srcInfo.colorSpace(), srcInfo.alphaType(),
272 dstInfo.colorSpace(), dstInfo.alphaType()};
273
275 if (fn(dstInfo, dstPixels, dstRB, srcInfo, srcPixels, srcRB, steps)) {
276 return true;
277 }
278 }
279 convert_with_pipeline(dstInfo, dstPixels, dstStride, srcInfo, srcPixels, srcStride, steps);
280 return true;
281}
#define SkASSERT(cond)
Definition: SkAssert.h:116
static void convert_with_pipeline(const SkImageInfo &dstInfo, void *dstRow, int dstStride, const SkImageInfo &srcInfo, const void *srcRow, int srcStride, const SkColorSpaceXformSteps &steps)
static bool swizzle_or_premul(const SkImageInfo &dstInfo, void *dstPixels, size_t dstRB, const SkImageInfo &srcInfo, const void *srcPixels, size_t srcRB, const SkColorSpaceXformSteps &steps)
static bool convert_to_alpha8(const SkImageInfo &dstInfo, void *vdst, size_t dstRB, const SkImageInfo &srcInfo, const void *src, size_t srcRB, const SkColorSpaceXformSteps &)
static bool rect_memcpy(const SkImageInfo &dstInfo, void *dstPixels, size_t dstRB, const SkImageInfo &srcInfo, const void *srcPixels, size_t srcRB, const SkColorSpaceXformSteps &steps)
static bool SkImageInfoValidConversion(const SkImageInfo &dst, const SkImageInfo &src)
SkColorSpace * colorSpace() const
int bytesPerPixel() const
Definition: SkImageInfo.h:492
SkISize dimensions() const
Definition: SkImageInfo.h:421
SkAlphaType alphaType() const
Definition: SkImageInfo.h:375