File tree Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -146,18 +146,20 @@ std::string ImageGrid::dump() const
146
146
ImageItem_Grid::ImageItem_Grid (HeifContext* ctx)
147
147
: ImageItem(ctx)
148
148
{
149
- auto * options = heif_encoding_options_alloc ();
150
- heif_encoding_options_copy (&m_encoding_options, options);
151
- heif_encoding_options_free (options);
149
+ m_encoding_options = heif_encoding_options_alloc ();
152
150
}
153
151
154
152
155
153
ImageItem_Grid::ImageItem_Grid (HeifContext* ctx, heif_item_id id)
156
154
: ImageItem(ctx, id)
157
155
{
158
- auto * options = heif_encoding_options_alloc ();
159
- heif_encoding_options_copy (&m_encoding_options, options);
160
- heif_encoding_options_free (options);
156
+ m_encoding_options = heif_encoding_options_alloc ();
157
+ }
158
+
159
+
160
+ ImageItem_Grid::~ImageItem_Grid ()
161
+ {
162
+ heif_encoding_options_free (m_encoding_options);
161
163
}
162
164
163
165
Original file line number Diff line number Diff line change @@ -80,6 +80,8 @@ class ImageItem_Grid : public ImageItem
80
80
81
81
ImageItem_Grid (HeifContext* ctx);
82
82
83
+ ~ImageItem_Grid () override ;
84
+
83
85
uint32_t get_infe_type () const override { return fourcc (" grid" ); }
84
86
85
87
static Result<std::shared_ptr<ImageItem_Grid>> add_new_grid_item (HeifContext* ctx,
@@ -113,10 +115,10 @@ class ImageItem_Grid : public ImageItem
113
115
int get_chroma_bits_per_pixel () const override ;
114
116
115
117
void set_encoding_options (const heif_encoding_options* options) {
116
- m_encoding_options = * options;
118
+ heif_encoding_options_copy ( m_encoding_options, options) ;
117
119
}
118
120
119
- const heif_encoding_options* get_encoding_options () const { return & m_encoding_options; }
121
+ const heif_encoding_options* get_encoding_options () const { return m_encoding_options; }
120
122
121
123
Result<Encoder::CodedImageData> encode (const std::shared_ptr<HeifPixelImage>& image,
122
124
struct heif_encoder * encoder,
@@ -155,7 +157,7 @@ class ImageItem_Grid : public ImageItem
155
157
ImageGrid m_grid_spec;
156
158
std::vector<heif_item_id> m_grid_tile_ids;
157
159
158
- heif_encoding_options m_encoding_options;
160
+ heif_encoding_options* m_encoding_options = nullptr ;
159
161
160
162
Error read_grid_spec ();
161
163
You can’t perform that action at this time.
0 commit comments