static void drawFrame(SkBitmap* bm, const SavedImage* frame, const ColorMapObject* cmap) { int transparent = -1; for (int i = 0; i < frame->ExtensionBlockCount; ++i) { ExtensionBlock* eb = frame->ExtensionBlocks + i; if (eb->Function == GRAPHICS_EXT_FUNC_CODE && eb->ByteCount == 4) { bool has_transparency = ((eb->Bytes[0] & 1) == 1); if (has_transparency) { transparent = (unsigned char)eb->Bytes[3]; } } } if (frame->ImageDesc.ColorMap != NULL) { // use local color table cmap = frame->ImageDesc.ColorMap; } if (cmap == NULL || cmap->ColorCount != (1 << cmap->BitsPerPixel)) { SkDEBUGFAIL("bad colortable setup"); return; } if (frame->ImageDesc.Interlace) { blitInterlace(bm, frame, cmap, transparent); } else { blitNormal(bm, frame, cmap, transparent); } }
static void drawFrame(argb *bm, GifInfo *info, SavedImage *frame) { ColorMapObject *cmap; if (frame->ImageDesc.ColorMap != NULL) cmap = frame->ImageDesc.ColorMap;// use local color table else if (info->gifFilePtr->SColorMap != NULL) cmap = info->gifFilePtr->SColorMap; else cmap = getDefColorMap(); blitNormal(bm, info, frame, cmap); }