static void test_for_size(size_t size) { struct ewah_bitmap *a = generate_bitmap(size); struct ewah_bitmap *b = generate_bitmap(size); struct ewah_bitmap *result = ewah_new(); size_t i; struct { const char *name; void (*generate)(struct ewah_bitmap *, struct ewah_bitmap *, struct ewah_bitmap *); size_t (*check)(size_t, size_t); } tests[] = { {"or", &ewah_or, &op_or}, {"xor", &ewah_xor, &op_xor}, {"and", &ewah_and, &op_and}, {"and-not", &ewah_and_not, &op_andnot} }; for (i = 0; i < sizeof(tests)/sizeof(tests[0]); ++i) { fprintf(stderr, "'%s' in %zu bits... ", tests[i].name, size); tests[i].generate(a, b, result); if (verify_operation(a, b, result, tests[i].check)) fprintf(stderr, "OK\n"); ewah_clear(result); } ewah_free(a); ewah_free(b); ewah_free(result); }
void agtk_init(void) { white = makecol(0xff, 0xff, 0xff); highlight = makecol(0xee, 0xea, 0xee); normal = makecol(0xd6, 0xd6, 0xd6); pressed = makecol(0xc5, 0xc2, 0xc5); hshadow = makecol(0xa5, 0xa5, 0xa5); nshadow = makecol(0x95, 0x95, 0x95); black = makecol(0, 0, 0); blue = makecol(0, 0, 0x9c); yellow = makecol(0xff, 0xff, 0x62); agtk_fg_color = black; agtk_bg_color = normal; agtk_mg_color = nshadow; radio_up_bmp = generate_bitmap(radio_up, 11, 11); radio_down_bmp = generate_bitmap(radio_down, 11, 11); menu_arrow_bmp = generate_bitmap(menu_arrow, 8, 7); gui_menu_draw_menu = gtk_draw_menu; gui_menu_draw_menu_item = gtk_draw_menu_item; }
bool SkImageCacherator::tryLockAsBitmap(SkBitmap* bitmap) { const uint32_t uniqueID = fGenerator->uniqueID(); if (SkBitmapCache::Find(uniqueID, bitmap)) { return check_output_bitmap(*bitmap, uniqueID); } if (!generate_bitmap(fGenerator, bitmap)) { return false; } bitmap->pixelRef()->setImmutableWithID(uniqueID); SkBitmapCache::Add(uniqueID, *bitmap); return true; }
GrTexture* SkImageCacherator::lockAsTexture(GrContext* ctx, SkImageUsageType usage) { #if SK_SUPPORT_GPU if (!ctx) { return nullptr; } if (GrTexture* tex = this->tryLockAsTexture(ctx, usage)) { return tex; } // Try to get a bitmap and then upload/cache it as a texture SkBitmap bitmap; if (!generate_bitmap(fGenerator, &bitmap)) { return nullptr; } return GrRefCachedBitmapTexture(ctx, bitmap, usage); #else return nullptr; #endif }
void aphoton_init(void) { MAKE_GRAY_RANGE(button_gray_range, 235, 195); button_border_gray = makecol(176, 176, 176); container_black = makecol(75, 75, 75); container_gray1 = makecol(177, 177, 177); container_gray2 = makecol(201, 201, 201); check_black = makecol(24, 24, 24); check_gray1 = makecol(153, 153, 153); check_gray2 = makecol(204, 204, 204); MAKE_GRAY_RANGE(scrollbar_gray_range, 195, 235); scrollbar_gray1 = makecol(181, 181, 181); scrollbar_gray2 = makecol(161, 161, 161); edit_gray = makecol(192, 192, 192); edit_white = makecol(244, 244, 244); list_white = makecol(248, 248, 248); list_green = makecol(142, 162, 155); MAKE_GRAY_RANGE(menu_gray_range, 197, 217); menu_gray_from = MAKECOL_RANGE_FROM(menu_gray_range); menu_gray_to = MAKECOL_RANGE_TO(menu_gray_range); checked_gray = makecol(92, 92, 92); slider_white1 = makecol(235, 235, 235); slider_white2 = makecol(237, 237, 237); slider_gray1 = makecol(140, 140, 140); slider_gray2 = makecol(172, 172, 172); slider_gray3 = makecol(108, 108, 108); slider_gray4 = makecol(197, 197, 197); slider_gray5 = makecol(162, 162, 162); MAKE_GRAY_RANGE(slider_gray_range, 237, 197); window_black = makecol(63, 63, 63); window_gray = makecol(157, 157, 157); window_blue1 = makecol(142, 189, 255); window_blue2 = makecol(92, 141, 223); window_blue3 = makecol(42, 89, 173); window_blue_range.from.r = 102; window_blue_range.from.g = 149; window_blue_range.from.b = 233; window_blue_range.to.r = 71; window_blue_range.to.g = 118; window_blue_range.to.b = 202; black = makecol(0, 0, 0); white = makecol(255, 255, 255); normal = makecol(216, 216, 216); highlight = makecol(144, 152, 248); shadow = makecol(127, 127, 127); aphoton_fg_color = black; aphoton_bg_color = normal; aphoton_mg_color = shadow; radio_bmp = generate_bitmap(radio, 14, 14); radio_sel_bmp = generate_bitmap(radio_sel, 14, 14); menu_arrow_bmp = generate_bitmap(menu_arrow, 6, 8); gui_menu_draw_menu = photon_draw_menu; gui_menu_draw_menu_item = photon_draw_menu_item; }