Flutter Engine
The Flutter Engine
Functions
SkCodecImageGenerator.cpp File Reference
#include "src/codec/SkCodecImageGenerator.h"
#include "include/codec/SkEncodedOrigin.h"
#include "include/codec/SkPixmapUtils.h"
#include "include/core/SkAlphaType.h"
#include "include/core/SkData.h"
#include "include/core/SkImageInfo.h"
#include "include/core/SkPixmap.h"
#include "include/core/SkStream.h"
#include "include/core/SkTypes.h"
#include "src/codec/SkPixmapUtilsPriv.h"
#include <utility>

Go to the source code of this file.

Functions

static SkImageInfo adjust_info (SkCodec *codec, std::optional< SkAlphaType > at)
 

Function Documentation

◆ adjust_info()

static SkImageInfo adjust_info ( SkCodec codec,
std::optional< SkAlphaType at 
)
static

Definition at line 38 of file SkCodecImageGenerator.cpp.

38 {
40 SkImageInfo info = codec->getInfo();
41 if (at.has_value()) {
42 // If a specific alpha type was requested, use that.
43 info = info.makeAlphaType(*at);
44 } else if (kUnpremul_SkAlphaType == info.alphaType()) {
45 // Otherwise, prefer premul over unpremul (this produces better filtering in general)
46 info = info.makeAlphaType(kPremul_SkAlphaType);
47 }
50 }
51 return info;
52}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
kUnpremul_SkAlphaType
@ kOpaque_SkAlphaType
pixel is opaque
Definition: SkAlphaType.h:28
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
Definition: SkAlphaType.h:29
#define SkASSERT(cond)
Definition: SkAssert.h:116
static bool SkEncodedOriginSwapsWidthHeight(SkEncodedOrigin origin)
SkEncodedOrigin getOrigin() const
Definition: SkCodec.h:246
SkImageInfo getInfo() const
Definition: SkCodec.h:228
SK_API SkImageInfo SwapWidthHeight(const SkImageInfo &info)