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

Unified Diff: ui/gfx/ipc/gfx_param_traits.cc

Issue 354483006: gfx: ipc: Remove deprecated calls from SkBitmap IPC traits (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/ipc/gfx_param_traits.cc
diff --git a/ui/gfx/ipc/gfx_param_traits.cc b/ui/gfx/ipc/gfx_param_traits.cc
index 245211982d55cf3664e476db53e094a7a7d44756..321f79a06ca1dad4b442a5cb1c6095cd5e638e2c 100644
--- a/ui/gfx/ipc/gfx_param_traits.cc
+++ b/ui/gfx/ipc/gfx_param_traits.cc
@@ -13,8 +13,11 @@
namespace {
struct SkBitmap_Data {
- // The configuration for the bitmap (bits per pixel, etc).
- SkBitmap::Config fConfig;
+ // The color type for the bitmap (bits per pixel, etc).
+ SkColorType fColorType;
+
+ // The alpha type for the bitmap (opaque, premul, unpremul).
+ SkAlphaType fAlphaType;
// The width of the bitmap in pixels.
uint32 fWidth;
@@ -23,22 +26,23 @@ struct SkBitmap_Data {
uint32 fHeight;
void InitSkBitmapDataForTransfer(const SkBitmap& bitmap) {
- fConfig = bitmap.config();
- fWidth = bitmap.width();
- fHeight = bitmap.height();
+ const SkImageInfo& info = bitmap.info();
+ fColorType = info.fColorType;
+ fAlphaType = info.fAlphaType;
+ fWidth = info.fWidth;
+ fHeight = info.fHeight;
}
// Returns whether |bitmap| successfully initialized.
- bool InitSkBitmapFromData(SkBitmap* bitmap, const char* pixels,
- size_t total_pixels) const {
- if (total_pixels) {
- bitmap->setConfig(fConfig, fWidth, fHeight, 0);
- if (!bitmap->allocPixels())
- return false;
- if (total_pixels != bitmap->getSize())
- return false;
- memcpy(bitmap->getPixels(), pixels, total_pixels);
- }
+ bool InitSkBitmapFromData(SkBitmap* bitmap,
+ const char* pixels,
+ size_t pixels_size) const {
+ if (!bitmap->allocPixels(
+ SkImageInfo::Make(fWidth, fHeight, fColorType, fAlphaType)))
+ return false;
+ if (pixels_size != bitmap->getSize())
+ return false;
+ memcpy(bitmap->getPixels(), pixels, pixels_size);
return true;
}
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698