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

Side by Side Diff: pdf/pdfium/pdfium_engine.cc

Issue 2746013008: Use FPDFPageObj_NewImageObj() instead of FPDFPageObj_NewImgeObj(). (Closed)
Patch Set: Created 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "pdf/pdfium/pdfium_engine.h" 5 #include "pdf/pdfium/pdfium_engine.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 1423 matching lines...) Expand 10 before | Expand all | Expand 10 after
1434 static_cast<unsigned char*>(FPDFBitmap_GetBuffer(bitmap)); 1434 static_cast<unsigned char*>(FPDFBitmap_GetBuffer(bitmap));
1435 double ratio_x = ConvertUnitDouble(bitmap_size.width(), 1435 double ratio_x = ConvertUnitDouble(bitmap_size.width(),
1436 print_settings.dpi, 1436 print_settings.dpi,
1437 kPointsPerInch); 1437 kPointsPerInch);
1438 double ratio_y = ConvertUnitDouble(bitmap_size.height(), 1438 double ratio_y = ConvertUnitDouble(bitmap_size.height(),
1439 print_settings.dpi, 1439 print_settings.dpi,
1440 kPointsPerInch); 1440 kPointsPerInch);
1441 1441
1442 // Add the bitmap to an image object and add the image object to the output 1442 // Add the bitmap to an image object and add the image object to the output
1443 // page. 1443 // page.
1444 FPDF_PAGEOBJECT temp_img = FPDFPageObj_NewImgeObj(temp_doc); 1444 FPDF_PAGEOBJECT temp_img = FPDFPageObj_NewImageObj(temp_doc);
1445 1445
1446 std::vector<uint8_t> compressed_bitmap_data; 1446 std::vector<uint8_t> compressed_bitmap_data;
1447 // Use quality = 40 as this does not significantly degrade the printed 1447 // Use quality = 40 as this does not significantly degrade the printed
1448 // document relative to a normal bitmap and provides better compression than 1448 // document relative to a normal bitmap and provides better compression than
1449 // a higher quality setting. 1449 // a higher quality setting.
1450 const int quality = 40; 1450 const int quality = 40;
1451 if (!(print_settings.format & PP_PRINTOUTPUTFORMAT_PDF) && 1451 if (!(print_settings.format & PP_PRINTOUTPUTFORMAT_PDF) &&
1452 (gfx::JPEGCodec::Encode( 1452 (gfx::JPEGCodec::Encode(
1453 bitmap_data, gfx::JPEGCodec::FORMAT_BGRA, FPDFBitmap_GetWidth(bitmap), 1453 bitmap_data, gfx::JPEGCodec::FORMAT_BGRA, FPDFBitmap_GetWidth(bitmap),
1454 FPDFBitmap_GetHeight(bitmap), FPDFBitmap_GetStride(bitmap), quality, 1454 FPDFBitmap_GetHeight(bitmap), FPDFBitmap_GetStride(bitmap), quality,
(...skipping 2744 matching lines...) Expand 10 before | Expand all | Expand 10 after
4199 FPDF_DOCUMENT doc = 4199 FPDF_DOCUMENT doc =
4200 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr); 4200 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr);
4201 if (!doc) 4201 if (!doc)
4202 return false; 4202 return false;
4203 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; 4203 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0;
4204 FPDF_CloseDocument(doc); 4204 FPDF_CloseDocument(doc);
4205 return success; 4205 return success;
4206 } 4206 }
4207 4207
4208 } // namespace chrome_pdf 4208 } // namespace chrome_pdf
OLDNEW
« 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