pdfviewer: fix condition for element in array, reset back the default color to white, and verify type before value in PDF API mapper

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

git-svn-id: http://skia.googlecode.com/svn/trunk@10427 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
edisonn@google.com 2013-07-30 12:09:14 +00:00
parent 16d53aac9c
commit 641cce90c9
3 changed files with 5 additions and 5 deletions

View File

@ -518,7 +518,7 @@ class PdfClassManager:
cntMust = cntMust + 1
fileMapperNativeCpp.write(' if (!nativeObj->isDictionary()) return false;\n')
fileMapperNativeCpp.write(' ret = nativeObj->get(\"' + prop.fName + '\", \"' + prop.fAbr + '\");\n')
fileMapperNativeCpp.write(' if (ret == NULL) return false;\n')
fileMapperNativeCpp.write(' if (ret == NULL || !' + knowTypes[prop.fTypes.strip()][3] + ') return false;\n')
eval = '';
# TODO(edisonn): this could get out of hand, and could have poor performance if continued on this path

View File

@ -139,7 +139,7 @@ static bool make_output_filepath(SkString* path, const SkString& dir,
PNG_FILE_EXTENSION);
}
static void setup_bitmap(SkBitmap* bitmap, int width, int height, SkColor color = SK_ColorTRANSPARENT) {
static void setup_bitmap(SkBitmap* bitmap, int width, int height, SkColor color = SK_ColorWHITE) {
bitmap->setConfig(SkBitmap::kARGB_8888_Config, width, height);
bitmap->allocPixels();

View File

@ -504,12 +504,12 @@ SkPdfObject* SkNativeParsedPDF::resolveReference(const SkPdfObject* ref) {
SkASSERT(!(id < 0 || id > fObjects.count()));
if (id < 0 || id > fObjects.count()) {
// TODO(edisonn): verify id and gen expected
if (id < 0 || id >= fObjects.count()) {
// TODO(edisonn): report error/warning
return NULL;
}
// TODO(edisonn): verify id and gen expected
if (fObjects[id].fResolvedReference != NULL) {
return fObjects[id].fResolvedReference;
}