| Index: printing/emf_win.cc
|
| diff --git a/printing/emf_win.cc b/printing/emf_win.cc
|
| index 1d1dd530b978abafc770641c193f0d652cc456d4..9b0f2a5fbd0610cf6b7079d065c65f0a703033d4 100644
|
| --- a/printing/emf_win.cc
|
| +++ b/printing/emf_win.cc
|
| @@ -1,4 +1,4 @@
|
| -// Copyright (c) 2010 The Chromium Authors. All rights reserved.
|
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| @@ -50,41 +50,32 @@ Emf::Emf() : emf_(NULL), hdc_(NULL) {
|
| }
|
|
|
| Emf::~Emf() {
|
| - CloseEmf();
|
| - DCHECK(!emf_ && !hdc_);
|
| -}
|
| -
|
| -bool Emf::Init(const void* src_buffer, uint32 src_buffer_size) {
|
| - DCHECK(!emf_ && !hdc_);
|
| - emf_ = SetEnhMetaFileBits(src_buffer_size,
|
| - reinterpret_cast<const BYTE*>(src_buffer));
|
| - return emf_ != NULL;
|
| + DCHECK(!hdc_);
|
| + if (emf_)
|
| + DeleteEnhMetaFile(emf_);
|
| }
|
|
|
| -bool Emf::CreateDc(HDC sibling, const RECT* rect) {
|
| +bool Emf::Init() {
|
| DCHECK(!emf_ && !hdc_);
|
| - hdc_ = CreateEnhMetaFile(sibling, NULL, rect, NULL);
|
| + hdc_ = CreateEnhMetaFile(NULL, NULL, NULL, NULL);
|
| DCHECK(hdc_);
|
| return hdc_ != NULL;
|
| }
|
|
|
| -bool Emf::CreateFileBackedDc(HDC sibling, const RECT* rect,
|
| - const FilePath& path) {
|
| +bool Emf::Init(const void* src_buffer, uint32 src_buffer_size) {
|
| DCHECK(!emf_ && !hdc_);
|
| - DCHECK(!path.empty());
|
| - hdc_ = CreateEnhMetaFile(sibling, path.value().c_str(), rect, NULL);
|
| - DCHECK(hdc_);
|
| - return hdc_ != NULL;
|
| + emf_ = SetEnhMetaFileBits(src_buffer_size,
|
| + reinterpret_cast<const BYTE*>(src_buffer));
|
| + return emf_ != NULL;
|
| }
|
|
|
| -bool Emf::CreateFromFile(const FilePath& metafile_path) {
|
| +bool Emf::Init(const FilePath& metafile_path) {
|
| DCHECK(!emf_ && !hdc_);
|
| emf_ = GetEnhMetaFile(metafile_path.value().c_str());
|
| DCHECK(emf_);
|
| return emf_ != NULL;
|
| }
|
|
|
| -
|
| bool Emf::Close() {
|
| DCHECK(!emf_ && hdc_);
|
| emf_ = CloseEnhMetaFile(hdc_);
|
| @@ -93,14 +84,6 @@ bool Emf::Close() {
|
| 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;
|
|
|