- atlasDescriptor.mTotalBlocks = ( width / blockWidth ) * ( height / blockHeight );
- atlasDescriptor.mAvailableBlocks = atlasDescriptor.mTotalBlocks - 1u;
- atlas.UploadedSignal().Connect( this, &AtlasManager::OnUpload );
-
- // What size do we need for this atlas' strip buffer ( assume 32bit pixel format )?
- SizeType neededStripSize =( blockWidth > blockHeight - DOUBLE_PIXEL_PADDING ? blockWidth : blockHeight - DOUBLE_PIXEL_PADDING ) << 2;
- atlasDescriptor.mStripBuffer = new PixelBuffer[ neededStripSize ];
- memset( atlasDescriptor.mStripBuffer, 0, neededStripSize );
-
- atlasDescriptor.mHorizontalStrip = BufferImage::New( atlasDescriptor.mStripBuffer,
- blockWidth,
- SINGLE_PIXEL_PADDING,
- pixelformat );
-
- atlasDescriptor.mVerticalStrip = BufferImage::New( atlasDescriptor.mStripBuffer,
- SINGLE_PIXEL_PADDING,
- blockHeight - DOUBLE_PIXEL_PADDING,
- pixelformat );
- mUploadedImages.PushBack( NULL );
- atlasDescriptor.mFilledPixelImage = BufferImage::New( reinterpret_cast< PixelBuffer* >( &mFilledPixel ), 1, 1, pixelformat );
- atlas.Upload( atlasDescriptor.mFilledPixelImage, 0, 0 );
+ atlasDescriptor.mTotalBlocks = ( ( width - 1u ) / blockWidth ) * ( ( height - 1u ) / blockHeight );
+ atlasDescriptor.mAvailableBlocks = atlasDescriptor.mTotalBlocks;
+
+ atlasDescriptor.mHorizontalStrip = BufferImage::New( blockWidth, SINGLE_PIXEL_PADDING, pixelformat );
+ atlasDescriptor.mVerticalStrip = BufferImage::New( SINGLE_PIXEL_PADDING, blockHeight - DOUBLE_PIXEL_PADDING, pixelformat );
+
+ memset( atlasDescriptor.mHorizontalStrip.GetBuffer(), 0, atlasDescriptor.mHorizontalStrip.GetBufferSize() );
+ memset( atlasDescriptor.mVerticalStrip.GetBuffer(), 0, atlasDescriptor.mVerticalStrip.GetBufferSize() );
+
+ BufferImage filledPixelImage = BufferImage::New( 1u, 1u, pixelformat );
+ memset( filledPixelImage.GetBuffer(), 0xFF, filledPixelImage.GetBufferSize() );
+ atlas.Upload( filledPixelImage, 0, 0 );