remove (unused) DirectTo... methods
Change-Id: Ie5eea2902c64fc44e4e6e53b1ee3b869d430d482 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306331 Reviewed-by: Robert Phillips <robertphillips@google.com> Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
parent
39d1c1ebb6
commit
3a608e5bc9
@ -7,6 +7,9 @@ This file includes a list of high level updates for each milestone release.
|
|||||||
Milestone 86
|
Milestone 86
|
||||||
------------
|
------------
|
||||||
|
|
||||||
|
* SkImage:remove DecodeToRaster, DecodeToTexture
|
||||||
|
https://review.skia.org/306331
|
||||||
|
|
||||||
* Add GrContext api to update compressed backend textures.
|
* Add GrContext api to update compressed backend textures.
|
||||||
https://review.skia.org/302265
|
https://review.skia.org/302265
|
||||||
|
|
||||||
|
@ -210,55 +210,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
static sk_sp<SkImage> MakeFromEncoded(sk_sp<SkData> encoded);
|
static sk_sp<SkImage> MakeFromEncoded(sk_sp<SkData> encoded);
|
||||||
|
|
||||||
/**
|
|
||||||
* Decode the data in encoded/length into a raster image.
|
|
||||||
*
|
|
||||||
* The subset parameter specifies a area within the decoded image to create the image from.
|
|
||||||
* If subset is null, then the entire image is returned.
|
|
||||||
*
|
|
||||||
* This is similar to MakeFromEncoded, but this method will always decode immediately, and
|
|
||||||
* allocate the memory for the pixels for the lifetime of the returned image.
|
|
||||||
*
|
|
||||||
* If the encoded format is not supported, or subset is outside of the bounds of the decoded
|
|
||||||
* image, nullptr is returned.
|
|
||||||
*
|
|
||||||
* @param encoded the encoded data
|
|
||||||
* @param length the number of bytes of encoded data
|
|
||||||
* @param subset the bounds of the pixels within the decoded image to return. may be null.
|
|
||||||
* @return created SkImage, or nullptr
|
|
||||||
*/
|
|
||||||
static sk_sp<SkImage> DecodeToRaster(const void* encoded, size_t length,
|
|
||||||
const SkIRect* subset = nullptr);
|
|
||||||
static sk_sp<SkImage> DecodeToRaster(const sk_sp<SkData>& data,
|
|
||||||
const SkIRect* subset = nullptr) {
|
|
||||||
return DecodeToRaster(data->data(), data->size(), subset);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Decode the data in encoded/length into a texture-backed image.
|
|
||||||
*
|
|
||||||
* The subset parameter specifies a area within the decoded image to create the image from.
|
|
||||||
* If subset is null, then the entire image is returned.
|
|
||||||
*
|
|
||||||
* This is similar to MakeFromEncoded, but this method will always decode immediately, and
|
|
||||||
* allocate the texture for the pixels for the lifetime of the returned image.
|
|
||||||
*
|
|
||||||
* If the encoded format is not supported, or subset is outside of the bounds of the decoded
|
|
||||||
* image, nullptr is returned.
|
|
||||||
*
|
|
||||||
* @param direct the GrDirectContext in play
|
|
||||||
* @param encoded the encoded data
|
|
||||||
* @param length the number of bytes of encoded data
|
|
||||||
* @param subset the bounds of the pixels within the decoded image to return. may be null.
|
|
||||||
* @return created SkImage, or nullptr
|
|
||||||
*/
|
|
||||||
static sk_sp<SkImage> DecodeToTexture(GrDirectContext* direct, const void* encoded,
|
|
||||||
size_t length, const SkIRect* subset = nullptr);
|
|
||||||
static sk_sp<SkImage> DecodeToTexture(GrDirectContext* direct, const sk_sp<SkData>& data,
|
|
||||||
const SkIRect* subset = nullptr) {
|
|
||||||
return DecodeToTexture(direct, data->data(), data->size(), subset);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Experimental:
|
* Experimental:
|
||||||
* Skia | GL_COMPRESSED_* | MTLPixelFormat* | VK_FORMAT_*_BLOCK
|
* Skia | GL_COMPRESSED_* | MTLPixelFormat* | VK_FORMAT_*_BLOCK
|
||||||
|
@ -542,10 +542,6 @@ sk_sp<SkImage> SkImage::makeRasterImage(CachingHint chint) const {
|
|||||||
|
|
||||||
#if !SK_SUPPORT_GPU
|
#if !SK_SUPPORT_GPU
|
||||||
|
|
||||||
sk_sp<SkImage> SkImage::DecodeToTexture(GrDirectContext*, const void*, size_t, const SkIRect*) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
sk_sp<SkImage> SkImage::MakeFromTexture(GrContext* ctx,
|
sk_sp<SkImage> SkImage::MakeFromTexture(GrContext* ctx,
|
||||||
const GrBackendTexture& tex, GrSurfaceOrigin origin,
|
const GrBackendTexture& tex, GrSurfaceOrigin origin,
|
||||||
SkColorType ct, SkAlphaType at, sk_sp<SkColorSpace> cs,
|
SkColorType ct, SkAlphaType at, sk_sp<SkColorSpace> cs,
|
||||||
|
@ -300,44 +300,6 @@ sk_sp<SkImage> SkImage::MakeFromGenerator(std::unique_ptr<SkImageGenerator> gene
|
|||||||
return validator ? sk_make_sp<SkImage_Lazy>(&validator) : nullptr;
|
return validator ? sk_make_sp<SkImage_Lazy>(&validator) : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
sk_sp<SkImage> SkImage::DecodeToRaster(const void* encoded, size_t length, const SkIRect* subset) {
|
|
||||||
// The generator will not outlive this function, so we can wrap the encoded data without copy
|
|
||||||
auto gen = SkImageGenerator::MakeFromEncoded(SkData::MakeWithoutCopy(encoded, length));
|
|
||||||
if (!gen) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
SkImageInfo info = gen->getInfo();
|
|
||||||
if (info.isEmpty()) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
SkIPoint origin = {0, 0};
|
|
||||||
if (subset) {
|
|
||||||
if (!SkIRect::MakeWH(info.width(), info.height()).contains(*subset)) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
info = info.makeDimensions(subset->size());
|
|
||||||
origin = {subset->x(), subset->y()};
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t rb = info.minRowBytes();
|
|
||||||
if (rb == 0) {
|
|
||||||
return nullptr; // rb was too big
|
|
||||||
}
|
|
||||||
size_t size = info.computeByteSize(rb);
|
|
||||||
if (size == SIZE_MAX) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
auto data = SkData::MakeUninitialized(size);
|
|
||||||
|
|
||||||
SkPixmap pmap(info, data->writable_data(), rb);
|
|
||||||
if (!generate_pixels(gen.get(), pmap, origin.x(), origin.y())) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return SkImage::MakeRasterData(info, data, rb);
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#if SK_SUPPORT_GPU
|
#if SK_SUPPORT_GPU
|
||||||
@ -655,27 +617,8 @@ GrColorType SkImage_Lazy::colorTypeOfLockTextureProxy(const GrCaps* caps) const
|
|||||||
return ct;
|
return ct;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if SK_SUPPORT_GPU
|
|
||||||
void SkImage_Lazy::addUniqueIDListener(sk_sp<SkIDChangeListener> listener) const {
|
void SkImage_Lazy::addUniqueIDListener(sk_sp<SkIDChangeListener> listener) const {
|
||||||
bool singleThreaded = this->unique();
|
bool singleThreaded = this->unique();
|
||||||
fUniqueIDListeners.add(std::move(listener), singleThreaded);
|
fUniqueIDListeners.add(std::move(listener), singleThreaded);
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
sk_sp<SkImage> SkImage::DecodeToTexture(GrDirectContext* direct, const void* encoded,
|
|
||||||
size_t length, const SkIRect* subset) {
|
|
||||||
// img will not survive this function, so we don't need to copy/own the encoded data,
|
|
||||||
auto img = MakeFromEncoded(SkData::MakeWithoutCopy(encoded, length));
|
|
||||||
if (!img) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
img = img->makeTextureImage(direct);
|
|
||||||
if (img && subset) {
|
|
||||||
img = img->makeSubset(*subset, direct);
|
|
||||||
}
|
|
||||||
return img;
|
|
||||||
}
|
|
||||||
#endif // SK_SUPPORT_GPU
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user