static HRESULT create_rendertarget(HDC hdc, UINT32 width, UINT32 height, IDWriteBitmapRenderTarget **ret) { struct rendertarget *target; HRESULT hr; *ret = NULL; target = heap_alloc(sizeof(struct rendertarget)); if (!target) return E_OUTOFMEMORY; target->IDWriteBitmapRenderTarget1_iface.lpVtbl = &rendertargetvtbl; target->ref = 1; target->hdc = CreateCompatibleDC(hdc); hr = create_target_dibsection(target, width, height); if (FAILED(hr)) { IDWriteBitmapRenderTarget1_Release(&target->IDWriteBitmapRenderTarget1_iface); return hr; } target->m = identity; target->pixels_per_dip = 1.0; target->antialiasmode = DWRITE_TEXT_ANTIALIAS_MODE_CLEARTYPE; *ret = (IDWriteBitmapRenderTarget*)&target->IDWriteBitmapRenderTarget1_iface; return S_OK; }
static HRESULT create_rendertarget(HDC hdc, UINT32 width, UINT32 height, IDWriteBitmapRenderTarget **ret) { struct rendertarget *target; HRESULT hr; *ret = NULL; target = heap_alloc(sizeof(struct rendertarget)); if (!target) return E_OUTOFMEMORY; target->IDWriteBitmapRenderTarget_iface.lpVtbl = &rendertargetvtbl; target->ref = 1; target->size.cx = width; target->size.cy = height; target->hdc = CreateCompatibleDC(hdc); hr = create_target_dibsection(target->hdc, width, height); if (FAILED(hr)) { IDWriteBitmapRenderTarget_Release(&target->IDWriteBitmapRenderTarget_iface); return hr; } target->m.m11 = target->m.m22 = 1.0; target->m.m12 = target->m.m21 = 0.0; target->m.dx = target->m.dy = 0.0; *ret = &target->IDWriteBitmapRenderTarget_iface; return S_OK; }
static HRESULT WINAPI rendertarget_Resize(IDWriteBitmapRenderTarget1 *iface, UINT32 width, UINT32 height) { struct rendertarget *This = impl_from_IDWriteBitmapRenderTarget1(iface); TRACE("(%p)->(%u %u)\n", This, width, height); if (This->size.cx == width && This->size.cy == height) return S_OK; return create_target_dibsection(This, width, height); }