class GrDirectContext; class GrRecordingContext; class SkColorSpace; class SkData; class SkPixmap; class SkSurface; enum SkColorType : int; struct SkIRect; struct SkImageInfo;
namespace skgpu { namespace graphite { class Recorder; } }
class SkImage_Raster : public SkImage_Base { public:
SkImage_Raster(const SkImageInfo&, sk_sp<SkData>, size_t rb,
uint32_t id = kNeedNewImageUniqueID);
SkImage_Raster(const SkBitmap& bm, bool bitmapMayBeMutable = false);
~SkImage_Raster() override;
void notifyAddedToRasterCache() const override { // We explicitly DON'T want to call INHERITED::notifyAddedToRasterCache. That ties the // lifetime of derived/cached resources to the image. In this case, we only want cached // data (eg mips) tied to the lifetime of the underlying pixelRef.
SkASSERT(fBitmap.pixelRef());
fBitmap.pixelRef()->notifyAddedToCache();
}
sk_sp<SkImage> onMakeWithMipmaps(sk_sp<SkMipmap> mips) const override { // It's dangerous to have two SkBitmaps that share a SkPixelRef but have different SkMipmaps // since various caches key on SkPixelRef's generation ID. Also, SkPixelRefs that back // SkSurfaces are marked "temporarily immutable" and making an image that uses the same // SkPixelRef can interact badly with SkSurface/SkImage copy-on-write. So we just always // make a copy with a new ID. staticauto constexpr kCopyMode = SkCopyPixelsMode::kAlways_SkCopyPixelsMode;
sk_sp<SkImage> img = SkMakeImageFromRasterBitmap(fBitmap, kCopyMode); auto imgRaster = static_cast<SkImage_Raster*>(img.get()); if (mips) {
imgRaster->fBitmap.fMips = std::move(mips);
} else {
imgRaster->fBitmap.fMips.reset(SkMipmap::Build(fBitmap.pixmap(), nullptr));
} return img;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.