34size_t SkMipmap::AllocLevelsSize(
int levelCount,
size_t pixelSize) {
38 int64_t
size =
sk_64_mul(levelCount + 1,
sizeof(Level)) + pixelSize;
39 if (!SkTFitsIn<int32_t>(
size)) {
42 return SkTo<int32_t>(
size);
46 bool computeContents) {
47 if (
src.width() <= 1 &&
src.height() <= 1) {
57 for (
int currentMipLevel =
countLevels; currentMipLevel >= 0; currentMipLevel--) {
63 if (0 == storageSize) {
73 mipmap =
new SkMipmap(storageSize, dm);
80 mipmap =
new SkMipmap(tmp, storageSize);
89 Level* levels = mipmap->fLevels;
91 uint8_t*
addr = baseAddr;
101 std::unique_ptr<SkMipmapDownSampler> downsampler;
102 if (computeContents) {
123 downsampler->buildLevel(dstPM, srcPM);
135 if (baseWidth < 1 || baseHeight < 1) {
144 const int largestAxis =
std::max(baseWidth, baseHeight);
145 if (largestAxis < 2) {
149 const int leadingZeros =
SkCLZ(
static_cast<uint32_t
>(largestAxis));
152 const int significantBits = (
sizeof(uint32_t) * 8) - leadingZeros;
155 int mipLevelCount = significantBits;
161 if (mipLevelCount > 0) {
165 return mipLevelCount;
169 if (baseWidth < 1 || baseHeight < 1) {
198#ifndef SK_SUPPORT_LEGACY_ANISOTROPIC_MIPMAP_SCALE
221 if (
nullptr == fLevels) {
231 if (
level > fCount) {
235 *levelPtr = fLevels[
level - 1];
243 if (
nullptr == fLevels) {
248 if (dimension.
width() <= 1 && dimension.
height() <= 1) {
253 fLevels[0].fPixmap.height() !=
std::max(1, dimension.
height() >> 1)) {
258 if (fLevels[
i].fPixmap.colorType() !=
root.colorType() ||
270 if (!
src.peekPixels(&srcPixmap)) {
273 return Build(srcPixmap, fact);
281 if (
nullptr == fLevels) {
287 if (index > fCount - 1) {
291 *levelPtr = fLevels[index];
static constexpr bool SkIsAlign8(T x)
static bool SkIsFinite(T x, Pack... values)
#define sk_float_round2int(x)
static size_t SkColorTypeMinRowBytes(SkColorType ct, int width)
static void * sk_malloc_canfail(size_t size)
static int SkCLZ(uint32_t mask)
static int64_t sk_64_mul(int64_t a, int64_t b)
SkDiscardableMemory *(* SkDiscardableFactoryProc)(size_t bytes)
sk_sp< T > sk_ref_sp(T *obj)
constexpr uint32_t SkToU32(S x)
static SkMipmap * Build(const SkPixmap &src, SkDiscardableFactoryProc, bool computeContents=true)
static float ComputeLevel(SkSize scaleSize)
bool validForRootLevel(const SkImageInfo &) const
static SkISize ComputeLevelSize(int baseWidth, int baseHeight, int level)
static std::unique_ptr< SkMipmapDownSampler > MakeDownSampler(const SkPixmap &)
bool extractLevel(SkSize scale, Level *) const
bool getLevel(int index, Level *) const
static int ComputeLevelCount(int baseWidth, int baseHeight)
void setColorSpace(sk_sp< SkColorSpace > colorSpace)
SkAlphaType alphaType() const
static float max(float r, float g, float b)
static float min(float r, float g, float b)
void * malloc(size_t size)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
SIN Vec< N, float > sqrt(const Vec< N, float > &x)
static constexpr SkISize Make(int32_t w, int32_t h)
constexpr int32_t width() const
constexpr int32_t height() const
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
static constexpr SkSize Make(SkScalar w, SkScalar h)