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

Unified Diff: printing/pdf_metafile_cg_mac.cc

Issue 2802093006: printing::Metafile: Simplify OS_MACOSX-specific code path (Closed)
Patch Set: vectoriz Created 3 years, 8 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 | « printing/pdf_metafile_cg_mac.h ('k') | printing/pdf_metafile_skia.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: printing/pdf_metafile_cg_mac.cc
diff --git a/printing/pdf_metafile_cg_mac.cc b/printing/pdf_metafile_cg_mac.cc
index 16744bfde6c702ab27c3e3fa91df1cde8bd6148f..898e795010052ebe85a5d8bc7bfde2fb6024fe09 100644
--- a/printing/pdf_metafile_cg_mac.cc
+++ b/printing/pdf_metafile_cg_mac.cc
@@ -157,11 +157,24 @@ bool PdfMetafileCg::FinishDocument() {
return true;
}
-bool PdfMetafileCg::RenderPage(unsigned int page_number,
+/* TODO(caryclark): The set up of PluginInstance::PrintPDFOutput may result in
+ rasterized output. Even if that flow uses PdfMetafileCg::RenderPage,
+ the drawing of the PDF into the canvas may result in a rasterized output.
+ PDFMetafileSkia::RenderPage should be not implemented as shown and instead
+ should do something like the following CL in PluginInstance::PrintPDFOutput:
+ http://codereview.chromium.org/7200040/diff/1/webkit/plugins/ppapi/ppapi_plugin_instance.cc
+*/
+bool PdfMetafileCg::RenderPage(const std::vector<char>& src_buffer,
+ unsigned int page_number,
CGContextRef context,
const CGRect rect,
- const MacRenderPageParams& params) const {
- CGPDFDocumentRef pdf_doc = GetPDFDocument();
+ const PdfMetafileCg::RenderPageParams& params) {
+ PdfMetafileCg metafile;
+ if (!metafile.InitFromData(src_buffer.data(), src_buffer.size())) {
+ LOG(ERROR) << "Unable to initialize PDF document from data";
+ return false;
+ }
+ CGPDFDocumentRef pdf_doc = metafile.GetPDFDocument();
if (!pdf_doc) {
LOG(ERROR) << "Unable to create PDF document from data";
return false;
« no previous file with comments | « printing/pdf_metafile_cg_mac.h ('k') | printing/pdf_metafile_skia.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698