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

Unified Diff: pdf/pdfium/pdfium_engine.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
« no previous file with comments | « media/gpu/jpeg_decode_accelerator_unittest.cc ('k') | services/data_decoder/image_decoder_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pdf/pdfium/pdfium_engine.cc
diff --git a/pdf/pdfium/pdfium_engine.cc b/pdf/pdfium/pdfium_engine.cc
index 37c01618778ebd942421fbab1c4c6f6b8a3affcf..afc8b71633bcd2bbab24880da6b033316bfe63a9 100644
--- a/pdf/pdfium/pdfium_engine.cc
+++ b/pdf/pdfium/pdfium_engine.cc
@@ -1421,11 +1421,12 @@ FPDF_DOCUMENT PDFiumEngine::CreateSinglePageRasterPdf(
// document relative to a normal bitmap and provides better compression than
// a higher quality setting.
const int quality = 40;
+ SkImageInfo info = SkImageInfo::Make(
Lei Zhang 2017/06/16 21:22:37 We are doing a bit more work than before for a bra
+ FPDFBitmap_GetWidth(bitmap), FPDFBitmap_GetHeight(bitmap),
+ kBGRA_8888_SkColorType, kOpaque_SkAlphaType);
+ SkPixmap src(info, bitmap_data, FPDFBitmap_GetStride(bitmap));
if (!(print_settings.format & PP_PRINTOUTPUTFORMAT_PDF) &&
- (gfx::JPEGCodec::Encode(
- bitmap_data, gfx::JPEGCodec::FORMAT_BGRA, FPDFBitmap_GetWidth(bitmap),
- FPDFBitmap_GetHeight(bitmap), FPDFBitmap_GetStride(bitmap), quality,
- &compressed_bitmap_data))) {
+ (gfx::JPEGCodec::Encode(src, quality, &compressed_bitmap_data))) {
FPDF_FILEACCESS file_access = {};
file_access.m_FileLen =
static_cast<unsigned long>(compressed_bitmap_data.size());
« no previous file with comments | « media/gpu/jpeg_decode_accelerator_unittest.cc ('k') | services/data_decoder/image_decoder_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698