pdfviewer: remove text save/restore (not needed) and verify that colorspace dictionary exists before using it

Review URL: https://codereview.chromium.org/22436003

git-svn-id: http://skia.googlecode.com/svn/trunk@10639 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
edisonn@google.com 2013-08-08 12:54:01 +00:00
parent 768bc6a920
commit 53766103b5

View File

@ -388,10 +388,7 @@ static PdfResult DrawText(PdfContext* pdfContext,
pdfContext->fGraphicsState.applyGraphicsState(&paint, false);
canvas->save();
skfont->drawText(decoded, &paint, pdfContext, canvas);
canvas->restore();
return kOK_PdfResult;
}
@ -1581,7 +1578,7 @@ static PdfResult PdfOp_CS_cs(PdfContext* pdfContext, SkCanvas* canvas, SkPdfColo
//Next, get the ColorSpace Dictionary from the Resource Dictionary:
SkPdfDictionary* colorSpaceResource = pdfContext->fGraphicsState.fResources->ColorSpace(pdfContext->fPdfDoc);
SkPdfObject* colorSpace = pdfContext->fPdfDoc->resolveReference(colorSpaceResource->get(name));
SkPdfObject* colorSpace = colorSpaceResource ? pdfContext->fPdfDoc->resolveReference(colorSpaceResource->get(name)) : name;
if (colorSpace == NULL) {
colorOperator->fColorSpace = name->strRef();