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

Side by Side Diff: samplecode/SamplePdfFileViewer.cpp

Issue 1316123003: Style Change: SkNEW->new; SkDELETE->delete (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-26 (Wednesday) 15:59:00 EDT Created 5 years, 3 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 | « samplecode/SampleLua.cpp ('k') | samplecode/SamplePictFile.cpp » ('j') | 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 "SkTypes.h"
9
8 #ifdef SAMPLE_PDF_FILE_VIEWER 10 #ifdef SAMPLE_PDF_FILE_VIEWER
9 11
10 #include "SampleCode.h" 12 #include "SampleCode.h"
11 #include "SkDumpCanvas.h" 13 #include "SkDumpCanvas.h"
12 #include "SkView.h" 14 #include "SkView.h"
13 #include "SkCanvas.h" 15 #include "SkCanvas.h"
14 #include "SkGradientShader.h" 16 #include "SkGradientShader.h"
15 #include "SkGraphics.h" 17 #include "SkGraphics.h"
16 #include "SkImageDecoder.h" 18 #include "SkImageDecoder.h"
17 #include "SkOSFile.h" 19 #include "SkOSFile.h"
(...skipping 15 matching lines...) Expand all
33 private: 35 private:
34 SkString fFilename; 36 SkString fFilename;
35 SkPicture* fPicture; // TODO(edisonn): multiple pages, one page / picture, make it an array 37 SkPicture* fPicture; // TODO(edisonn): multiple pages, one page / picture, make it an array
36 38
37 static SkPicture* LoadPdf(const char path[]) { 39 static SkPicture* LoadPdf(const char path[]) {
38 SkAutoTDelete<SkPdfRenderer> renderer(SkPdfRenderer::CreateFromFile(path )); 40 SkAutoTDelete<SkPdfRenderer> renderer(SkPdfRenderer::CreateFromFile(path ));
39 if (NULL == renderer.get()) { 41 if (NULL == renderer.get()) {
40 return NULL; 42 return NULL;
41 } 43 }
42 44
43 SkPicture* pic = SkNEW(SkPicture); 45 SkPicture* pic = new SkPicture;
44 SkCanvas* canvas = pic->beginRecording((int) renderer->MediaBox(0).width (), 46 SkCanvas* canvas = pic->beginRecording((int) renderer->MediaBox(0).width (),
45 (int) renderer->MediaBox(0).heigh t()); 47 (int) renderer->MediaBox(0).heigh t());
46 renderer->renderPage(0, canvas, renderer->MediaBox(0)); 48 renderer->renderPage(0, canvas, renderer->MediaBox(0));
47 pic->endRecording(); 49 pic->endRecording();
48 return pic; 50 return pic;
49 } 51 }
50 52
51 public: 53 public:
52 PdfFileViewer(const char name[] = NULL) : fFilename(name) { 54 PdfFileViewer(const char name[] = NULL) : fFilename(name) {
53 fPicture = NULL; 55 fPicture = NULL;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 } 98 }
97 99
98 ////////////////////////////////////////////////////////////////////////////// 100 //////////////////////////////////////////////////////////////////////////////
99 101
100 #if 0 102 #if 0
101 static SkView* MyFactory() { return new PdfFileViewer; } 103 static SkView* MyFactory() { return new PdfFileViewer; }
102 static SkViewRegister reg(MyFactory); 104 static SkViewRegister reg(MyFactory);
103 #endif 105 #endif
104 106
105 #endif // SAMPLE_PDF_FILE_VIEWER 107 #endif // SAMPLE_PDF_FILE_VIEWER
OLDNEW
« no previous file with comments | « samplecode/SampleLua.cpp ('k') | samplecode/SamplePictFile.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698