diff options
author | kmadhusu@chromium.org <kmadhusu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-02 16:44:20 +0000 |
---|---|---|
committer | kmadhusu@chromium.org <kmadhusu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-02 16:44:20 +0000 |
commit | 534c4fb35c8c195c6d82e7e12ac303397e796825 (patch) | |
tree | 1bfdb823901de172173b19f58b0aab493e1bb932 /printing/pdf_metafile_skia.cc | |
parent | 1c78d786e3889ca1b783ab31ac3a16449e718f6f (diff) | |
download | chromium_src-534c4fb35c8c195c6d82e7e12ac303397e796825.zip chromium_src-534c4fb35c8c195c6d82e7e12ac303397e796825.tar.gz chromium_src-534c4fb35c8c195c6d82e7e12ac303397e796825.tar.bz2 |
PrintPreview: Remove |page_number| from StartPageForVectorCanvas function and |page_slot| from PrintMsg_PrintPage_Params.
We will not add preview pages to the complete metafile in out of order fashion.
BUG=none
TEST=print preview works after code changes.
Review URL: http://codereview.chromium.org/7549001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95092 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing/pdf_metafile_skia.cc')
-rw-r--r-- | printing/pdf_metafile_skia.cc | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/printing/pdf_metafile_skia.cc b/printing/pdf_metafile_skia.cc index 638fa7b..bc44131 100644 --- a/printing/pdf_metafile_skia.cc +++ b/printing/pdf_metafile_skia.cc @@ -49,11 +49,10 @@ bool PdfMetafileSkia::InitFromData(const void* src_buffer, } SkDevice* PdfMetafileSkia::StartPageForVectorCanvas( - int page_number, const gfx::Size& page_size, const gfx::Rect& content_area, + const gfx::Size& page_size, const gfx::Rect& content_area, const float& scale_factor) { - DCHECK_EQ(outstanding_page_number_, kNoOutstandingPage); - DCHECK_GE(page_number, 0); - outstanding_page_number_ = page_number; + DCHECK(!page_outstanding_); + page_outstanding_ = true; // Adjust for the margins and apply the scale factor. SkMatrix transform; @@ -84,11 +83,9 @@ bool PdfMetafileSkia::StartPage(const gfx::Size& page_size, bool PdfMetafileSkia::FinishPage() { DCHECK(data_->current_page_.get()); - DCHECK_GE(outstanding_page_number_, 0); - data_->pdf_doc_.setPage(outstanding_page_number_ + 1, - data_->current_page_.get()); - outstanding_page_number_ = kNoOutstandingPage; + data_->pdf_doc_.appendPage(data_->current_page_.get()); + page_outstanding_ = false; return true; } @@ -97,7 +94,7 @@ bool PdfMetafileSkia::FinishDocument() { if (data_->pdf_stream_.getOffset()) return true; - if (outstanding_page_number_ >= 0) + if (page_outstanding_) FinishPage(); data_->current_page_ = NULL; @@ -239,7 +236,7 @@ bool PdfMetafileSkia::SaveToFD(const base::FileDescriptor& fd) const { PdfMetafileSkia::PdfMetafileSkia() : data_(new PdfMetafileSkiaData), - outstanding_page_number_(kNoOutstandingPage) { + page_outstanding_(false) { } PdfMetafileSkia* PdfMetafileSkia::GetMetafileForCurrentPage() { |