Commit e430fe112a6b54d9b5b9c24d838aef6b2a268b4b
1 parent
5f0157d9
Changes following "Added support for compressed texture upload to Render::NewTexture"
Change-Id: I3d25317e94d22389e94b4afd91bebedaca23b5b9
Showing
1 changed file
with
3 additions
and
3 deletions
examples/atlas/atlas-example.cpp
| @@ -203,15 +203,15 @@ private: | @@ -203,15 +203,15 @@ private: | ||
| 203 | PixelData CreatePixelData( const Vector3& color, const unsigned int width, const unsigned int height ) | 203 | PixelData CreatePixelData( const Vector3& color, const unsigned int width, const unsigned int height ) |
| 204 | { | 204 | { |
| 205 | unsigned int size = width*height; | 205 | unsigned int size = width*height; |
| 206 | - unsigned char* pixels = new unsigned char [size*3u]; | 206 | + unsigned int bufferSize = size * Pixel::GetBytesPerPixel(Pixel::RGB888); |
| 207 | + unsigned char* pixels = new unsigned char [bufferSize]; | ||
| 207 | for( unsigned int i = 0; i < size; i++ ) | 208 | for( unsigned int i = 0; i < size; i++ ) |
| 208 | { | 209 | { |
| 209 | pixels[i*3u] = 0xFF * color.x; | 210 | pixels[i*3u] = 0xFF * color.x; |
| 210 | pixels[i*3u+1u] = 0xFF * color.y; | 211 | pixels[i*3u+1u] = 0xFF * color.y; |
| 211 | pixels[i*3u+2u] = 0xFF * color.z; | 212 | pixels[i*3u+2u] = 0xFF * color.z; |
| 212 | } | 213 | } |
| 213 | - | ||
| 214 | - return PixelData::New( pixels, width, height, Pixel::RGB888, PixelData::DELETE_ARRAY ); | 214 | + return PixelData::New( pixels, bufferSize, width, height, Pixel::RGB888, PixelData::DELETE_ARRAY ); |
| 215 | } | 215 | } |
| 216 | 216 | ||
| 217 | 217 |