more work on pdf fonts, more to come
Review URL: https://codereview.chromium.org/18117005
git-svn-id: http://skia.googlecode.com/svn/trunk@9796 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/experimental/PdfViewer/SkPdfParser.cpp b/experimental/PdfViewer/SkPdfParser.cpp
index 0a6c6e6..94dd5dd 100644
--- a/experimental/PdfViewer/SkPdfParser.cpp
+++ b/experimental/PdfViewer/SkPdfParser.cpp
@@ -34,6 +34,8 @@
// TODO(edisonn): security - validate all the user input, all pdf!
+// TODO(edisonn): put drawtext in #ifdefs, so comparations will ignore minor changes in text positioning and font
+// this way, we look more at other features and layout in diffs
#include "SkPdfHeaders_autogen.h"
#include "SkPdfPodofoMapper_autogen.h"
@@ -386,7 +388,7 @@
SkTraceMatrix(matrix, "mirrored");
#endif
- skfont->drawText(decoded, &paint, pdfContext, canvas, &pdfContext->fGraphicsState.fMatrixTm);
+ skfont->drawText(decoded, &paint, pdfContext, canvas);
canvas->restore();
return kPartial_PdfResult;
@@ -2334,7 +2336,14 @@
doc.drawPage(pn, &canvas);
SkString out;
- out.appendf("%s-%i.png", inputFileName.c_str(), pn);
+ if (doc.pages() > 1) {
+ out.appendf("%s-%i.png", inputFileName.c_str(), pn);
+ } else {
+ out = inputFileName;
+ // .pdf -> .png
+ out[out.size() - 2] = 'n';
+ out[out.size() - 1] = 'g';
+ }
SkImageEncoder::EncodeFile(out.c_str(), bitmap, SkImageEncoder::kPNG_Type, 100);
}
return true;