summaryrefslogtreecommitdiffstats
path: root/chrome/utility
diff options
context:
space:
mode:
authorvandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-18 05:45:51 +0000
committervandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-18 05:45:51 +0000
commitf2da4b06dd189750cf2cd1db687b1106dce38ee8 (patch)
tree331027ffd36e5ffd618892e75b78abfedb627028 /chrome/utility
parentc8477a432601854d4e8e85a85cbbbf79af723ad2 (diff)
downloadchromium_src-f2da4b06dd189750cf2cd1db687b1106dce38ee8.zip
chromium_src-f2da4b06dd189750cf2cd1db687b1106dce38ee8.tar.gz
chromium_src-f2da4b06dd189750cf2cd1db687b1106dce38ee8.tar.bz2
Revert 78666 - Cleanup NativeMetafile (win) interface and EMF class.
- Rename CreateDc to Init() and remove unused argument (all non-test calls were CreateDc(NULL, NULL). [This matches cross platform interface.] - Remove CreateFileBackedDc from the NativeMetafile interface and make InitToFile() in the EMF class. - Remove CreateFromFile from the NativeMetafile interface and make it InitFromFile() in the EMF class. - Move the CloseEmf method into the destructor, making the Emf class a use once class (matches actual use). BUG=NONE TEST=NONE Review URL: http://codereview.chromium.org/6695013 TBR=vandebo@chromium.org Review URL: http://codereview.chromium.org/6712030 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78669 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/utility')
-rw-r--r--chrome/utility/utility_thread.cc20
1 files changed, 11 insertions, 9 deletions
diff --git a/chrome/utility/utility_thread.cc b/chrome/utility/utility_thread.cc
index 9fc175c6..7b665ae 100644
--- a/chrome/utility/utility_thread.cc
+++ b/chrome/utility/utility_thread.cc
@@ -30,7 +30,8 @@
#include "app/win/iat_patch_function.h"
#include "base/scoped_ptr.h"
#include "base/win/scoped_handle.h"
-#include "printing/emf_win.h"
+#include "printing/native_metafile_factory.h"
+#include "printing/native_metafile.h"
#endif
namespace {
@@ -256,17 +257,18 @@ bool UtilityThread::RenderPDFToWinMetafile(
if (!get_info_proc(&buffer.front(), buffer.size(), &total_page_count, NULL))
return false;
- printing::Emf metafile;
- metafile.InitToFile(metafile_path);
+ scoped_ptr<printing::NativeMetafile> metafile(
+ printing::NativeMetafileFactory::CreateMetafile());
+ metafile->CreateFileBackedDc(NULL, NULL, metafile_path);
// Since we created the metafile using the screen DPI (but we actually want
// the PDF DLL to print using the passed in render_dpi, we apply the following
// transformation.
- SetGraphicsMode(metafile.context(), GM_ADVANCED);
+ SetGraphicsMode(metafile->context(), GM_ADVANCED);
XFORM xform = {0};
int screen_dpi = GetDeviceCaps(GetDC(NULL), LOGPIXELSX);
xform.eM11 = xform.eM22 =
static_cast<float>(screen_dpi) / static_cast<float>(render_dpi);
- ModifyWorldTransform(metafile.context(), &xform, MWT_LEFTMULTIPLY);
+ ModifyWorldTransform(metafile->context(), &xform, MWT_LEFTMULTIPLY);
bool ret = false;
std::vector<printing::PageRange>::const_iterator iter;
@@ -274,18 +276,18 @@ bool UtilityThread::RenderPDFToWinMetafile(
for (int page_number = iter->from; page_number <= iter->to; ++page_number) {
if (page_number >= total_page_count)
break;
- metafile.StartPage();
+ metafile->StartPage();
if (render_proc(&buffer.front(), buffer.size(), page_number,
- metafile.context(), render_dpi, render_dpi,
+ metafile->context(), render_dpi, render_dpi,
render_area.x(), render_area.y(), render_area.width(),
render_area.height(), true, false, true, true))
if (*highest_rendered_page_number < page_number)
*highest_rendered_page_number = page_number;
ret = true;
- metafile.FinishPage();
+ metafile->FinishPage();
}
}
- metafile.Close();
+ metafile->Close();
return ret;
}
#endif // defined(OS_WIN)