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

Unified Diff: printing/image_mac.cc

Issue 2812263002: clean up printing::Image and printing::Metafile (Closed)
Patch Set: definition matches declaration 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/image_linux.cc ('k') | printing/image_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: printing/image_mac.cc
diff --git a/printing/image_mac.cc b/printing/image_mac.cc
index 7edcfd7f0a07d9dbb464a90b2e8c890c6b7fcf03..695cc4534aec2814d0179cc3ab848c518203760c 100644
--- a/printing/image_mac.cc
+++ b/printing/image_mac.cc
@@ -10,13 +10,17 @@
#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 {
-bool Image::LoadMetafile(const Metafile& metafile) {
+bool Image::LoadMetafile(const void* metafile_src_buffer,
+ size_t metafile_src_buffer_size) {
+ PdfMetafileCg metafile;
+ if (!metafile.InitFromData(metafile_src_buffer, metafile_src_buffer_size)) {
+ return false;
+ }
// The printing system uses single-page metafiles (page indexes are 1-based).
const unsigned int page_number = 1;
gfx::Rect rect(metafile.GetPageBounds(page_number));
@@ -44,10 +48,7 @@ bool Image::LoadMetafile(const Metafile& metafile) {
PdfMetafileCg::RenderPageParams params;
params.shrink_to_fit = true;
CGRect cg_rect = CGRectMake(0, 0, size_.width(), size_.height());
- std::vector<char> buffer;
- return metafile.GetDataAsVector(&buffer) &&
- PdfMetafileCg::RenderPage(buffer, page_number, bitmap_context, cg_rect,
- params);
+ return metafile.OnRenderPage(page_number, bitmap_context, cg_rect, params);
}
} // namespace printing
« no previous file with comments | « printing/image_linux.cc ('k') | printing/image_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698