Skip to content

Commit

Permalink
CRITICAL: fixed two major bugs.
Browse files Browse the repository at this point in the history
First the resize passed the destination size as source and destinatin size.
Second: the internal IntPtr was not synced to the new byte[]

Terrain example and everything depending on this could never have worked like that...
  • Loading branch information
WolfgangSt committed Jun 24, 2011
1 parent 6007b35 commit fc0e2bb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Projects/Axiom/Engine/Media/Image.cs
Original file line number Diff line number Diff line change
Expand Up @@ -826,14 +826,14 @@ public void Resize( int width, int height, ImageFilter filter )

// reassign buffer to temp image, make sure auto-delete is true
Image temp = new Image();
temp.FromDynamicImage( buffer, width, height, 1, format );
temp.FromDynamicImage( buffer, this.width, this.height, 1, format );
// do not delete[] m_pBuffer! temp will destroy it

// set new dimensions, allocate new buffer
this.width = width;
this.height = height;
size = PixelUtil.GetMemorySize( Width, Height, 1, Format );
buffer = new byte[ size ];
SetBuffer( new byte[size] ); // AXIOM IMPORTANT: cant set buffer only as this wont sync the IntPtr!
numMipMaps = 0; // Loses precomputed mipmaps

// scale the image from temp into our resized buffer
Expand Down

0 comments on commit fc0e2bb

Please sign in to comment.