expose clear way to create default mips
Change-Id: Id533b71d56fc44d8f86db24c5c4e9131d57479a5 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/316716 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
parent
582c5a9a84
commit
186866c461
@ -1174,6 +1174,12 @@ public:
|
||||
*/
|
||||
sk_sp<SkImage> withMipmaps(sk_sp<SkMipmap> data) const;
|
||||
|
||||
/**
|
||||
* Returns an image with the same "base" pixels as the this image, but with mipmap levels
|
||||
* automatically generated and attached.
|
||||
*/
|
||||
sk_sp<SkImage> withDefaultMipmaps() const;
|
||||
|
||||
/** Returns SkImage backed by GPU texture associated with context. Returned SkImage is
|
||||
compatible with SkSurface created with dstColorSpace. The returned SkImage respects
|
||||
mipMapped setting; if mipMapped equals GrMipmapped::kYes, the backing texture
|
||||
|
@ -669,3 +669,7 @@ sk_sp<SkImage> SkImage::withMipmaps(sk_sp<SkMipmap> mips) const {
|
||||
}
|
||||
return sk_ref_sp((const_cast<SkImage*>(this)));
|
||||
}
|
||||
|
||||
sk_sp<SkImage> SkImage::withDefaultMipmaps() const {
|
||||
return this->withMipmaps(nullptr);
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ DEF_TEST(image_mip_factory, reporter) {
|
||||
auto img = GetResourceAsImage("images/mandrill_128.png")->makeRasterImage();
|
||||
|
||||
REPORTER_ASSERT(reporter, !img->hasMipmaps());
|
||||
auto img1 = img->withMipmaps(nullptr);
|
||||
auto img1 = img->withDefaultMipmaps();
|
||||
REPORTER_ASSERT(reporter, img.get() != img1.get());
|
||||
REPORTER_ASSERT(reporter, img1->hasMipmaps());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user