File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,17 +18,20 @@ namespace avif
1818// Struct to call the destroy functions in a unique_ptr.
1919struct UniquePtrDeleter
2020{
21- void operator ()(avifEncoder * encoder) const { avifEncoderDestroy (encoder); }
2221 void operator ()(avifDecoder * decoder) const { avifDecoderDestroy (decoder); }
23- void operator ()(avifImage * image ) const { avifImageDestroy (image ); }
22+ void operator ()(avifEncoder * encoder ) const { avifEncoderDestroy (encoder ); }
2423 void operator ()(avifGainMap * gainMap) const { avifGainMapDestroy (gainMap); }
24+ void operator ()(avifImage * image) const { avifImageDestroy (image); }
25+ void operator ()(avifRGBImage * image) const { avifRGBImageFreePixels (image); }
2526};
2627
2728// Use these unique_ptr to ensure the structs are automatically destroyed.
28- using EncoderPtr = std::unique_ptr<avifEncoder, UniquePtrDeleter>;
2929using DecoderPtr = std::unique_ptr<avifDecoder, UniquePtrDeleter>;
30- using ImagePtr = std::unique_ptr<avifImage , UniquePtrDeleter>;
30+ using EncoderPtr = std::unique_ptr<avifEncoder , UniquePtrDeleter>;
3131using GainMapPtr = std::unique_ptr<avifGainMap, UniquePtrDeleter>;
32+ using ImagePtr = std::unique_ptr<avifImage, UniquePtrDeleter>;
33+ // To use when RGBImage actually owns the pixels. RGBImage can also be used as a view, in which case it does not own the pixels.
34+ using RGBImagePtr = std::unique_ptr<avifRGBImage, UniquePtrDeleter>;
3235
3336} // namespace avif
3437
You can’t perform that action at this time.
0 commit comments