Commit 252fa71d authored by mukai@chromium.org's avatar mukai@chromium.org

Fixes use-of-uninitialized-value MSan error in image_skia_unittest

The existing test code returns an empty ImageSkiaRep where
bytes are allocated but nothing is initialized. This was okay
because ImageSkiaTest doesn't touch the contents of the image.

Now ImageSkia can rescale the image data and such cases are
tested. So using a dummy ImageSkiaRep wouldn't be helthy.
Rather some data should be drawn.

BUG=373748
R=oshima@chromium.org
TEST=

Review URL: https://codereview.chromium.org/285393002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@270970 0039d316-1c4b-4281-b951-d872f2087c98
parent 59d7d518
...@@ -19,6 +19,7 @@ ImageSkiaRep::ImageSkiaRep(const gfx::Size& size, float scale) : scale_(scale) { ...@@ -19,6 +19,7 @@ ImageSkiaRep::ImageSkiaRep(const gfx::Size& size, float scale) : scale_(scale) {
static_cast<int>(size.width() * this->scale()), static_cast<int>(size.width() * this->scale()),
static_cast<int>(size.height() * this->scale())); static_cast<int>(size.height() * this->scale()));
bitmap_.allocPixels(); bitmap_.allocPixels();
bitmap_.eraseColor(SK_ColorRED);
} }
ImageSkiaRep::ImageSkiaRep(const SkBitmap& src, float scale) ImageSkiaRep::ImageSkiaRep(const SkBitmap& src, float scale)
......
...@@ -21,9 +21,9 @@ class GFX_EXPORT ImageSkiaRep { ...@@ -21,9 +21,9 @@ class GFX_EXPORT ImageSkiaRep {
~ImageSkiaRep(); ~ImageSkiaRep();
// Creates a bitmap with kARGB_8888_Config config with given |size| in DIP. // Creates a bitmap with kARGB_8888_Config config with given |size| in DIP.
// This allocates pixels in the bitmap. Specifying 0 scale means the image // This allocates pixels in the bitmap and fill the bitmap with a color.
// is for unscaled image. (unscaled() returns truen, and scale() returns // Specifying 0 scale means the image is for unscaled image. (unscaled()
// 1.0f;) // returns truen, and scale() returns 1.0f;)
ImageSkiaRep(const gfx::Size& size, float scale); ImageSkiaRep(const gfx::Size& size, float scale);
// Creates a bitmap with given scale. // Creates a bitmap with given scale.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment