void WLSurface::DestroyIlmSurface() { if (m_ilmSurfaceId > 0){ ilm_surfaceRemove(m_ilmSurfaceId); } }
void SetUp() { ASSERT_EQ(ILM_SUCCESS, ilm_initWithNativedisplay((t_ilm_nativedisplay)wlDisplay)); ASSERT_EQ(ILM_SUCCESS, ilmClient_init((t_ilm_nativedisplay)wlDisplay)); // set default values callbackLayerId = -1; LayerProperties = ilmLayerProperties(); mask = static_cast<t_ilm_notification_mask>(0); surface = -1; SurfaceProperties = ilmSurfaceProperties(); // create a layer layer = 345; ilm_layerRemove(layer); ilm_commitChanges(); ilm_layerCreateWithDimension(&layer, 800, 480); ilm_commitChanges(); // create a surface surface = 456; ilm_surfaceRemove(surface); ilm_commitChanges(); ilm_surfaceCreate((t_ilm_nativehandle)wlSurfaces[0],10,10,ILM_PIXELFORMAT_RGBA_8888,&surface); ilm_commitChanges(); timesCalled=0; callbackLayerId = INVALID_ID; callbackSurfaceId = INVALID_ID; }
void TearDown() { //print_lmc_get_scene(); t_ilm_layer* layers = NULL; t_ilm_int numLayer=0; EXPECT_EQ(ILM_SUCCESS, ilm_getLayerIDs(&numLayer, &layers)); for (t_ilm_int i=0; i<numLayer; i++) { EXPECT_EQ(ILM_SUCCESS, ilm_layerRemove(layers[i])); }; free(layers); t_ilm_surface* surfaces = NULL; t_ilm_int numSurfaces=0; EXPECT_EQ(ILM_SUCCESS, ilm_getSurfaceIDs(&numSurfaces, &surfaces)); for (t_ilm_int i=0; i<numSurfaces; i++) { EXPECT_EQ(ILM_SUCCESS, ilm_surfaceRemove(surfaces[i])); }; free(surfaces); EXPECT_EQ(ILM_SUCCESS, ilm_commitChanges()); EXPECT_EQ(ILM_SUCCESS, ilmClient_destroy()); EXPECT_EQ(ILM_SUCCESS, ilm_destroy()); }
WLSurface::~WLSurface() { if (m_ilmSurfaceId > 0) ilm_surfaceRemove(m_ilmSurfaceId); if (m_wlSurface) wl_surface_destroy(m_wlSurface); }
TEST_F(NotificationTest, ilm_surfaceAddNotificationWithoutCallback) { // create a layer t_ilm_uint surface = 67; ilm_surfaceCreate((t_ilm_nativehandle)wlSurfaces[1],10,10,ILM_PIXELFORMAT_RGBA_8888,&surface); ilm_commitChanges(); // add notification ilmErrorTypes status = ilm_surfaceAddNotification(surface,NULL); ASSERT_EQ(ILM_SUCCESS, status); ilm_surfaceRemove(surface); ilm_commitChanges(); }
int main(int argc, char *argv[]) { ilmErrorTypes result = ILM_FAILED; t_ilm_layer layerid = (t_ilm_layer)LAYER_CHROMAKEY; t_ilm_surface surfaceid = (t_ilm_surface)SURFACE_CHROMAKEY; char* bitmapFile = NULL; int o; static const char opts[] = "f:c:h"; static const struct option longopts[] = { { "file", 1, NULL, 'f' }, { "color", 1, NULL, 'c' }, { "help", 1, NULL, 'h' }, { NULL, } }; unsigned int rgb[] = {255, 255, 255}; /* Default color key is 'White' */ while (o = getopt_long(argc, argv, opts, longopts, &o), o > 0) { switch (o) { case 'f': bitmapFile = optarg; break; case 'c': sscanf(optarg, "%d,%d,%d", &rgb[0], &rgb[1], &rgb[2]); break; case 'h': print_usage(); return 0; } } if (bitmapFile == NULL) { print_usage(); return -1; } printf("[INFO] bitmap file = %s\n", bitmapFile); printf("[INFO] color key = R(%d),G(%d),B(%d)\n", rgb[0], rgb[1], rgb[2]); /* signal handling */ signal(SIGINT, sigFunc); signal(SIGKILL, sigFunc); gRun = 1; memset(&g_wlContextStruct, 0x00, sizeof(g_wlContextStruct)); g_wlContextStruct.ctx_bmp = bmpaccessor_open(bitmapFile); if (NULL == g_wlContextStruct.ctx_bmp) { printf("Failed to create bmp accessor\n"); return -1; } do { createWLContext(); result = ilm_init(); if (ILM_SUCCESS == result) { printf("ilm_init success\n"); } else { printf("ilm_init failed\n"); break; } result = createILMAttribute(&layerid, &surfaceid, rgb); if (result != ILM_SUCCESS) { break; } t_ilm_layer layer[] = {1000, 2000, 3000, LAYER_CHROMAKEY}; ilm_displaySetRenderOrder(0, &layer[0], 4); ilm_commitChanges(); while(gRun) { drawImage(); } ilm_surfaceRemove(surfaceid); ilm_layerRemove(layerid); } while(0); ilm_destroy(); destroyWLContext(); bmpaccessor_close(g_wlContextStruct.ctx_bmp); return 0; }