Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2849)

Unified Diff: cc/resources/ui_resource_bitmap.cc

Issue 197883017: SkColorType instead of (deprecated) SkBitmap::Config (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);

Powered by Google App Engine
This is Rietveld 408576698