diff options
author | sanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-29 21:39:45 +0000 |
---|---|---|
committer | sanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-29 21:39:45 +0000 |
commit | e6cddc57b52f1d9fc848d76f7b2825add49f62bd (patch) | |
tree | c430ba0ee3cfb943efc3d293ee91ca3353d1ff2e /printing/emf_win.cc | |
parent | 1c608a40c01d1529840126b0af6cdcea286949b1 (diff) | |
download | chromium_src-e6cddc57b52f1d9fc848d76f7b2825add49f62bd.zip chromium_src-e6cddc57b52f1d9fc848d76f7b2825add49f62bd.tar.gz chromium_src-e6cddc57b52f1d9fc848d76f7b2825add49f62bd.tar.bz2 |
Added methods to create and read from file-backed metafiles to the Windows Emf class.
BUG=None
TEST=Unittests
Review URL: http://codereview.chromium.org/3538003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60994 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing/emf_win.cc')
-rw-r--r-- | printing/emf_win.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/printing/emf_win.cc b/printing/emf_win.cc index aa1832b..de3b7db 100644 --- a/printing/emf_win.cc +++ b/printing/emf_win.cc @@ -4,6 +4,7 @@ #include "printing/emf_win.h" +#include "base/file_path.h" #include "base/histogram.h" #include "base/logging.h" #include "base/scoped_ptr.h" @@ -60,6 +61,16 @@ bool Emf::CreateDc(HDC sibling, const RECT* rect) { return hdc_ != NULL; } +bool Emf::CreateFileBackedDc(HDC sibling, const RECT* rect, + const FilePath& path) { + DCHECK(!emf_ && !hdc_); + DCHECK(!path.empty()); + hdc_ = CreateEnhMetaFile(sibling, path.value().c_str(), rect, NULL); + DCHECK(hdc_); + return hdc_ != NULL; +} + + bool Emf::CreateFromData(const void* buffer, uint32 size) { DCHECK(!emf_ && !hdc_); emf_ = SetEnhMetaFileBits(size, reinterpret_cast<const BYTE*>(buffer)); @@ -67,6 +78,14 @@ bool Emf::CreateFromData(const void* buffer, uint32 size) { return emf_ != NULL; } +bool Emf::CreateFromFile(const FilePath& metafile_path) { + DCHECK(!emf_ && !hdc_); + emf_ = GetEnhMetaFile(metafile_path.value().c_str()); + DCHECK(emf_); + return emf_ != NULL; +} + + bool Emf::CloseDc() { DCHECK(!emf_ && hdc_); emf_ = CloseEnhMetaFile(hdc_); |