31 : fPrevious(
previous), fRectanizer(rectanizer), fX(
x), fY(
y) {}
37 if (w < fRectanizer->
width()) {
40 if (h < fRectanizer->
height()) {
52 Node*
const fPrevious;
81 , fInternalMultisample(internalMultisample)
82 , fMaxAtlasSize(maxAtlasSize)
83 , fRectanizerAlgorithm(algorithm) {
85 this->
reset(initialSize, caps);
92 fNodeAllocator.
reset();
99 if (!fBackingTexture) {
114 fBackingTexture =
nullptr;
123 return fNodeAllocator.
make<
Node>(previous, rectanizer, l, t);
140 if (!this->internalPlaceRect(
width,
height, location)) {
149bool GrDynamicAtlas::internalPlaceRect(
int w,
int h,
SkIPoint16* loc) {
165 fTopNode = this->makeNode(
nullptr, 0, 0, fWidth, fHeight);
168 for (
Node* node = fTopNode; node; node = node->previous()) {
169 if (node->addRect(
w,
h, loc)) {
176 if (fWidth >= fMaxAtlasSize && fHeight >= fMaxAtlasSize) {
179 if (fHeight <= fWidth) {
181 fHeight =
std::min(fHeight * 2, fMaxAtlasSize);
182 fTopNode = this->makeNode(fTopNode, 0, top, fWidth, fHeight);
185 fWidth =
std::min(fWidth * 2, fMaxAtlasSize);
186 fTopNode = this->makeNode(fTopNode,
left, 0, fWidth, fHeight);
199 SkASSERT(fMaxAtlasSize <= onFlushRP->caps()->maxRenderTargetSize());
208 if (backingTexture) {
218 fBackingTexture = std::move(backingTexture);
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
static int SkNextPow2(int value)
static bool left(const SkPoint &p0, const SkPoint &p1)
virtual skgpu::Swizzle getWriteSwizzle(const GrBackendFormat &, GrColorType) const =0
int maxTextureSize() const
GrBackendFormat getDefaultBackendFormat(GrColorType, GrRenderable) const
int internalMultisampleCount(const GrBackendFormat &format) const
skgpu::Swizzle getReadSwizzle(const GrBackendFormat &format, GrColorType colorType) const
Node(Node *previous, Rectanizer *rectanizer, int x, int y)
bool addRect(int w, int h, SkIPoint16 *loc)
virtual ~GrDynamicAtlas()
GrColorType colorType() const
GrSurfaceProxyView writeView(const GrCaps &) const
static constexpr GrSurfaceOrigin kTextureOrigin
static constexpr int kPadding
bool instantiate(GrOnFlushResourceProvider *, sk_sp< GrTexture > backingTexture=nullptr)
GrSurfaceProxy::LazyInstantiateCallback LazyInstantiateAtlasCallback
GrDynamicAtlas(GrColorType colorType, InternalMultisample, SkISize initialSize, int maxAtlasSize, const GrCaps &, RectanizerAlgorithm=RectanizerAlgorithm::kSkyline)
static sk_sp< GrTextureProxy > MakeLazyAtlasProxy(LazyInstantiateAtlasCallback &&, GrColorType colorType, InternalMultisample, const GrCaps &, GrSurfaceProxy::UseAllocator)
bool addRect(int width, int height, SkIPoint16 *location)
bool isInstantiated() const
GrSurfaceProxyView readView(const GrCaps &) const
void reset(SkISize initialSize, const GrCaps &desc)
bool instantiateProxy(GrSurfaceProxy *)
static sk_sp< GrTextureProxy > MakeFullyLazyProxy(LazyInstantiateCallback &&, const GrBackendFormat &, GrRenderable, int renderTargetSampleCnt, GrProtected, const GrCaps &, UseAllocator)
sk_sp< GrTexture > createTexture(SkISize dimensions, const GrBackendFormat &format, GrTextureType textureType, skgpu::Renderable renderable, int renderTargetSampleCnt, skgpu::Mipmapped mipmapped, skgpu::Budgeted budgeted, skgpu::Protected isProtected, std::string_view label)
void setLazyDimensions(SkISize dimensions)
SkISize backingStoreDimensions() const
virtual GrRenderTargetProxy * asRenderTargetProxy()
const GrBackendFormat & backendFormat() const
GrSurfaceProxyPriv priv()
SkISize dimensions() const
virtual GrRenderTarget * asRenderTarget()
auto make(Ctor &&ctor) -> decltype(ctor(nullptr))
virtual bool addRect(int width, int height, SkIPoint16 *loc)=0
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
uint32_t uint32_t * format
static float max(float r, float g, float b)
static float min(float r, float g, float b)
int16_t fY
y-axis value used by SkIPoint16
int16_t fX
x-axis value used by SkIPoint16
constexpr int32_t width() const
constexpr int32_t height() const