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

Unified Diff: printing/emf_win.cc

Issue 6695013: Cleanup NativeMetafile (win) interface and EMF class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 9 years, 9 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/emf_win.h ('k') | printing/emf_win_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: printing/emf_win.cc
diff --git a/printing/emf_win.cc b/printing/emf_win.cc
index 8609c34702da403d3bde2d55bcc7c5ae7d23136e..c411a4019b4d0befd44d8dfddf1dec75529ad476 100644
--- a/printing/emf_win.cc
+++ b/printing/emf_win.cc
@@ -53,41 +53,39 @@ Emf::Emf() : emf_(NULL), hdc_(NULL) {
}
Emf::~Emf() {
- CloseEmf();
- DCHECK(!emf_ && !hdc_);
+ DCHECK(!hdc_);
+ if (emf_)
+ DeleteEnhMetaFile(emf_);
}
-bool Emf::InitFromData(const void* src_buffer, uint32 src_buffer_size) {
+bool Emf::InitToFile(const FilePath& metafile_path) {
DCHECK(!emf_ && !hdc_);
- emf_ = SetEnhMetaFileBits(src_buffer_size,
- reinterpret_cast<const BYTE*>(src_buffer));
- return emf_ != NULL;
+ hdc_ = CreateEnhMetaFile(NULL, metafile_path.value().c_str(), NULL, NULL);
+ DCHECK(hdc_);
+ return hdc_ != NULL;
}
-bool Emf::CreateDc(HDC sibling, const RECT* rect) {
+bool Emf::InitFromFile(const FilePath& metafile_path) {
DCHECK(!emf_ && !hdc_);
- hdc_ = CreateEnhMetaFile(sibling, NULL, rect, NULL);
- DCHECK(hdc_);
- return hdc_ != NULL;
+ emf_ = GetEnhMetaFile(metafile_path.value().c_str());
+ DCHECK(emf_);
+ return emf_ != NULL;
}
-bool Emf::CreateFileBackedDc(HDC sibling, const RECT* rect,
- const FilePath& path) {
+bool Emf::Init() {
DCHECK(!emf_ && !hdc_);
- DCHECK(!path.empty());
- hdc_ = CreateEnhMetaFile(sibling, path.value().c_str(), rect, NULL);
+ hdc_ = CreateEnhMetaFile(NULL, NULL, NULL, NULL);
DCHECK(hdc_);
return hdc_ != NULL;
}
-bool Emf::CreateFromFile(const FilePath& metafile_path) {
+bool Emf::InitFromData(const void* src_buffer, uint32 src_buffer_size) {
DCHECK(!emf_ && !hdc_);
- emf_ = GetEnhMetaFile(metafile_path.value().c_str());
- DCHECK(emf_);
+ emf_ = SetEnhMetaFileBits(src_buffer_size,
+ reinterpret_cast<const BYTE*>(src_buffer));
return emf_ != NULL;
}
-
bool Emf::FinishDocument() {
DCHECK(!emf_ && hdc_);
emf_ = CloseEnhMetaFile(hdc_);
@@ -96,14 +94,6 @@ bool Emf::FinishDocument() {
return emf_ != NULL;
}
-void Emf::CloseEmf() {
- DCHECK(!hdc_);
- if (emf_) {
- DeleteEnhMetaFile(emf_);
- emf_ = NULL;
- }
-}
-
bool Emf::Playback(HDC hdc, const RECT* rect) const {
DCHECK(emf_ && !hdc_);
RECT bounds;
« no previous file with comments | « printing/emf_win.h ('k') | printing/emf_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698