| Index: printing/pdf_metafile_mac.cc
|
| diff --git a/printing/pdf_metafile_mac.cc b/printing/pdf_metafile_mac.cc
|
| index ffd80e8f8d7c765119a5e669e30da4c20fb0a545..eb7a7d2f4b5092f57518e7212317c82484d38beb 100644
|
| --- a/printing/pdf_metafile_mac.cc
|
| +++ b/printing/pdf_metafile_mac.cc
|
| @@ -9,6 +9,7 @@
|
| #include "base/mac/scoped_cftyperef.h"
|
| #include "base/sys_string_conversions.h"
|
| #include "ui/gfx/rect.h"
|
| +#include "ui/gfx/size.h"
|
|
|
| using base::mac::ScopedCFTypeRef;
|
|
|
| @@ -20,7 +21,7 @@ PdfMetafile::PdfMetafile()
|
|
|
| PdfMetafile::~PdfMetafile() {}
|
|
|
| -CGContextRef PdfMetafile::Init() {
|
| +bool PdfMetafile::Init() {
|
| // Ensure that Init hasn't already been called.
|
| DCHECK(!context_.get());
|
| DCHECK(!pdf_data_.get());
|
| @@ -28,14 +29,14 @@ CGContextRef PdfMetafile::Init() {
|
| pdf_data_.reset(CFDataCreateMutable(kCFAllocatorDefault, 0));
|
| if (!pdf_data_.get()) {
|
| LOG(ERROR) << "Failed to create pdf data for metafile";
|
| - return NULL;
|
| + return false;
|
| }
|
| ScopedCFTypeRef<CGDataConsumerRef> pdf_consumer(
|
| CGDataConsumerCreateWithCFData(pdf_data_));
|
| if (!pdf_consumer.get()) {
|
| LOG(ERROR) << "Failed to create data consumer for metafile";
|
| pdf_data_.reset(NULL);
|
| - return NULL;
|
| + return false;
|
| }
|
| context_.reset(CGPDFContextCreate(pdf_consumer, NULL, NULL));
|
| if (!context_.get()) {
|
| @@ -43,7 +44,7 @@ CGContextRef PdfMetafile::Init() {
|
| pdf_data_.reset(NULL);
|
| }
|
|
|
| - return context_.get();
|
| + return true;
|
| }
|
|
|
| bool PdfMetafile::Init(const void* src_buffer, uint32 src_buffer_size) {
|
| @@ -66,6 +67,7 @@ CGContextRef PdfMetafile::StartPage(const gfx::Size& page_size,
|
| DCHECK(context_.get());
|
| DCHECK(!page_is_open_);
|
|
|
| + DLOG(INFO) << "size: " << page_size.height();
|
| double height = page_size.height();
|
| double width = page_size.width();
|
|
|
| @@ -84,16 +86,17 @@ CGContextRef PdfMetafile::StartPage(const gfx::Size& page_size,
|
| return context_.get();
|
| }
|
|
|
| -void PdfMetafile::FinishPage() {
|
| +bool PdfMetafile::FinishPage() {
|
| DCHECK(context_.get());
|
| DCHECK(page_is_open_);
|
|
|
| CGContextRestoreGState(context_);
|
| CGContextEndPage(context_);
|
| page_is_open_ = false;
|
| + return true;
|
| }
|
|
|
| -void PdfMetafile::Close() {
|
| +bool PdfMetafile::Close() {
|
| DCHECK(context_.get());
|
| DCHECK(!page_is_open_);
|
|
|
| @@ -110,6 +113,7 @@ void PdfMetafile::Close() {
|
| #endif
|
| CGPDFContextClose(context_.get());
|
| context_.reset(NULL);
|
| + return true;
|
| }
|
|
|
| bool PdfMetafile::RenderPage(unsigned int page_number, CGContextRef context,
|
|
|