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

Unified Diff: printing/printed_document_mac.cc

Issue 2802093006: printing::Metafile: Simplify OS_MACOSX-specific code path (Closed)
Patch Set: 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
« printing/pdf_metafile_cg_mac_unittest.cc ('K') | « printing/pdf_metafile_skia.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: printing/printed_document_mac.cc
diff --git a/printing/printed_document_mac.cc b/printing/printed_document_mac.cc
index 73286966f993986daba7c976d96427e62c0cb7ad..faa221b8d4ef8b85335d579a62096209f0ae5567 100644
--- a/printing/printed_document_mac.cc
+++ b/printing/printed_document_mac.cc
@@ -4,11 +4,12 @@
#include "printing/printed_document.h"
-#import <ApplicationServices/ApplicationServices.h>
-#import <CoreFoundation/CoreFoundation.h>
+#include <ApplicationServices/ApplicationServices.h>
Lei Zhang 2017/04/08 01:24:25 BTW, I'm clueless about #import vs #include, so ma
hal.canary 2017/04/11 19:07:27 Acknowledged.
+#include <CoreFoundation/CoreFoundation.h>
#include "base/logging.h"
#include "printing/page_number.h"
+#include "printing/pdf_metafile_cg_mac.h"
#include "printing/printed_page.h"
namespace printing {
@@ -31,11 +32,16 @@ void PrintedDocument::RenderPrintedPage(
page.GetCenteredPageContentRect(page_setup.physical_size(), &content_area);
const MetafilePlayer* metafile = page.metafile();
+
// Each Metafile is a one-page PDF, and pages use 1-based indexing.
const int page_number = 1;
- struct Metafile::MacRenderPageParams params;
+ struct PdfMetafileCg::RenderPageParams params;
Lei Zhang 2017/04/08 01:24:25 I think you can omit the struct keyword.
hal.canary 2017/04/11 19:07:27 Done.
params.autorotate = true;
- metafile->RenderPage(page_number, context, content_area.ToCGRect(), params);
+ std::vector<char> buffer;
+ if (metafile->GetDataAsVector(&buffer)) {
+ PdfMetafileCg::RenderPage(buffer.data(), buffer.size(), page_number,
+ context, content_area.ToCGRect(), params);
+ }
}
} // namespace printing
« printing/pdf_metafile_cg_mac_unittest.cc ('K') | « printing/pdf_metafile_skia.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698