@@ -113,10 +113,22 @@ public SKCodecResult GetPixels (SKImageInfo info, IntPtr pixels, int rowBytes, S
113113 if ( pixels == IntPtr . Zero )
114114 throw new ArgumentNullException ( nameof ( pixels ) ) ;
115115
116- var nOptions = SKCodecOptionsInternal . FromManaged ( ref options ) ;
117116 var nInfo = SKImageInfoNative . FromManaged ( ref info ) ;
118117
119- return SkiaApi . sk_codec_get_pixels ( Handle , ref nInfo , pixels , ( IntPtr ) rowBytes , ref nOptions ) ;
118+ unsafe {
119+ var nOptions = new SKCodecOptionsInternal {
120+ fZeroInitialized = options . ZeroInitialized ,
121+ fSubset = null ,
122+ fFrameIndex = options . FrameIndex ,
123+ fPriorFrame = options . PriorFrame ,
124+ fPremulBehavior = options . PremulBehavior ,
125+ } ;
126+ if ( options . HasSubset ) {
127+ var subset = options . Subset . Value ;
128+ nOptions . fSubset = & subset ;
129+ }
130+ return SkiaApi . sk_codec_get_pixels ( Handle , ref nInfo , pixels , ( IntPtr ) rowBytes , ref nOptions ) ;
131+ }
120132 }
121133
122134 [ Obsolete ( "The Index8 color type and color table is no longer supported. Use GetPixels(SKImageInfo, IntPtr, int, SKCodecOptions) instead." ) ]
@@ -176,10 +188,23 @@ public SKCodecResult StartIncrementalDecode (SKImageInfo info, IntPtr pixels, in
176188 if ( pixels == IntPtr . Zero )
177189 throw new ArgumentNullException ( nameof ( pixels ) ) ;
178190
179- var nOptions = SKCodecOptionsInternal . FromManaged ( ref options ) ;
180191 var nInfo = SKImageInfoNative . FromManaged ( ref info ) ;
181192
182- return SkiaApi . sk_codec_start_incremental_decode ( Handle , ref nInfo , pixels , ( IntPtr ) rowBytes , ref nOptions ) ;
193+ unsafe {
194+ var nOptions = new SKCodecOptionsInternal {
195+ fZeroInitialized = options . ZeroInitialized ,
196+ fSubset = null ,
197+ fFrameIndex = options . FrameIndex ,
198+ fPriorFrame = options . PriorFrame ,
199+ fPremulBehavior = options . PremulBehavior ,
200+ } ;
201+ if ( options . HasSubset ) {
202+ var subset = options . Subset . Value ;
203+ nOptions . fSubset = & subset ;
204+ }
205+
206+ return SkiaApi . sk_codec_start_incremental_decode ( Handle , ref nInfo , pixels , ( IntPtr ) rowBytes , ref nOptions ) ;
207+ }
183208 }
184209
185210 public SKCodecResult StartIncrementalDecode ( SKImageInfo info , IntPtr pixels , int rowBytes )
@@ -212,10 +237,23 @@ public SKCodecResult StartScanlineDecode (SKImageInfo info, SKCodecOptions optio
212237
213238 public SKCodecResult StartScanlineDecode ( SKImageInfo info , SKCodecOptions options )
214239 {
215- var nOptions = SKCodecOptionsInternal . FromManaged ( ref options ) ;
216240 var nInfo = SKImageInfoNative . FromManaged ( ref info ) ;
217241
218- return SkiaApi . sk_codec_start_scanline_decode ( Handle , ref nInfo , ref nOptions ) ;
242+ unsafe {
243+ var nOptions = new SKCodecOptionsInternal {
244+ fZeroInitialized = options . ZeroInitialized ,
245+ fSubset = null ,
246+ fFrameIndex = options . FrameIndex ,
247+ fPriorFrame = options . PriorFrame ,
248+ fPremulBehavior = options . PremulBehavior ,
249+ } ;
250+ if ( options . HasSubset ) {
251+ var subset = options . Subset . Value ;
252+ nOptions . fSubset = & subset ;
253+ }
254+
255+ return SkiaApi . sk_codec_start_scanline_decode ( Handle , ref nInfo , ref nOptions ) ;
256+ }
219257 }
220258
221259 public SKCodecResult StartScanlineDecode ( SKImageInfo info )
0 commit comments