diff options
author | edisonn@google.com <edisonn@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-08-05 20:45:40 +0000 |
---|---|---|
committer | edisonn@google.com <edisonn@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-08-05 20:45:40 +0000 |
commit | 91ce698cf24c0a86fbdd5e09d29e7f4507a77fec (patch) | |
tree | c3f075df3e4df09f9e7733fd7da7dca90ad584f3 | |
parent | 34b05ca3799f4adc2994d57a22d78ae1bdf6fb4a (diff) |
pdfviewer: debug code for crash
Review URL: https://codereview.chromium.org/22269002
git-svn-id: http://skia.googlecode.com/svn/trunk@10548 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | experimental/PdfViewer/SkPdfBasics.h | 1 | ||||
-rw-r--r-- | experimental/PdfViewer/SkPdfRenderer.cpp | 2 | ||||
-rw-r--r-- | experimental/PdfViewer/pdfparser/native/SkPdfNativeTokenizer.cpp | 18 |
3 files changed, 18 insertions, 3 deletions
diff --git a/experimental/PdfViewer/SkPdfBasics.h b/experimental/PdfViewer/SkPdfBasics.h index 662e745583..7016339c6b 100644 --- a/experimental/PdfViewer/SkPdfBasics.h +++ b/experimental/PdfViewer/SkPdfBasics.h @@ -350,6 +350,7 @@ smoothness number (PDF 1.3) The precision with which col fDashPhase = 0; fBlendModesLength = 1; fBlendModes[0] = SkXfermode::kSrc_Mode; // PDF: Normal Blend mode + fSMask = NULL; } // TODO(edisonn): make two functons instead, stroking and non stoking, avoid branching diff --git a/experimental/PdfViewer/SkPdfRenderer.cpp b/experimental/PdfViewer/SkPdfRenderer.cpp index 50b48a057b..bb2049e17f 100644 --- a/experimental/PdfViewer/SkPdfRenderer.cpp +++ b/experimental/PdfViewer/SkPdfRenderer.cpp @@ -265,7 +265,7 @@ static bool readToken(SkPdfNativeTokenizer* fTokenizer, PdfToken* token) { const SkClipStack::Element* elem; double y = 0; int total = 0; - while (elem = iter.next()) { + while ((elem = iter.next()) != NULL) { total++; y += 30; diff --git a/experimental/PdfViewer/pdfparser/native/SkPdfNativeTokenizer.cpp b/experimental/PdfViewer/pdfparser/native/SkPdfNativeTokenizer.cpp index 637eb4dda6..a8881382b4 100644 --- a/experimental/PdfViewer/pdfparser/native/SkPdfNativeTokenizer.cpp +++ b/experimental/PdfViewer/pdfparser/native/SkPdfNativeTokenizer.cpp @@ -929,6 +929,11 @@ SkPdfNativeTokenizer::~SkPdfNativeTokenizer() { } bool SkPdfNativeTokenizer::readTokenCore(PdfToken* token) { + SkPdfObject obj; +#ifdef PDF_TRACE_READ_TOKEN + static int read_op = 0; + int last; +#endif token->fKeyword = NULL; token->fObject = NULL; @@ -937,8 +942,18 @@ bool SkPdfNativeTokenizer::readTokenCore(PdfToken* token) { return false; } - SkPdfObject obj; +#ifdef PDF_TRACE_READ_TOKEN + printf("BEFORE the read: %i\n", read_op); + last = read_op; +#endif + fUncompressedStream = nextObject(0, fUncompressedStream, fUncompressedStreamEnd, &obj, fAllocator, fDoc); +#ifdef PDF_TRACE_READ_TOKEN + printf("BEFORE the read: %i\n", read_op); + if (last != read_op) { + printf("break; // memory override"); + } +#endif // If it is a keyword, we will only get the pointer of the string if (obj.type() == SkPdfObject::kKeyword_PdfObjectType) { @@ -953,7 +968,6 @@ bool SkPdfNativeTokenizer::readTokenCore(PdfToken* token) { } #ifdef PDF_TRACE_READ_TOKEN - static int read_op = 0; read_op++; #if 0 if (548 == read_op) { |