| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "printing/emf_win.h" | 5 #include "printing/emf_win.h" |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 } | 47 } |
| 48 | 48 |
| 49 Emf::Emf() : emf_(NULL), hdc_(NULL) { | 49 Emf::Emf() : emf_(NULL), hdc_(NULL) { |
| 50 } | 50 } |
| 51 | 51 |
| 52 Emf::~Emf() { | 52 Emf::~Emf() { |
| 53 CloseEmf(); | 53 CloseEmf(); |
| 54 DCHECK(!emf_ && !hdc_); | 54 DCHECK(!emf_ && !hdc_); |
| 55 } | 55 } |
| 56 | 56 |
| 57 bool Emf::Init(const void* src_buffer, uint32 src_buffer_size) { | 57 bool Emf::InitFromData(const void* src_buffer, uint32 src_buffer_size) { |
| 58 DCHECK(!emf_ && !hdc_); | 58 DCHECK(!emf_ && !hdc_); |
| 59 emf_ = SetEnhMetaFileBits(src_buffer_size, | 59 emf_ = SetEnhMetaFileBits(src_buffer_size, |
| 60 reinterpret_cast<const BYTE*>(src_buffer)); | 60 reinterpret_cast<const BYTE*>(src_buffer)); |
| 61 return emf_ != NULL; | 61 return emf_ != NULL; |
| 62 } | 62 } |
| 63 | 63 |
| 64 bool Emf::CreateDc(HDC sibling, const RECT* rect) { | 64 bool Emf::CreateDc(HDC sibling, const RECT* rect) { |
| 65 DCHECK(!emf_ && !hdc_); | 65 DCHECK(!emf_ && !hdc_); |
| 66 hdc_ = CreateEnhMetaFile(sibling, NULL, rect, NULL); | 66 hdc_ = CreateEnhMetaFile(sibling, NULL, rect, NULL); |
| 67 DCHECK(hdc_); | 67 DCHECK(hdc_); |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 } else { | 467 } else { |
| 468 DCHECK_EQ(emf.context_.handle_table, handle_table); | 468 DCHECK_EQ(emf.context_.handle_table, handle_table); |
| 469 DCHECK_EQ(emf.context_.objects_count, objects_count); | 469 DCHECK_EQ(emf.context_.objects_count, objects_count); |
| 470 DCHECK_EQ(emf.context_.hdc, hdc); | 470 DCHECK_EQ(emf.context_.hdc, hdc); |
| 471 } | 471 } |
| 472 emf.items_.push_back(Record(&emf.context_, record)); | 472 emf.items_.push_back(Record(&emf.context_, record)); |
| 473 return 1; | 473 return 1; |
| 474 } | 474 } |
| 475 | 475 |
| 476 } // namespace printing | 476 } // namespace printing |
| OLD | NEW |