21constexpr int kMinAtlasTextureSize = 512;
27 : fRecorder(recorder) {
39 const Rect& transformedShapeBounds,
65 return std::make_pair(
nullptr, std::nullopt);
68 std::optional<PathAtlas::MaskAndOrigin> atlasMask =
70 SkIPoint{(int) maskBounds.left(), (int) maskBounds.top()});
77 size_t plotWidth,
size_t plotHeight,
79 std::string_view label,
86 plotWidth, plotHeight,
96 for (
int i = 0;
i < fKeyLists.size(); ++
i) {
115 AtlasLocator* cachedLocator = fShapeCache.find(maskKey);
119 fDrawAtlas->setLastUseToken(*cachedLocator,
121 return fDrawAtlas->getProxies()[cachedLocator->
pageIndex()].get();
126 maskSize, outPos, &locator);
132 fShapeCache.set(maskKey, locator);
134 uint32_t index = shape_key_list_index(locator.
plotLocator(), fDrawAtlas.get());
135 ShapeKeyEntry* keyEntry =
new ShapeKeyEntry();
136 keyEntry->fKey = maskKey;
137 fKeyLists[index].addToTail(keyEntry);
156 iAtlasBounds.
width(),
168 if (!
all(maskSize)) {
169 fDrawAtlas->setLastUseToken(*locator,
171 return fDrawAtlas->getProxies()[locator->
pageIndex()].get();
174 if (!this->onAddToAtlas(shape,
transform, strokeRec, iShapeBounds, *locator)) {
178 fDrawAtlas->setLastUseToken(*locator,
181 return fDrawAtlas->getProxies()[locator->
pageIndex()].get();
185 return fDrawAtlas->recordUploads(dc, recorder);
190 uint32_t index = shape_key_list_index(plotLocator, fDrawAtlas.get());
192 iter.
init(fKeyLists[index], ShapeKeyList::Iter::kHead_IterStart);
193 ShapeKeyEntry* currEntry;
194 while ((currEntry = iter.
get())) {
196 fShapeCache.remove(currEntry->fKey);
197 fKeyLists[index].remove(currEntry);
@ kAlpha_8_SkColorType
pixel with alpha in 8-bit byte
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
SK_API int SkColorTypeBytesPerPixel(SkColorType ct)
static int SkPrevPow2(int value)
T * init(const SkTInternalLList &list, IterStart startLoc)
PlotLocator plotLocator() const
uint32_t pageIndex() const
uint32_t plotIndex() const
uint32_t pageIndex() const
AtlasToken nextFlushToken() const
bool allowMultipleAtlasTextures() const
int maxPathAtlasTextureSize() const
int maxTextureSize() const
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)
bool recordUploads(DrawContext *, Recorder *)
void evict(PlotLocator) override
const TextureProxy * addToAtlas(Recorder *recorder, const Shape &shape, const Transform &transform, const SkStrokeRec &strokeRec, skvx::half2 maskSize, skvx::half2 *outPos, AtlasLocator *locator)
DrawAtlasMgr(size_t width, size_t height, size_t plotWidth, size_t plotHeight, DrawAtlas::UseStorageTextures useStorageTextures, std::string_view label, const Caps *)
std::unique_ptr< DrawAtlas > fDrawAtlas
const TextureProxy * findOrCreateEntry(Recorder *recorder, const Shape &shape, const Transform &transform, const SkStrokeRec &strokeRec, skvx::half2 maskSize, skvx::half2 *outPos)
void postFlush(Recorder *)
virtual const TextureProxy * onAddShape(const Shape &, const Transform &transform, const SkStrokeRec &, skvx::half2 maskSize, skvx::half2 *outPos)=0
static constexpr int kEntryPadding
std::pair< const Renderer *, std::optional< MaskAndOrigin > > addShape(const Rect &transformedShapeBounds, const Shape &shape, const Transform &localToDevice, const SkStrokeRec &style)
PathAtlas(Recorder *recorder, uint32_t requestedWidth, uint32_t requestedHeight)
TokenTracker * tokenTracker()
const Caps * caps() const
const RendererProvider * rendererProvider() const
AI bool isEmptyNegativeOrNaN() const
AI Rect makeRoundOut() const
const Renderer * coverageMask() const
static float max(float r, float g, float b)
static float min(float r, float g, float b)
drawAtlas(r.atlas.get(), r.xforms, r.texs, r.colors, r.count, r.mode, r.sampling, r.cull, r.paint)) DRAW(DrawAnnotation
skgpu::UniqueKey GeneratePathMaskKey(const Shape &shape, const Transform &transform, const SkStrokeRec &strokeRec, skvx::half2 maskSize)
SIT bool all(const Vec< 1, T > &x)
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)
constexpr int32_t y() const
constexpr int32_t x() const
SkIRect makeOutset(int32_t dx, int32_t dy) const
constexpr int32_t height() const
constexpr int32_t width() const
static constexpr SkIRect MakeXYWH(int32_t x, int32_t y, int32_t w, int32_t h)