static void STDMETHODCALLTYPE d2d_dc_render_target_PushLayer(ID2D1DCRenderTarget *iface, const D2D1_LAYER_PARAMETERS *layer_parameters, ID2D1Layer *layer) { struct d2d_dc_render_target *render_target = impl_from_ID2D1DCRenderTarget(iface); TRACE("iface %p, layer_parameters %p, layer %p.\n", iface, layer_parameters, layer); ID2D1RenderTarget_PushLayer(render_target->dxgi_target, layer_parameters, layer); }
static ID2D1Layer *applyClip(uiDrawContext *c) { ID2D1Layer *layer; D2D1_LAYER_PARAMETERS params; HRESULT hr; // if no clip, don't do anything if (c->currentClip == NULL) return NULL; // create a layer for clipping // we have to explicitly make the layer because we're still targeting Windows 7 // TODO MINGW BUG // this macro is supposed to take three parameters hr = (*(c->rt->lpVtbl->CreateLayer))(c->rt, NULL, &layer); if (hr != S_OK) logHRESULT("error creating clip layer in applyClip()", hr); // apply it as the clip ZeroMemory(¶ms, sizeof (D2D1_LAYER_PARAMETERS)); // this is the equivalent of InfiniteRect() in d2d1helper.h params.contentBounds.left = -FLT_MAX; params.contentBounds.top = -FLT_MAX; params.contentBounds.right = FLT_MAX; params.contentBounds.bottom = FLT_MAX; params.geometricMask = (ID2D1Geometry *) (c->currentClip); // TODO is this correct? params.maskAntialiasMode = ID2D1RenderTarget_GetAntialiasMode(c->rt); // identity matrix params.maskTransform._11 = 1; params.maskTransform._22 = 1; params.opacity = 1.0; params.opacityBrush = NULL; params.layerOptions = D2D1_LAYER_OPTIONS_NONE; // TODO is this correct? if (ID2D1RenderTarget_GetTextAntialiasMode(c->rt) == D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE) params.layerOptions = D2D1_LAYER_OPTIONS_INITIALIZE_FOR_CLEARTYPE; ID2D1RenderTarget_PushLayer(c->rt, ¶ms, layer); // return the layer so it can be freed later return layer; }