pdfviewer: set the default background to transparent (to match render_picture default), and fix a bug a with corrupt diffs

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

git-svn-id: http://skia.googlecode.com/svn/trunk@10376 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
edisonn@google.com 2013-07-25 21:40:23 +00:00
parent aaa9b29ed8
commit ac4bedcb10
2 changed files with 10 additions and 9 deletions

View File

@ -363,13 +363,13 @@ public:
memset(fChars, 0, sizeof(fChars[0]) * (fLastChar - fFirstChar + 1));
const SkPdfArray* widths = dict->Widths(parsed);
for (unsigned int i = 0 ; i < widths->size(); i++) {
if ((fFirstChar + i) < fFirstChar || (fFirstChar + i) > fLastChar) {
printf("break; error 1\n");
if ((fFirstChar + i) >= fFirstChar && (fFirstChar + i) <= fLastChar) {
fChars[i].fWidth = (*widths)[i]->numberValue();
} else {
// TODO(edisonn): report pdf corruption
}
fChars[i].fWidth = (*widths)[i]->numberValue();
}
const SkPdfArray* diffs = fEncodingDict->Differences(parsed);
@ -378,13 +378,14 @@ public:
if ((*diffs)[i]->isInteger()) {
j = (unsigned int)(*diffs)[i]->intValue();
} else if ((*diffs)[i]->isName()) {
if (j < fFirstChar || j > fLastChar) {
printf("break; error 2\n");
if (j >= fFirstChar && j <= fLastChar) {
fChars[j - fFirstChar].fObj = fCharProcs->get((*diffs)[i]);
} else {
// TODO(edisonn): report pdf corruption
}
fChars[j - fFirstChar].fObj = fCharProcs->get((*diffs)[i]);
j++;
} else {
// err
// TODO(edisonn): report bad pdf
}
}
}

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_ColorWHITE) {
static void setup_bitmap(SkBitmap* bitmap, int width, int height, SkColor color = SK_ColorTRANSPARENT) {
bitmap->setConfig(SkBitmap::kARGB_8888_Config, width, height);
bitmap->allocPixels();