Index: src/doc/SkDocument_PDF.cpp |
diff --git a/src/doc/SkDocument_PDF.cpp b/src/doc/SkDocument_PDF.cpp |
index 695929f32f796322f0027ad88c1917d7f3b416a9..362493d538f9f03fa5b178cc90c0e9d221205659 100644 |
--- a/src/doc/SkDocument_PDF.cpp |
+++ b/src/doc/SkDocument_PDF.cpp |
@@ -12,9 +12,11 @@ |
class SkDocument_PDF : public SkDocument { |
public: |
SkDocument_PDF(SkWStream* stream, void (*doneProc)(SkWStream*), |
- SkPicture::EncodeBitmap encoder) |
+ SkPicture::EncodeBitmap encoder, |
+ SkScalar rasterDpi) |
: SkDocument(stream, doneProc) |
- , fEncoder(encoder) { |
+ , fEncoder(encoder) |
+ , fRasterDpi(rasterDpi) { |
fDoc = SkNEW(SkPDFDocument); |
fCanvas = NULL; |
fDevice = NULL; |
@@ -38,6 +40,9 @@ protected: |
if (fEncoder) { |
fDevice->setDCTEncoder(fEncoder); |
} |
+ if (fRasterDpi != 0) { |
+ fDevice->setRasterDpi(fRasterDpi); |
+ } |
fCanvas = SkNEW_ARGS(SkCanvas, (fDevice)); |
return fCanvas; |
} |
@@ -76,24 +81,28 @@ private: |
SkPDFDeviceFlattener* fDevice; |
SkCanvas* fCanvas; |
SkPicture::EncodeBitmap fEncoder; |
+ SkScalar fRasterDpi; |
}; |
/////////////////////////////////////////////////////////////////////////////// |
SkDocument* SkDocument::CreatePDF(SkWStream* stream, void (*done)(SkWStream*), |
- SkPicture::EncodeBitmap enc) { |
- return stream ? SkNEW_ARGS(SkDocument_PDF, (stream, done, enc)) : NULL; |
+ SkPicture::EncodeBitmap enc, |
+ SkScalar dpi) { |
+ return stream ? SkNEW_ARGS(SkDocument_PDF, (stream, done, enc, dpi)) : NULL; |
} |
static void delete_wstream(SkWStream* stream) { |
SkDELETE(stream); |
} |
-SkDocument* SkDocument::CreatePDF(const char path[], SkPicture::EncodeBitmap enc) { |
+SkDocument* SkDocument::CreatePDF(const char path[], |
+ SkPicture::EncodeBitmap enc, |
+ SkScalar dpi) { |
SkFILEWStream* stream = SkNEW_ARGS(SkFILEWStream, (path)); |
if (!stream->isValid()) { |
SkDELETE(stream); |
return NULL; |
} |
- return SkNEW_ARGS(SkDocument_PDF, (stream, delete_wstream, enc)); |
+ return SkNEW_ARGS(SkDocument_PDF, (stream, delete_wstream, enc, dpi)); |
} |