+ /* Filled by pool::lock() */
+ p_pic_buffer = NULL;
+ i_pic_pitch = 0;
+#else
+ /* Initialize offscreen bitmap */
+ BITMAPINFO *bi = &sys->bitmapinfo;
+ memset(bi, 0, sizeof(BITMAPINFO) + 3 * sizeof(RGBQUAD));
+ if (sys->i_depth > 8) {
+ ((DWORD*)bi->bmiColors)[0] = fmt->i_rmask;
+ ((DWORD*)bi->bmiColors)[1] = fmt->i_gmask;
+ ((DWORD*)bi->bmiColors)[2] = fmt->i_bmask;;
+ }
+
+ BITMAPINFOHEADER *bih = &sys->bitmapinfo.bmiHeader;
+ bih->biSize = sizeof(BITMAPINFOHEADER);
+ bih->biSizeImage = 0;
+ bih->biPlanes = 1;
+ bih->biCompression = (sys->i_depth == 15 ||
+ sys->i_depth == 16) ? BI_BITFIELDS : BI_RGB;
+ bih->biBitCount = sys->i_depth;
+ bih->biWidth = fmt->i_width;
+ bih->biHeight = -fmt->i_height;
+ bih->biClrImportant = 0;
+ bih->biClrUsed = 0;
+ bih->biXPelsPerMeter = 0;
+ bih->biYPelsPerMeter = 0;
+
+ i_pic_pitch = bih->biBitCount * bih->biWidth / 8;
+ sys->off_bitmap = CreateDIBSection(window_dc,
+ (BITMAPINFO *)bih,
+ DIB_RGB_COLORS,
+ &p_pic_buffer, NULL, 0);
+
+ sys->off_dc = CreateCompatibleDC(window_dc);
+
+ SelectObject(sys->off_dc, sys->off_bitmap);
+ ReleaseDC(sys->hvideownd, window_dc);
+
+ EventThreadUpdateTitle(sys->event, VOUT_TITLE " (WinGDI output)");
+#endif
+
+ /* */
+ picture_resource_t rsc;
+ memset(&rsc, 0, sizeof(rsc));
+#ifdef MODULE_NAME_IS_wingapi
+ rsc.p_sys = malloc(sizeof(*rsc.p_sys));
+ if (!rsc.p_sys)
+ return VLC_EGENERIC;
+ rsc.p_sys->vd = vd;
+#endif
+ rsc.p[0].p_pixels = p_pic_buffer;
+ rsc.p[0].i_lines = fmt->i_height;
+ rsc.p[0].i_pitch = i_pic_pitch;;
+
+ picture_t *picture = picture_NewFromResource(fmt, &rsc);
+ if (picture) {
+ picture_pool_configuration_t cfg;
+ memset(&cfg, 0, sizeof(cfg));
+ cfg.picture_count = 1;
+ cfg.picture = &picture;
+#ifdef MODULE_NAME_IS_wingapi
+ cfg.lock = Lock;
+ cfg.unlock = Unlock;
+#endif
+ sys->pool = picture_pool_NewExtended(&cfg);
+ } else {
+ free(rsc.p_sys);
+ sys->pool = NULL;
+ }