Chromium Code Reviews| 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; |
| } |
|
dpapad
2011/03/03 23:54:06
I added this private function as an alias of the p
|
| -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; |