diff options
author | dpapad@chromium.org <dpapad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-16 01:39:42 +0000 |
---|---|---|
committer | dpapad@chromium.org <dpapad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-16 01:39:42 +0000 |
commit | 8f17cd3e165a4d0cc9a03c029ee5f4d39c5e77e7 (patch) | |
tree | fba63800e4b02432be8c45673e32f234d69cce9e /printing/emf_win.cc | |
parent | 0da15e586f92f3488658034bfef5ecbf42656791 (diff) | |
download | chromium_src-8f17cd3e165a4d0cc9a03c029ee5f4d39c5e77e7.zip chromium_src-8f17cd3e165a4d0cc9a03c029ee5f4d39c5e77e7.tar.gz chromium_src-8f17cd3e165a4d0cc9a03c029ee5f4d39c5e77e7.tar.bz2 |
Unifying NativeMetafile class interface (as much as possible) for Linux, Mac, Win
BUG=NONE
TEST=NONE
Review URL: http://codereview.chromium.org/6611032
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78320 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing/emf_win.cc')
-rw-r--r-- | printing/emf_win.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/printing/emf_win.cc b/printing/emf_win.cc index f2b22fa..1d1dd53 100644 --- a/printing/emf_win.cc +++ b/printing/emf_win.cc @@ -85,7 +85,7 @@ bool Emf::CreateFromFile(const FilePath& metafile_path) { } -bool Emf::CloseDc() { +bool Emf::Close() { DCHECK(!emf_ && hdc_); emf_ = CloseEnhMetaFile(hdc_); DCHECK(emf_); @@ -106,7 +106,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(1).ToRECT(); rect = &bounds; } return PlayEnhMetaFile(hdc, emf_, rect) != 0; @@ -123,11 +123,12 @@ bool Emf::SafePlayback(HDC context) const { emf_, &Emf::SafePlaybackProc, reinterpret_cast<void*>(&base_matrix), - &GetBounds().ToRECT()) != 0; + &GetPageBounds(1).ToRECT()) != 0; } -gfx::Rect Emf::GetBounds() const { +gfx::Rect Emf::GetPageBounds(unsigned int page_number) const { DCHECK(emf_ && !hdc_); + DCHECK_EQ(1U, page_number); ENHMETAHEADER header; if (GetEnhMetaFileHeader(emf_, sizeof(header), &header) != sizeof(header)) { NOTREACHED(); @@ -173,8 +174,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 +419,7 @@ bool Emf::StartPage() { reinterpret_cast<const BYTE *>(&record)); } -bool Emf::EndPage() { +bool Emf::FinishPage() { DCHECK(hdc_); if (!hdc_) return false; @@ -427,7 +428,6 @@ bool Emf::EndPage() { reinterpret_cast<const BYTE *>(&record)); } - Emf::Enumerator::Enumerator(const Emf& emf, HDC context, const RECT* rect) { context_.handle_table = NULL; context_.objects_count = 0; |