diff options
Diffstat (limited to 'chromium/ui/gfx/image')
-rw-r--r-- | chromium/ui/gfx/image/OWNERS | 2 | ||||
-rw-r--r-- | chromium/ui/gfx/image/image_family_unittest.cc | 9 | ||||
-rw-r--r-- | chromium/ui/gfx/image/image_skia_rep_default.cc | 7 | ||||
-rw-r--r-- | chromium/ui/gfx/image/image_unittest.cc | 4 |
4 files changed, 8 insertions, 14 deletions
diff --git a/chromium/ui/gfx/image/OWNERS b/chromium/ui/gfx/image/OWNERS index 8e89a42a8c1..23dbb5a958f 100644 --- a/chromium/ui/gfx/image/OWNERS +++ b/chromium/ui/gfx/image/OWNERS @@ -2,5 +2,3 @@ rsesek@chromium.org # ImageSkia related classes except for _mac/_ios stuff per-file image_skia*=oshima@chromium.org - -# COMPONENT: UI>GFX diff --git a/chromium/ui/gfx/image/image_family_unittest.cc b/chromium/ui/gfx/image/image_family_unittest.cc index e3973d037ac..4bd2dc6f52c 100644 --- a/chromium/ui/gfx/image/image_family_unittest.cc +++ b/chromium/ui/gfx/image/image_family_unittest.cc @@ -221,15 +221,6 @@ TEST_F(ImageFamilyTest, CreateExact) { // Wider than widest image. EXPECT_IMAGE_SIZE(image_family_.CreateExact(255, 51), 255, 51); - - // CreateExact on an image family with a non-N32 color bitmap results in an - // empty image. - gfx::ImageFamily a8_family; - SkBitmap a8_bitmap; - SkImageInfo a8_info = SkImageInfo::MakeA8(64, 64); - a8_bitmap.allocPixels(a8_info); - a8_family.Add(gfx::Image::CreateFrom1xBitmap(a8_bitmap)); - EXPECT_TRUE(a8_family.CreateExact(32, 32).IsEmpty()); } // Test adding and looking up images with 0 width and height. diff --git a/chromium/ui/gfx/image/image_skia_rep_default.cc b/chromium/ui/gfx/image/image_skia_rep_default.cc index 8819dd4e13a..a8cbaf36e78 100644 --- a/chromium/ui/gfx/image/image_skia_rep_default.cc +++ b/chromium/ui/gfx/image/image_skia_rep_default.cc @@ -9,6 +9,7 @@ #include "cc/paint/display_item_list.h" #include "cc/paint/record_paint_canvas.h" #include "cc/paint/skia_paint_canvas.h" +#include "skia/ext/legacy_display_globals.h" #include "third_party/skia/include/core/SkCanvas.h" #include "ui/gfx/color_palette.h" @@ -32,6 +33,10 @@ ImageSkiaRep::ImageSkiaRep(const SkBitmap& src, float scale) pixel_size_(gfx::Size(src.width(), src.height())), bitmap_(src), scale_(scale) { + // If the bitmap has been initialized then it must be in N32 format. + if (!(bitmap_.isNull() && bitmap_.colorType() == kUnknown_SkColorType && + bitmap_.alphaType() == kUnknown_SkAlphaType)) + CHECK_EQ(bitmap_.colorType(), kN32_SkColorType); bitmap_.setImmutable(); paint_image_ = cc::PaintImage::CreateFromBitmap(src); } @@ -98,7 +103,7 @@ const SkBitmap& ImageSkiaRep::GetBitmap() const { // as it forces a rasterization on the UI thread. bitmap_.allocN32Pixels(pixel_width(), pixel_height()); bitmap_.eraseColor(SK_ColorTRANSPARENT); - SkCanvas canvas(bitmap_); + SkCanvas canvas(bitmap_, skia::LegacyDisplayGlobals::GetSkSurfaceProps()); paint_record_->Playback(&canvas); bitmap_.setImmutable(); } diff --git a/chromium/ui/gfx/image/image_unittest.cc b/chromium/ui/gfx/image/image_unittest.cc index 40354aea1a9..2f4f27693ce 100644 --- a/chromium/ui/gfx/image/image_unittest.cc +++ b/chromium/ui/gfx/image/image_unittest.cc @@ -437,7 +437,7 @@ TEST_F(ImageTest, SkBitmapConversionPreservesOrientation) { bitmap.eraseARGB(255, 0, 255, 0); // Paint the upper half of the image in red (lower half is in green). - SkCanvas canvas(bitmap); + SkCanvas canvas(bitmap, SkSurfaceProps{}); SkPaint red; red.setColor(SK_ColorRED); canvas.drawRect(SkRect::MakeWH(width, height / 2), red); @@ -478,7 +478,7 @@ TEST_F(ImageTest, SkBitmapConversionPreservesTransparency) { bitmap.eraseARGB(0, 0, 255, 0); // Paint the upper half of the image in red (lower half is transparent). - SkCanvas canvas(bitmap); + SkCanvas canvas(bitmap, SkSurfaceProps{}); SkPaint red; red.setColor(SK_ColorRED); canvas.drawRect(SkRect::MakeWH(width, height / 2), red); |