Chromium Code Reviews| Index: cc/resources/ui_resource_bitmap.cc |
| diff --git a/cc/resources/ui_resource_bitmap.cc b/cc/resources/ui_resource_bitmap.cc |
| index 562e13a234ce09070aefac08791d994959e5d6b8..121be0c0d6490c2424bf89468ed32811da223c4e 100644 |
| --- a/cc/resources/ui_resource_bitmap.cc |
| +++ b/cc/resources/ui_resource_bitmap.cc |
| @@ -29,7 +29,7 @@ void UIResourceBitmap::Create(const skia::RefPtr<SkPixelRef>& pixel_ref, |
| } |
| UIResourceBitmap::UIResourceBitmap(const SkBitmap& skbitmap) { |
| - DCHECK_EQ(skbitmap.config(), SkBitmap::kARGB_8888_Config); |
| + DCHECK_EQ(skbitmap.colorType(), kPMColor_SkColorType); |
| DCHECK_EQ(skbitmap.width(), skbitmap.rowBytesAsPixels()); |
| DCHECK(skbitmap.isImmutable()); |
| @@ -41,6 +41,18 @@ UIResourceBitmap::UIResourceBitmap(const SkBitmap& skbitmap) { |
| SetOpaque(skbitmap.isOpaque()); |
| } |
| +UIResourceBitmap::UIResourceBitmap(int width, int height, bool isOpaque) { |
| + SkAlphaType alphaType = isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType; |
|
danakj
2014/03/25 16:13:59
alpha_type
|
| + SkImageInfo info = SkImageInfo::MakeN32(width, height, alphaType); |
| + skia::RefPtr<SkPixelRef> pixel_ref = skia::AdoptRef( |
| + SkMallocPixelRef::NewAllocate(info, info.minRowBytes(), NULL)); |
| + pixel_ref->setImmutable(); |
| + Create(pixel_ref, |
| + gfx::Size(info.width(), info.height()), |
| + UIResourceBitmap::RGBA8); |
| + SetOpaque(isOpaque); |
| +} |
| + |
| UIResourceBitmap::UIResourceBitmap(const skia::RefPtr<SkPixelRef>& pixel_ref, |
| gfx::Size size) { |
| Create(pixel_ref, size, UIResourceBitmap::ETC1); |