| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/pdf_metafile_skia.h" | 5 #include "printing/pdf_metafile_skia.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 | 293 |
| 294 PdfMetafileSkia::PdfMetafileSkia() : data_(new PdfMetafileSkiaData) { | 294 PdfMetafileSkia::PdfMetafileSkia() : data_(new PdfMetafileSkiaData) { |
| 295 } | 295 } |
| 296 | 296 |
| 297 scoped_ptr<PdfMetafileSkia> PdfMetafileSkia::GetMetafileForCurrentPage() { | 297 scoped_ptr<PdfMetafileSkia> PdfMetafileSkia::GetMetafileForCurrentPage() { |
| 298 // If we only ever need the metafile for the last page, should we | 298 // If we only ever need the metafile for the last page, should we |
| 299 // only keep a handle on one SkPicture? | 299 // only keep a handle on one SkPicture? |
| 300 scoped_ptr<PdfMetafileSkia> metafile(new PdfMetafileSkia); | 300 scoped_ptr<PdfMetafileSkia> metafile(new PdfMetafileSkia); |
| 301 | 301 |
| 302 if (data_->pages_.size() == 0) | 302 if (data_->pages_.size() == 0) |
| 303 return metafile.Pass(); | 303 return metafile; |
| 304 | 304 |
| 305 if (data_->recorder_.getRecordingCanvas()) // page outstanding | 305 if (data_->recorder_.getRecordingCanvas()) // page outstanding |
| 306 return metafile.Pass(); | 306 return metafile; |
| 307 | 307 |
| 308 const Page& page = data_->pages_.back(); | 308 const Page& page = data_->pages_.back(); |
| 309 | 309 |
| 310 metafile->data_->pages_.push_back(page); | 310 metafile->data_->pages_.push_back(page); |
| 311 | 311 |
| 312 if (!metafile->FinishDocument()) // Generate PDF. | 312 if (!metafile->FinishDocument()) // Generate PDF. |
| 313 metafile.reset(); | 313 metafile.reset(); |
| 314 | 314 |
| 315 return metafile.Pass(); | 315 return metafile; |
| 316 } | 316 } |
| 317 | 317 |
| 318 } // namespace printing | 318 } // namespace printing |
| OLD | NEW |