diff options
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_); |