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

Unified Diff: components/user_manager/user_image/user_image.cc

Issue 2895953003: Use SkJpegEncoder in gfx jpeg_codec (Closed)
Patch Set: Remove brackets Created 3 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
Index: components/user_manager/user_image/user_image.cc
diff --git a/components/user_manager/user_image/user_image.cc b/components/user_manager/user_image/user_image.cc
index db293d53b30249a1bfa9cc8849b64a78e63933eb..55b76866169ac391764efde62f73eff282e80e5f 100644
--- a/components/user_manager/user_image/user_image.cc
+++ b/components/user_manager/user_image/user_image.cc
@@ -27,18 +27,13 @@ scoped_refptr<base::RefCountedBytes> UserImage::Encode(
TRACE_EVENT2("oobe", "UserImage::Encode",
"width", bitmap.width(), "height", bitmap.height());
std::vector<unsigned char> output;
- auto* bitmap_data = reinterpret_cast<unsigned char*>(bitmap.getAddr32(0, 0));
if (image_format == FORMAT_JPEG) {
- if (gfx::JPEGCodec::Encode(
- bitmap_data,
- gfx::JPEGCodec::FORMAT_SkBitmap,
- bitmap.width(),
- bitmap.height(),
- bitmap.width() * bitmap.bytesPerPixel(),
- kDefaultEncodingQuality, &output)) {
+ if (gfx::JPEGCodec::Encode(bitmap, kDefaultEncodingQuality, &output)) {
return base::RefCountedBytes::TakeVector(&output);
}
} else if (image_format == FORMAT_PNG) {
+ auto* bitmap_data =
+ reinterpret_cast<unsigned char*>(bitmap.getAddr32(0, 0));
if (gfx::PNGCodec::Encode(
bitmap_data,
gfx::PNGCodec::FORMAT_SkBitmap,

Powered by Google App Engine
This is Rietveld 408576698