sk_sp<SkImage> SkImage::MakeTextureFromPixmap(GrContext* ctx, const SkPixmap& pixmap, SkBudgeted budgeted) { if (!ctx) { return nullptr; } SkAutoTUnref<GrTexture> texture(GrUploadPixmapToTexture(ctx, pixmap, budgeted)); if (!texture) { return nullptr; } return sk_make_sp<SkImage_Gpu>(texture->width(), texture->height(), kNeedNewImageUniqueID, pixmap.alphaType(), texture, budgeted); }
sk_sp<SkImage> SkImage::MakeTextureFromPixmap(GrContext* ctx, const SkPixmap& pixmap, SkBudgeted budgeted) { if (!ctx) { return nullptr; } sk_sp<GrTexture> texture(GrUploadPixmapToTexture(ctx, pixmap, budgeted)); if (!texture) { return nullptr; } return sk_make_sp<SkImage_Gpu>(texture->width(), texture->height(), kNeedNewImageUniqueID, pixmap.alphaType(), std::move(texture), sk_ref_sp(pixmap.info().colorSpace()), budgeted); }