mono / SkiaSharp

SkiaSharp is a cross-platform 2D graphics API for .NET platforms based on Google's Skia Graphics Library. It provides a comprehensive 2D API that can be used across mobile, server and desktop models to render images.
MIT License
4.4k stars 536 forks source link

[BUG] RowBytes in Bitmap does not update after subset #2719

Open gktval opened 8 months ago

gktval commented 8 months ago

Description

After subsetting a bitmap, the RowBytes in Bitmap remains unchanged at the initial bitmap size, The RowBytes in Bitmap.Info.RowBytes does get updated.

Code

//Perform subset of image
var srcRect = new SKRectI(10,10,50,50); // just for example
bitmap.ExtractSubset(output.Bitmap, srcRect);
Debug.Assert(bitmap.RowBytes == bitmap.Info.RowBytes);

Expected Behavior

I would expect the RowBytes to update after subsetting the image.

Actual Behavior

The RowBytes in Bitmap do not change.

Version of SkiaSharp

2.88.3 (Current)

Last Known Good Version of SkiaSharp

2.88.2 (Previous)

IDE / Editor

Visual Studio (Windows)

Platform / Operating System

All

Platform / Operating System Version

All

Devices

No response

Relevant Screenshots

No response

Relevant Log Output

No response

Code of Conduct

gktval commented 8 months ago

Seems like this is also affecting the byte array for the bitmap. Doing a save, then a decode on the image shows different lengths for the byte array.