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

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

Issue 806653007: Fix up all the easy virtual ... SK_OVERRIDE cases. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 11 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 | « src/core/SkXfermode_proccoeff.h ('k') | src/effects/SkAlphaThresholdFilter.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 "SkDocument.h" 8 #include "SkDocument.h"
9 #include "SkPDFDocument.h" 9 #include "SkPDFDocument.h"
10 #include "SkPDFDevice.h" 10 #include "SkPDFDevice.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
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->clipRect(trimBox); 47 fCanvas->clipRect(trimBox);
48 fCanvas->translate(trimBox.x(), trimBox.y()); 48 fCanvas->translate(trimBox.x(), trimBox.y());
49 return fCanvas; 49 return fCanvas;
50 } 50 }
51 51
52 virtual void onEndPage() SK_OVERRIDE { 52 void onEndPage() SK_OVERRIDE {
53 SkASSERT(fCanvas); 53 SkASSERT(fCanvas);
54 SkASSERT(fDevice); 54 SkASSERT(fDevice);
55 55
56 fCanvas->flush(); 56 fCanvas->flush();
57 fDoc->appendPage(fDevice); 57 fDoc->appendPage(fDevice);
58 58
59 fCanvas->unref(); 59 fCanvas->unref();
60 fDevice->unref(); 60 fDevice->unref();
61 61
62 fCanvas = NULL; 62 fCanvas = NULL;
63 fDevice = NULL; 63 fDevice = NULL;
64 } 64 }
65 65
66 virtual bool onClose(SkWStream* stream) SK_OVERRIDE { 66 bool onClose(SkWStream* stream) SK_OVERRIDE {
67 SkASSERT(NULL == fCanvas); 67 SkASSERT(NULL == fCanvas);
68 SkASSERT(NULL == fDevice); 68 SkASSERT(NULL == fDevice);
69 69
70 bool success = fDoc->emitPDF(stream); 70 bool success = fDoc->emitPDF(stream);
71 SkDELETE(fDoc); 71 SkDELETE(fDoc);
72 fDoc = NULL; 72 fDoc = NULL;
73 return success; 73 return success;
74 } 74 }
75 75
76 virtual void onAbort() SK_OVERRIDE { 76 void onAbort() SK_OVERRIDE {
77 SkDELETE(fDoc); 77 SkDELETE(fDoc);
78 fDoc = NULL; 78 fDoc = NULL;
79 } 79 }
80 80
81 private: 81 private:
82 SkPDFDocument* fDoc; 82 SkPDFDocument* fDoc;
83 SkPDFDevice* fDevice; 83 SkPDFDevice* fDevice;
84 SkCanvas* fCanvas; 84 SkCanvas* fCanvas;
85 SkPicture::EncodeBitmap fEncoder; 85 SkPicture::EncodeBitmap fEncoder;
86 SkScalar fRasterDpi; 86 SkScalar fRasterDpi;
(...skipping 14 matching lines...) Expand all
101 SkDocument* SkDocument::CreatePDF(const char path[], 101 SkDocument* SkDocument::CreatePDF(const char path[],
102 SkPicture::EncodeBitmap enc, 102 SkPicture::EncodeBitmap enc,
103 SkScalar dpi) { 103 SkScalar dpi) {
104 SkFILEWStream* stream = SkNEW_ARGS(SkFILEWStream, (path)); 104 SkFILEWStream* stream = SkNEW_ARGS(SkFILEWStream, (path));
105 if (!stream->isValid()) { 105 if (!stream->isValid()) {
106 SkDELETE(stream); 106 SkDELETE(stream);
107 return NULL; 107 return NULL;
108 } 108 }
109 return SkNEW_ARGS(SkDocument_PDF, (stream, delete_wstream, enc, dpi)); 109 return SkNEW_ARGS(SkDocument_PDF, (stream, delete_wstream, enc, dpi));
110 } 110 }
OLDNEW
« no previous file with comments | « src/core/SkXfermode_proccoeff.h ('k') | src/effects/SkAlphaThresholdFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698