30 , fSupportBilerpAtlas{recorder->
priv().caps()->supportBilerpFromGlyphAtlas()}
31 , fAtlasConfig{recorder->
priv().caps()->maxTextureSize(),
32 recorder->
priv().caps()->glyphCacheTextureMaximumBytes()} {
47 fAtlases[
i] =
nullptr;
56template <
typename INT_TYPE>
64 int rowWritesLeft =
width;
65 const uint8_t*
s =
src;
67 while (rowWritesLeft > 0) {
69 for (
int x = 7;
x >= 0 && rowWritesLeft; --
x, --rowWritesLeft) {
70 *
d++ = (mask & (1 <<
x)) ? (INT_TYPE)(~0
UL) : 0;
73 dst =
reinterpret_cast<INT_TYPE*
>(
reinterpret_cast<intptr_t
>(
dst) + dstRowBytes);
86 if (maskFormat == expectedMaskFormat) {
94 src = (
const char*)
src + srcRB;
102 const uint8_t*
bits =
reinterpret_cast<const uint8_t*
>(
src);
103 switch (expectedMaskFormat) {
105 uint8_t* bytes =
reinterpret_cast<uint8_t*
>(
dst);
110 uint16_t*
rgb565 =
reinterpret_cast<uint16_t*
>(
dst);
123 static constexpr SkMasks masks{
124 {0b1111'1000'0000'0000, 11, 5},
125 {0b0000'0111'1110'0000, 5, 6},
126 {0b0000'0000'0001'1111, 0, 5},
132 char* dstRow = (
char*)
dst;
136 uint16_t color565 = 0;
137 memcpy(&color565,
src, a565Bpp);
142 color8888 = masks.getBlue(color565) |
143 (masks.getGreen(color565) << 8) |
144 (masks.getRed(color565) << 16) |
147 color8888 = masks.getRed(color565) |
148 (masks.getGreen(color565) << 8) |
149 (masks.getBlue(color565) << 16) |
152 memcpy(
dst, &color8888, argbBpp);
153 src = (
const char*)
src + a565Bpp;
154 dst = (
char*)
dst + argbBpp;
179#if !defined(SK_DISABLE_SDF_TEXT)
185 if (skGlyph.
image() ==
nullptr) {
191 MaskFormat expectedMaskFormat = this->resolveMaskFormat(glyphFormat);
195 switch (srcPadding) {
199 if (fSupportBilerpAtlas) {
209#if !defined(SK_DISABLE_SDF_TEXT)
223 const int width = skGlyph.
width() + 2*padding;
225 int rowBytes =
width * bytesPerPixel;
230 void* dataPtr = storage.
get();
234 dataPtr = (
char*)(dataPtr) + rowBytes + bytesPerPixel;
240 auto errorCode =
atlas->addToAtlas(fRecorder,
277 fAtlases[
i] =
nullptr;
285 int index = MaskFormatToAtlasIndex(
format);
286 if (fAtlases[index] ==
nullptr) {
295 fAllowMultitexturing,
299 if (!fAtlases[index]) {
310 fAtlases[
i]->compact(tokenTracker->nextFlushToken());
323std::tuple<bool, int> GlyphVector::regenerateAtlasForGraphite(
int begin,
332 unsigned int numActiveProxies;
334 atlasManager->getProxies(maskFormat, &numActiveProxies);
336 SkDebugf(
"Could not allocate backing texture for atlas\n");
340 uint64_t currentAtlasGen = atlasManager->atlasGeneration(maskFormat);
344 if (fAtlasGeneration != currentAtlasGen) {
347 fBulkUseUpdater.reset();
353 int glyphsPlacedInAtlas = 0;
356 Glyph* gpuGlyph = variant.glyph;
359 if (!atlasManager->hasGlyph(maskFormat, gpuGlyph)) {
361 auto code = atlasManager->addGlyphToAtlas(skGlyph, gpuGlyph, srcPadding);
362 if (
code != DrawAtlas::ErrorCode::kSucceeded) {
367 atlasManager->addGlyphToBulkAndSetUseToken(
368 &fBulkUseUpdater, maskFormat, gpuGlyph,
369 tokenTracker->nextFlushToken());
370 glyphsPlacedInAtlas++;
374 if (success &&
begin + glyphsPlacedInAtlas ==
SkCount(fGlyphs)) {
377 fAtlasGeneration = atlasManager->atlasGeneration(maskFormat);
380 return {success, glyphsPlacedInAtlas};
386 atlasManager->setUseTokenBulk(fBulkUseUpdater,
387 tokenTracker->nextFlushToken(),
sk_bzero(glyphs, sizeof(glyphs))
static const uint16_t rgb565[kNumPixels]
#define SK_ABORT(message,...)
@ kBGRA_8888_SkColorType
pixel with 8 bits for blue, green, red, alpha; in 32-bit word
@ kRGB_565_SkColorType
pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
#define SK_DistanceFieldInset
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
SK_API int SkColorTypeBytesPerPixel(SkColorType ct)
constexpr int SkCount(const Container &c)
SkMask::Format maskFormat() const
const void * image() const
void insetSrc(int padding)
PlotLocator plotLocator() const
bool add(const skgpu::AtlasLocator &atlasLocator)
TextAtlasManager * textAtlasManager() const
bool allowMultipleAtlasTextures() const
virtual TextureInfo getDefaultSampledTextureInfo(SkColorType, Mipmapped mipmapped, Protected, Renderable) const =0
const SkSL::ShaderCaps * shaderCaps() const
SkISize plotDimensions(MaskFormat type) const
SkISize atlasDimensions(MaskFormat type) const
void setLastUseToken(const AtlasLocator &atlasLocator, AtlasToken token)
bool hasID(const PlotLocator &plotLocator)
static std::unique_ptr< DrawAtlas > Make(SkColorType ct, size_t bpp, int width, int height, int plotWidth, int plotHeight, AtlasGenerationCounter *generationCounter, AllowMultitexturing allowMultitexturing, UseStorageTextures useStorageTextures, PlotEvictionCallback *evictor, std::string_view label)
TokenTracker * tokenTracker()
sktext::gpu::StrikeCache * strikeCache()
AtlasProvider * atlasProvider()
const Caps * caps() const
void setAtlasDimensionsToMinimum_ForTesting()
DrawAtlas::ErrorCode addGlyphToAtlas(const SkGlyph &, sktext::gpu::Glyph *, int srcPadding)
bool recordUploads(DrawContext *dc)
void addGlyphToBulkAndSetUseToken(BulkUsePlotUpdater *, MaskFormat, sktext::gpu::Glyph *, AtlasToken)
TextAtlasManager(Recorder *)
bool hasGlyph(MaskFormat, sktext::gpu::Glyph *)
skgpu::AtlasLocator fAtlasLocator
static skgpu::MaskFormat FormatFromSkGlyph(SkMask::Format format)
const SkPackedGlyphID fPackedID
static const char * begin(const StringSlice &s)
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
FlPixelBufferTexturePrivate * priv
uint32_t uint32_t * format
sk_sp< const SkImage > atlas
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
static void get_packed_glyph_image(const SkGlyph &glyph, int dstRB, MaskFormat expectedMaskFormat, void *dst)
static void expand_bits(INT_TYPE *dst, const uint8_t *src, int width, int height, int dstRowBytes, int srcRowBytes)
constexpr int MaskFormatBytesPerPixel(MaskFormat format)
static constexpr SkColorType MaskFormatToColorType(MaskFormat format)
static const int kMaskFormatCount
@ kA565
2-bytes per pixel, RGB represent 3-channel LCD coverage
@ kARGB
4-bytes per pixel, color format
skgpu::graphite::DrawAtlas DrawAtlas
constexpr int32_t width() const
constexpr int32_t height() const
@ kBW_Format
1bit per pixel mask (e.g. monochrome)