39void ManagedBackendTexture::ReleaseProc(
void* ctx) {
40 std::unique_ptr<Context> context(
static_cast<Context*
>(ctx));
41 if (context->fWrappedProc) {
42 context->fWrappedProc(context->fWrappedContext);
46ManagedBackendTexture::~ManagedBackendTexture() {
55 SkASSERT(!wrappedCtx || wrappedProc);
59void* ManagedBackendTexture::MakeYUVAReleaseContext(
63 context->fMBETs[
i] = mbets[
i];
72void ManagedBackendTexture::wasAdopted() { fTexture = {}; }
79 return MakeWithoutData(dContext,
94 if (!
src.peekPixels(&srcPixmap)) {
98 return MakeFromPixmap(dContext, srcPixmap, mipmapped, renderable, isProtected);
106 std::vector<SkPixmap> levels({
src});
107 std::unique_ptr<SkMipmap> mm;
114 for (
int i = 0;
i < mm->countLevels(); ++
i) {
117 levels.push_back(
level.fPixmap);
122 static_cast<int>(levels.size()),
139 : fMBETs{tex, nullptr, nullptr, nullptr} {}
141 : fMBETs{mbets[0], mbets[1], mbets[2], mbets[3]} {}
149void ManagedGraphiteTexture::ReleaseProc(
void* ctx) {
150 std::unique_ptr<MBETContext> context(
static_cast<MBETContext*
>(ctx));
154 std::unique_ptr<MBETContext> context(
static_cast<MBETContext*
>(ctx));
156void ManagedGraphiteTexture::ImageReleaseProc(
void* ctx) {
157 std::unique_ptr<MBETContext> context(
static_cast<MBETContext*
>(ctx));
160ManagedGraphiteTexture::~ManagedGraphiteTexture() {
161 if (
fContext && fTexture.isValid()) {
162 fContext->deleteBackendTexture(fTexture);
166void* ManagedGraphiteTexture::releaseContext()
const {
167 return new MBETContext{{
sk_ref_sp(
this)}};
170void* ManagedGraphiteTexture::MakeYUVAReleaseContext(
172 return new MBETContext(mbets);
185 mbet->fContext = recorder->
priv().context();
194 if (!mbet->fTexture.isValid()) {
198 recorder->
addFinishInfo({mbet->releaseContext(), FinishedProc});
214 std::vector<SkPixmap> levels({
src});
215 std::unique_ptr<SkMipmap> mm;
222 for (
int i = 0;
i < mm->countLevels(); ++
i) {
225 levels.push_back(
level.fPixmap);
231 static_cast<int>(levels.size()))) {
243 if (levels.
empty()) {
253 static_cast<int>(levels.
size()))) {
268 mbet->fContext = recorder->
priv().context();
276 if (!mbet->fTexture.isValid()) {
280 recorder->
addFinishInfo({mbet->releaseContext(), FinishedProc});
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
@ kTopLeft_GrSurfaceOrigin
void * GrGpuFinishedContext
void(* GrGpuFinishedProc)(GrGpuFinishedContext finishedContext)
sk_sp< T > sk_ref_sp(T *obj)
GrDirectContext * fDContext
void deleteBackendTexture(const GrBackendTexture &)
static SkMipmap * Build(const SkPixmap &src, SkDiscardableFactoryProc, bool computeContents=true)
constexpr T * data() const
constexpr bool empty() const
constexpr size_t size() const
static constexpr int kMaxPlanes
void reset(T *ptr=nullptr)
static sk_sp< RefCntedCallback > Make(Callback proc, Context ctx)
virtual TextureInfo getDefaultCompressedTextureInfo(SkTextureCompressionType, Mipmapped mipmapped, Protected) const =0
virtual TextureInfo getDefaultSampledTextureInfo(SkColorType, Mipmapped mipmapped, Protected, Renderable) const =0
const Caps * caps() const
bool updateCompressedBackendTexture(const BackendTexture &, const void *data, size_t dataSize)
BackendTexture createBackendTexture(SkISize dimensions, const TextureInfo &)
void addFinishInfo(const InsertFinishInfo &)
bool updateBackendTexture(const BackendTexture &, const SkPixmap srcData[], int numLevels)
SK_API sk_sp< SkPixelRef > MakeWithData(const SkImageInfo &, size_t rowBytes, sk_sp< SkData > data)
sk_sp< SkImage > MakeFromBitmap(Recorder *recorder, const SkColorInfo &colorInfo, const SkBitmap &bitmap, sk_sp< SkMipmap > mipmaps, Budgeted budgeted, SkImage::RequiredProperties requiredProps, std::string_view label)
SkISize dimensions() const
SkColorType colorType() const