int xf_ResetGraphics(RdpgfxClientContext* context, RDPGFX_RESET_GRAPHICS_PDU* resetGraphics) { xfContext* xfc = (xfContext*) context->custom; if (xfc->codecs->rfx) { rfx_context_free(xfc->codecs->rfx); xfc->codecs->rfx = NULL; } xfc->codecs->rfx = rfx_context_new(FALSE); xfc->codecs->rfx->width = resetGraphics->width; xfc->codecs->rfx->height = resetGraphics->height; rfx_context_set_pixel_format(xfc->codecs->rfx, RDP_PIXEL_FORMAT_B8G8R8A8); if (xfc->codecs->nsc) { nsc_context_free(xfc->codecs->nsc); xfc->codecs->nsc = NULL; } xfc->codecs->nsc = nsc_context_new(); xfc->codecs->nsc->width = resetGraphics->width; xfc->codecs->nsc->height = resetGraphics->height; nsc_context_set_pixel_format(xfc->codecs->nsc, RDP_PIXEL_FORMAT_B8G8R8A8); if (xfc->codecs->clear) { clear_context_free(xfc->codecs->clear); xfc->codecs->clear = NULL; } xfc->codecs->clear = clear_context_new(FALSE); if (xfc->codecs->h264) { h264_context_free(xfc->codecs->h264); xfc->codecs->h264 = NULL; } xfc->codecs->h264 = h264_context_new(FALSE); if (xfc->codecs->progressive) { progressive_context_free(xfc->codecs->progressive); xfc->codecs->progressive = NULL; } xfc->codecs->progressive = progressive_context_new(TRUE); region16_init(&(xfc->invalidRegion)); xfc->graphicsReset = TRUE; return 1; }
void codecs_free(rdpCodecs* codecs) { if (!codecs) return; if (codecs->rfx) { rfx_context_free(codecs->rfx); codecs->rfx = NULL; } if (codecs->nsc) { nsc_context_free(codecs->nsc); codecs->nsc = NULL; } if (codecs->h264) { h264_context_free(codecs->h264); codecs->h264 = NULL; } if (codecs->clear) { clear_context_free(codecs->clear); codecs->clear = NULL; } if (codecs->progressive) { progressive_context_free(codecs->progressive); codecs->progressive = NULL; } if (codecs->planar) { freerdp_bitmap_planar_context_free(codecs->planar); codecs->planar = NULL; } if (codecs->interleaved) { bitmap_interleaved_context_free(codecs->interleaved); codecs->interleaved = NULL; } free(codecs); }
int test_progressive_ms_sample(char* ms_sample_path) { int count; int status; EGFX_SAMPLE_FILE files[3][4][4]; EGFX_SAMPLE_FILE bitmaps[3][4][4]; PROGRESSIVE_CONTEXT* progressive; g_Width = 1920; g_Height = 1080; g_DstStep = g_Width * 4; ZeroMemory(files, sizeof(files)); ZeroMemory(bitmaps, sizeof(bitmaps)); status = test_progressive_load_files(ms_sample_path, files); if (status < 0) return -1; status = test_progressive_load_bitmaps(ms_sample_path, bitmaps); if (status < 0) return -1; count = 4; progressive = progressive_context_new(FALSE); g_DstData = _aligned_malloc(g_DstStep * g_Height, 16); progressive_create_surface_context(progressive, 0, g_Width, g_Height); /* image 1 */ if (1) { printf("\nSample Image 1\n"); test_image_fill(g_DstData, g_DstStep, 0, 0, g_Width, g_Height, 0xFF000000); test_progressive_decode(progressive, files[0][0], bitmaps[0][0], 0, count); test_progressive_decode(progressive, files[0][1], bitmaps[0][1], 1, count); test_progressive_decode(progressive, files[0][2], bitmaps[0][2], 2, count); test_progressive_decode(progressive, files[0][3], bitmaps[0][3], 3, count); } /* image 2 */ if (0) { printf("\nSample Image 2\n"); /* sample data is in incorrect order */ test_image_fill(g_DstData, g_DstStep, 0, 0, g_Width, g_Height, 0xFF000000); test_progressive_decode(progressive, files[1][0], bitmaps[1][0], 0, count); test_progressive_decode(progressive, files[1][1], bitmaps[1][1], 1, count); test_progressive_decode(progressive, files[1][2], bitmaps[1][2], 2, count); test_progressive_decode(progressive, files[1][3], bitmaps[1][3], 3, count); } /* image 3 */ if (0) { printf("\nSample Image 3\n"); /* sample data is in incorrect order */ test_image_fill(g_DstData, g_DstStep, 0, 0, g_Width, g_Height, 0xFF000000); test_progressive_decode(progressive, files[2][0], bitmaps[2][0], 0, count); test_progressive_decode(progressive, files[2][1], bitmaps[2][1], 1, count); test_progressive_decode(progressive, files[2][2], bitmaps[2][2], 2, count); test_progressive_decode(progressive, files[2][3], bitmaps[2][3], 3, count); } progressive_context_free(progressive); _aligned_free(g_DstData); return 0; }