Ejemplo n.º 1
0
 virtual HRESULT STDMETHODCALLTYPE CreateMonitorRenderingParams(
     HMONITOR monitor,
     IDWriteRenderingParams** renderingParams
     )
 {
     return orig_this->CreateMonitorRenderingParams(monitor, renderingParams);
 }
Ejemplo n.º 2
0
bool CDirectWriteRenderer::UpdateRenderingParams()
{
	if (m_pRenderTarget == nullptr)
		return false;

	bool fUpdated = false;
	IDWriteFactory *pFactory = m_System.GetDWriteFactory();

	if (pFactory != nullptr) {
		IDWriteRenderingParams *pRenderingParams;

		HRESULT hr = pFactory->CreateMonitorRenderingParams(m_hMonitor, &pRenderingParams);
		if (SUCCEEDED(hr)) {
			if (m_RenderingParams.Mask != 0) {
				IDWriteRenderingParams *pCustomRenderingParams;
				hr = pFactory->CreateCustomRenderingParams(
					(m_RenderingParams.Mask & RenderingParams::PARAM_GAMMA) != 0 ?
						m_RenderingParams.Gamma : pRenderingParams->GetGamma(),
					(m_RenderingParams.Mask & RenderingParams::PARAM_ENHANCED_CONTRAST) != 0 ?
						m_RenderingParams.EnhancedContrast : pRenderingParams->GetEnhancedContrast(),
					(m_RenderingParams.Mask & RenderingParams::PARAM_CLEARTYPE_LEVEL) != 0 ?
						m_RenderingParams.ClearTypeLevel : pRenderingParams->GetClearTypeLevel(),
					(m_RenderingParams.Mask & RenderingParams::PARAM_PIXEL_GEOMETRY) != 0 ?
						m_RenderingParams.PixelGeometry : pRenderingParams->GetPixelGeometry(),
					(m_RenderingParams.Mask & RenderingParams::PARAM_RENDERING_MODE) != 0 ?
						m_RenderingParams.RenderingMode : pRenderingParams->GetRenderingMode(),
					&pCustomRenderingParams);
				if (SUCCEEDED(hr)) {
					m_pRenderTarget->SetTextRenderingParams(pCustomRenderingParams);
					pCustomRenderingParams->Release();
				}
			} else {
				m_pRenderTarget->SetTextRenderingParams(pRenderingParams);
			}

			if (SUCCEEDED(hr))
				fUpdated = true;

			pRenderingParams->Release();
		}

		pFactory->Release();
	}

	return fUpdated;
}