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

Side by Side Diff: samplecode/SamplePdfFileViewer.cpp

Issue 19000004: add ability to specify the DPI at which to render the page (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2013 Google Inc. 3 * Copyright 2013 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #ifdef SAMPLE_PDF_FILE_VIEWER 9 #ifdef SAMPLE_PDF_FILE_VIEWER
10 10
(...skipping 28 matching lines...) Expand all
39 static SkPicture* LoadPdf(const char path[]) { 39 static SkPicture* LoadPdf(const char path[]) {
40 SkPicture* pic = NULL; 40 SkPicture* pic = NULL;
41 41
42 SkPdfRenderer renderer; 42 SkPdfRenderer renderer;
43 SkString skpath; 43 SkString skpath;
44 skpath.append(path); 44 skpath.append(path);
45 renderer.load(skpath); 45 renderer.load(skpath);
46 if (renderer.loaded()) { 46 if (renderer.loaded()) {
47 pic = SkNEW(SkPicture); 47 pic = SkNEW(SkPicture);
48 SkCanvas* canvas = pic->beginRecording((int)renderer.MediaBox(0).wid th(), (int)renderer.MediaBox(0).height()); 48 SkCanvas* canvas = pic->beginRecording((int)renderer.MediaBox(0).wid th(), (int)renderer.MediaBox(0).height());
49 renderer.renderPage(0, canvas); 49 renderer.renderPage(0, canvas, renderer.MediaBox(0));
50 pic->endRecording(); 50 pic->endRecording();
51 } 51 }
52 return pic; 52 return pic;
53 } 53 }
54 54
55 public: 55 public:
56 PdfFileViewer(const char name[] = NULL) : fFilename(name) { 56 PdfFileViewer(const char name[] = NULL) : fFilename(name) {
57 fPicture = NULL; 57 fPicture = NULL;
58 } 58 }
59 59
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 } 100 }
101 101
102 ////////////////////////////////////////////////////////////////////////////// 102 //////////////////////////////////////////////////////////////////////////////
103 103
104 #if 0 104 #if 0
105 static SkView* MyFactory() { return new PdfFileViewer; } 105 static SkView* MyFactory() { return new PdfFileViewer; }
106 static SkViewRegister reg(MyFactory); 106 static SkViewRegister reg(MyFactory);
107 #endif 107 #endif
108 108
109 #endif // SAMPLE_PDF_FILE_VIEWER 109 #endif // SAMPLE_PDF_FILE_VIEWER
OLDNEW
« experimental/PdfViewer/SkPdfRenderer.h ('K') | « experimental/PdfViewer/pdf_viewer_main.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698