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

Side by Side Diff: src/doc/SkDocument_PDF.cpp

Issue 711133002: SkDocument_PDF does somthing with the trimBox parameter. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkDocument.h" 8 #include "SkDocument.h"
9 #include "SkPDFDocument.h" 9 #include "SkPDFDocument.h"
10 #include "SkPDFDevice.h" 10 #include "SkPDFDevice.h"
(...skipping 26 matching lines...) Expand all
37 mediaBoxSize.set(SkScalarRoundToInt(width), SkScalarRoundToInt(height)); 37 mediaBoxSize.set(SkScalarRoundToInt(width), SkScalarRoundToInt(height));
38 38
39 fDevice = SkNEW_ARGS(SkPDFDevice, (mediaBoxSize, mediaBoxSize, SkMatrix: :I())); 39 fDevice = SkNEW_ARGS(SkPDFDevice, (mediaBoxSize, mediaBoxSize, SkMatrix: :I()));
40 if (fEncoder) { 40 if (fEncoder) {
41 fDevice->setDCTEncoder(fEncoder); 41 fDevice->setDCTEncoder(fEncoder);
42 } 42 }
43 if (fRasterDpi != 0) { 43 if (fRasterDpi != 0) {
44 fDevice->setRasterDpi(fRasterDpi); 44 fDevice->setRasterDpi(fRasterDpi);
45 } 45 }
46 fCanvas = SkNEW_ARGS(SkCanvas, (fDevice)); 46 fCanvas = SkNEW_ARGS(SkCanvas, (fDevice));
47 fCanvas->translate(trimBox.x(), trimBox.y());
48 fCanvas->clipRect(SkRect::MakeWH(trimBox.width(), trimBox.height()));
vandebo (ex-Chrome) 2014/11/11 15:44:53 Do headers and footers still work with this approa
47 return fCanvas; 49 return fCanvas;
48 } 50 }
49 51
50 virtual void onEndPage() SK_OVERRIDE { 52 virtual void onEndPage() SK_OVERRIDE {
51 SkASSERT(fCanvas); 53 SkASSERT(fCanvas);
52 SkASSERT(fDevice); 54 SkASSERT(fDevice);
53 55
54 fCanvas->flush(); 56 fCanvas->flush();
55 fDoc->appendPage(fDevice); 57 fDoc->appendPage(fDevice);
56 58
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 SkDocument* SkDocument::CreatePDF(const char path[], 101 SkDocument* SkDocument::CreatePDF(const char path[],
100 SkPicture::EncodeBitmap enc, 102 SkPicture::EncodeBitmap enc,
101 SkScalar dpi) { 103 SkScalar dpi) {
102 SkFILEWStream* stream = SkNEW_ARGS(SkFILEWStream, (path)); 104 SkFILEWStream* stream = SkNEW_ARGS(SkFILEWStream, (path));
103 if (!stream->isValid()) { 105 if (!stream->isValid()) {
104 SkDELETE(stream); 106 SkDELETE(stream);
105 return NULL; 107 return NULL;
106 } 108 }
107 return SkNEW_ARGS(SkDocument_PDF, (stream, delete_wstream, enc, dpi)); 109 return SkNEW_ARGS(SkDocument_PDF, (stream, delete_wstream, enc, dpi));
108 } 110 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698