DWriteRenderingParams * DWriteContext::GetRenderingParams( DWriteRenderingParams *params) { if (params != NULL && mRenderingParams != NULL) { params->gamma = mRenderingParams->GetGamma(); params->enhancedContrast = mRenderingParams->GetEnhancedContrast(); params->clearTypeLevel = mRenderingParams->GetClearTypeLevel(); params->pixelGeometry = ToInt(mRenderingParams->GetPixelGeometry()); params->renderingMode = ToInt(mRenderingParams->GetRenderingMode()); params->textAntialiasMode = mTextAntialiasMode; } return params; }
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; }