const SkMatrix* localMatrix, SkCopyPixelsMode,
SkTBlitterAllocator* alloc);
-// Call this if you explicitly want to use/share this pixelRef in the image
-extern sk_sp<SkImage> SkMakeImageFromPixelRef(const SkImageInfo&, SkPixelRef*,
- const SkIPoint& pixelRefOrigin,
- size_t rowBytes);
-
/**
* Examines the bitmap to decide if it can share the existing pixelRef, or
* if it needs to make a deep-copy of the pixels.
sk_sp<SkColorSpace>*) const override;
sk_sp<SkImage> onMakeSubset(const SkIRect&) const override;
- // exposed for SkSurface_Raster via SkNewImageFromPixelRef
- SkImage_Raster(const SkImageInfo&, SkPixelRef*, const SkIPoint& origin, size_t rowBytes);
-
SkPixelRef* getPixelRef() const { return fBitmap.pixelRef(); }
bool onAsLegacyBitmap(SkBitmap*, LegacyBitmapMode) const override;
fBitmap.lockPixels();
}
-SkImage_Raster::SkImage_Raster(const Info& info, SkPixelRef* pr, const SkIPoint& pixelRefOrigin,
- size_t rowBytes)
- : INHERITED(info.width(), info.height(), pr->getGenerationID())
-{
- fBitmap.setInfo(info, rowBytes);
- fBitmap.setPixelRef(sk_ref_sp(pr), pixelRefOrigin.x(), pixelRefOrigin.y());
- fBitmap.lockPixels();
- SkASSERT(fBitmap.isImmutable());
-}
-
SkImage_Raster::~SkImage_Raster() {
#if SK_SUPPORT_GPU
SkASSERT(nullptr == fPinnedTexture.get()); // want the caller to have manually unpinned
return sk_make_sp<SkImage_Raster>(pmap.info(), std::move(data), pmap.rowBytes(), pmap.ctable());
}
-sk_sp<SkImage> SkMakeImageFromPixelRef(const SkImageInfo& info, SkPixelRef* pr,
- const SkIPoint& pixelRefOrigin, size_t rowBytes) {
- if (!SkImage_Raster::ValidArgs(info, rowBytes, false, nullptr)) {
- return nullptr;
- }
- return sk_make_sp<SkImage_Raster>(info, pr, pixelRefOrigin, rowBytes);
-}
-
sk_sp<SkImage> SkMakeImageFromRasterBitmap(const SkBitmap& bm, SkCopyPixelsMode cpm,
SkTBlitterAllocator* allocator) {
bool hasColorTable = false;