From 9fc286c694089736ee8e7b740302dc4dd080a6aa Mon Sep 17 00:00:00 2001 From: "crogers@google.com" Date: Fri, 12 Jun 2009 19:04:32 +0000 Subject: Fix the bitmap class to zero out memory when it's allocated to avoid garbage on the screen Review URL: http://codereview.chromium.org/126018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18300 0039d316-1c4b-4281-b951-d872f2087c98 --- o3d/core/cross/bitmap.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'o3d/core') diff --git a/o3d/core/cross/bitmap.h b/o3d/core/cross/bitmap.h index dde6e5e..1d16d4f7 100644 --- a/o3d/core/cross/bitmap.h +++ b/o3d/core/cross/bitmap.h @@ -40,6 +40,8 @@ #ifndef O3D_CORE_CROSS_BITMAP_H_ #define O3D_CORE_CROSS_BITMAP_H_ +#include + #include "base/cross/bits.h" #include "core/cross/types.h" #include "core/cross/texture.h" @@ -118,9 +120,11 @@ class Bitmap { unsigned int num_mipmaps, bool cube_map); - // Allocates a bitmap with initialized paramters. + // Allocates a bitmap with initialized parameters. + // data is zero-initialized void AllocateData() { image_data_.reset(new unsigned char[GetTotalSize()]); + memset(image_data_.get(), 0, GetTotalSize()); } // Frees the data owned by the bitmap. -- cgit v1.1