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

Unified Diff: printing/image_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
Index: printing/image_mac.cc
diff --git a/printing/image_mac.cc b/printing/image_mac.cc
index 423b1fcb5768e995f373c5748733ee37cf832a33..aa643de2cd66e3157fec0c45d2e16eeb1076c9d2 100644
--- a/printing/image_mac.cc
+++ b/printing/image_mac.cc
@@ -5,11 +5,13 @@
#include "printing/image.h"
#include <ApplicationServices/ApplicationServices.h>
+#include <CoreFoundation/CoreFoundation.h>
#include <stddef.h>
#include <stdint.h>
#include "base/mac/scoped_cftyperef.h"
#include "printing/metafile.h"
+#include "printing/pdf_metafile_cg_mac.h"
#include "ui/gfx/geometry/rect.h"
namespace printing {
@@ -39,12 +41,13 @@ bool Image::LoadMetafile(const Metafile& metafile) {
kCGImageAlphaPremultipliedLast));
DCHECK(bitmap_context.get());
- struct Metafile::MacRenderPageParams params;
+ struct PdfMetafileCg::RenderPageParams params;
params.shrink_to_fit = true;
- metafile.RenderPage(page_number, bitmap_context,
- CGRectMake(0, 0, size_.width(), size_.height()), params);
-
- return true;
+ CGRect cg_rect = CGRectMake(0, 0, size_.width(), size_.height());
+ std::vector<char> buffer;
+ return metafile.GetDataAsVector(&buffer) &&
+ PdfMetafileCg::RenderPage(buffer.data(), buffer.size(), page_number,
+ bitmap_context, cg_rect, params);
}
} // namespace printing

Powered by Google App Engine
This is Rietveld 408576698