/** * Find the requested blitter and return his class. * @param name the blitter to select. * @post Sets the blitter so GetCurrentBlitter() returns it too. */ static Blitter *SelectBlitter(const char *name) { BlitterFactory *b = GetBlitterFactory(name); if (b == nullptr) return nullptr; Blitter *newb = b->CreateInstance(); delete *GetActiveBlitter(); *GetActiveBlitter() = newb; DEBUG(driver, 1, "Successfully %s blitter '%s'", StrEmpty(name) ? "probed" : "loaded", newb->GetName()); return newb; }
/** * Find the requested blitter and return his class. * @param name the blitter to select. * @post Sets the blitter so GetCurrentBlitter() returns it too. */ static Blitter *SelectBlitter(const char *name) { BlitterFactory *b = GetBlitterFactory(name); if (b == NULL) return NULL; //用工厂生成一个Blitter Blitter *newb = b->CreateInstance(); delete *GetActiveBlitter(); //得到的是双重地址,可以复制的. *GetActiveBlitter() = newb; DEBUG(driver, 1, "Successfully %s blitter '%s'", StrEmpty(name) ? "probed" : "loaded", newb->GetName()); return newb; }