Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(275)

Side by Side Diff: printing/pdf_metafile_skia.cc

Issue 1066273002: Use SkPictureRecorder::endRecordingAsPicture() instead of endRecording() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/test/fake_content_layer_client.cc ('k') | skia/ext/analysis_canvas_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/containers/hash_tables.h" 7 #include "base/containers/hash_tables.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/numerics/safe_conversions.h" 10 #include "base/numerics/safe_conversions.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 if (!StartPage(page_size, content_area, scale_factor)) 114 if (!StartPage(page_size, content_area, scale_factor))
115 return nullptr; 115 return nullptr;
116 return data_->recorder_.getRecordingCanvas(); 116 return data_->recorder_.getRecordingCanvas();
117 } 117 }
118 118
119 bool PdfMetafileSkia::FinishPage() { 119 bool PdfMetafileSkia::FinishPage() {
120 if (!data_->recorder_.getRecordingCanvas()) 120 if (!data_->recorder_.getRecordingCanvas())
121 return false; 121 return false;
122 DCHECK(!(data_->pages_.back().content_)); 122 DCHECK(!(data_->pages_.back().content_));
123 data_->pages_.back().content_ = 123 data_->pages_.back().content_ =
124 skia::AdoptRef(data_->recorder_.endRecording()); 124 skia::AdoptRef(data_->recorder_.endRecordingAsPicture());
125 return true; 125 return true;
126 } 126 }
127 127
128 bool PdfMetafileSkia::FinishDocument() { 128 bool PdfMetafileSkia::FinishDocument() {
129 // If we've already set the data in InitFromData, leave it be. 129 // If we've already set the data in InitFromData, leave it be.
130 if (data_->pdf_data_) 130 if (data_->pdf_data_)
131 return false; 131 return false;
132 132
133 if (data_->recorder_.getRecordingCanvas()) 133 if (data_->recorder_.getRecordingCanvas())
134 this->FinishPage(); 134 this->FinishPage();
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 278
279 metafile->data_->pages_.push_back(page); 279 metafile->data_->pages_.push_back(page);
280 280
281 if (!metafile->FinishDocument()) // Generate PDF. 281 if (!metafile->FinishDocument()) // Generate PDF.
282 metafile.reset(); 282 metafile.reset();
283 283
284 return metafile.Pass(); 284 return metafile.Pass();
285 } 285 }
286 286
287 } // namespace printing 287 } // namespace printing
OLDNEW
« no previous file with comments | « cc/test/fake_content_layer_client.cc ('k') | skia/ext/analysis_canvas_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698