Flutter Engine
The Flutter Engine
Namespaces | Functions
SkWebpCodec.cpp File Reference
#include "src/codec/SkWebpCodec.h"
#include "include/codec/SkCodec.h"
#include "include/codec/SkCodecAnimation.h"
#include "include/codec/SkWebpDecoder.h"
#include "include/core/SkAlphaType.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkColorType.h"
#include "include/core/SkImageInfo.h"
#include "include/core/SkRect.h"
#include "include/core/SkSize.h"
#include "include/core/SkStream.h"
#include "include/private/base/SkAlign.h"
#include "include/private/base/SkMath.h"
#include "include/private/base/SkTFitsIn.h"
#include "include/private/base/SkTemplates.h"
#include "include/private/base/SkTo.h"
#include "modules/skcms/skcms.h"
#include "src/codec/SkParseEncodedOrigin.h"
#include "src/codec/SkSampler.h"
#include "src/core/SkRasterPipeline.h"
#include "src/core/SkRasterPipelineOpContexts.h"
#include "src/core/SkRasterPipelineOpList.h"
#include "src/core/SkStreamPriv.h"
#include <algorithm>
#include <cstdint>
#include <cstring>
#include <utility>
#include "webp/decode.h"
#include "webp/demux.h"
#include "webp/mux_types.h"

Go to the source code of this file.

Namespaces

namespace  SkWebpDecoder
 

Functions

static WEBP_CSP_MODE webp_decode_mode (SkColorType dstCT, bool premultiply)
 
static bool is_8888 (SkColorType colorType)
 
static void blend_line (SkColorType dstCT, void *dst, SkColorType srcCT, const void *src, SkAlphaType dstAt, bool srcHasAlpha, int width)
 
SK_API bool SkWebpDecoder::IsWebp (const void *, size_t)
 
SK_API std::unique_ptr< SkCodecSkWebpDecoder::Decode (std::unique_ptr< SkStream >, SkCodec::Result *, SkCodecs::DecodeContext=nullptr)
 
SK_API std::unique_ptr< SkCodecSkWebpDecoder::Decode (sk_sp< SkData >, SkCodec::Result *, SkCodecs::DecodeContext=nullptr)
 

Function Documentation

◆ blend_line()

static void blend_line ( SkColorType  dstCT,
void *  dst,
SkColorType  srcCT,
const void *  src,
SkAlphaType  dstAt,
bool  srcHasAlpha,
int  width 
)
static

Definition at line 338 of file SkWebpCodec.cpp.

342 {
343 SkRasterPipeline_MemoryCtx dst_ctx = { dst, 0 },
344 src_ctx = { const_cast<void*>(src), 0 };
345
347
348 p.appendLoadDst(dstCT, &dst_ctx);
349 if (kUnpremul_SkAlphaType == dstAt) {
350 p.append(SkRasterPipelineOp::premul_dst);
351 }
352
353 p.appendLoad(srcCT, &src_ctx);
354 if (srcHasAlpha) {
356 }
357
358 p.append(SkRasterPipelineOp::srcover);
359
360 if (kUnpremul_SkAlphaType == dstAt) {
361 p.append(SkRasterPipelineOp::unpremul);
362 }
363 p.appendStore(dstCT, &dst_ctx);
364
365 p.run(0,0, width,1);
366}
kUnpremul_SkAlphaType
static uint32_t premul(uint32_t color)
dst
Definition: cp.py:12
int32_t width

◆ is_8888()

static bool is_8888 ( SkColorType  colorType)
static

Definition at line 327 of file SkWebpCodec.cpp.

327 {
328 switch (colorType) {
331 return true;
332 default:
333 return false;
334 }
335}
@ kBGRA_8888_SkColorType
pixel with 8 bits for blue, green, red, alpha; in 32-bit word
Definition: SkColorType.h:26
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
Definition: SkColorType.h:24
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)

◆ webp_decode_mode()

static WEBP_CSP_MODE webp_decode_mode ( SkColorType  dstCT,
bool  premultiply 
)
static

Definition at line 200 of file SkWebpCodec.cpp.

200 {
201 switch (dstCT) {
203 return premultiply ? MODE_bgrA : MODE_BGRA;
205 return premultiply ? MODE_rgbA : MODE_RGBA;
207 return MODE_RGB_565;
208 default:
209 return MODE_LAST;
210 }
211}
@ kRGB_565_SkColorType
pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
Definition: SkColorType.h:22