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

Unified Diff: printing/emf_win.cc

Issue 6611032: Unifying NativeMetafile class interface (as much as possible) for Linux, Mac, Win (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Restored pdf_ps_metafile_cairo.h class comment Created 9 years, 10 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
Index: printing/emf_win.cc
diff --git a/printing/emf_win.cc b/printing/emf_win.cc
index f2b22fa13f8b865b4c01924254fade83077b0a1b..88b1151fac5c98bd1b3350b887094eb488021ebe 100644
--- a/printing/emf_win.cc
+++ b/printing/emf_win.cc
@@ -50,7 +50,7 @@ Emf::Emf() : emf_(NULL), hdc_(NULL) {
}
Emf::~Emf() {
- CloseEmf();
+ Close();
DCHECK(!emf_ && !hdc_);
}
@@ -68,7 +68,8 @@ bool Emf::CreateDc(HDC sibling, const RECT* rect) {
return hdc_ != NULL;
}
-bool Emf::CreateFileBackedDc(HDC sibling, const RECT* rect,
+bool Emf::CreateFileBackedDc(HDC sibling,
+ const RECT* rect,
const FilePath& path) {
DCHECK(!emf_ && !hdc_);
DCHECK(!path.empty());
@@ -93,7 +94,7 @@ bool Emf::CloseDc() {
return emf_ != NULL;
}
-void Emf::CloseEmf() {
+void Emf::Close() {
DCHECK(!hdc_);
if (emf_) {
DeleteEnhMetaFile(emf_);
@@ -106,7 +107,7 @@ bool Emf::Playback(HDC hdc, const RECT* rect) const {
RECT bounds;
if (!rect) {
// Get the natural bounds of the EMF buffer.
- bounds = GetBounds().ToRECT();
+ bounds = GetPageBounds().ToRECT();
rect = &bounds;
}
return PlayEnhMetaFile(hdc, emf_, rect) != 0;
@@ -123,10 +124,14 @@ bool Emf::SafePlayback(HDC context) const {
emf_,
&Emf::SafePlaybackProc,
reinterpret_cast<void*>(&base_matrix),
- &GetBounds().ToRECT()) != 0;
+ &GetPageBounds().ToRECT()) != 0;
}
-gfx::Rect Emf::GetBounds() const {
+gfx::Rect Emf::GetPageBounds() const {
+ return GetPageBounds(1);
+}
+
+gfx::Rect Emf::GetPageBounds(unsigned int page_number) const {
DCHECK(emf_ && !hdc_);
ENHMETAHEADER header;
if (GetEnhMetaFileHeader(emf_, sizeof(header), &header) != sizeof(header)) {
@@ -173,8 +178,8 @@ bool Emf::GetData(std::vector<uint8>* buffer) const {
return true;
}
-bool Emf::SaveTo(const std::wstring& filename) const {
- HANDLE file = CreateFile(filename.c_str(), GENERIC_WRITE,
+bool Emf::SaveTo(const FilePath& file_path) const {
+ HANDLE file = CreateFile(file_path.value().c_str(), GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
CREATE_ALWAYS, 0, NULL);
if (file == INVALID_HANDLE_VALUE)
@@ -418,7 +423,7 @@ bool Emf::StartPage() {
reinterpret_cast<const BYTE *>(&record));
}
-bool Emf::EndPage() {
+bool Emf::FinishPage() {
DCHECK(hdc_);
if (!hdc_)
return false;

Powered by Google App Engine
This is Rietveld 408576698