本文整理汇总了C++中CD3DTexture::GetHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ CD3DTexture::GetHeight方法的具体用法?C++ CD3DTexture::GetHeight怎么用?C++ CD3DTexture::GetHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CD3DTexture
的用法示例。
在下文中一共展示了CD3DTexture::GetHeight方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RenderImpl
void CRendererSoftware::RenderImpl(CD3DTexture& target, CRect& sourceRect, CPoint(&destPoints)[4], uint32_t flags)
{
// if creation failed
if (!m_outputShader)
return;
CRenderBuffer* buf = m_renderBuffers[m_iBufferIndex];
// 1. convert yuv to rgb
m_sw_scale_ctx = sws_getCachedContext(m_sw_scale_ctx,
buf->GetWidth(), buf->GetHeight(), buf->av_format,
buf->GetWidth(), buf->GetHeight(), AV_PIX_FMT_BGRA,
SWS_FAST_BILINEAR, nullptr, nullptr, nullptr);
if (!m_sw_scale_ctx)
return;
sws_setColorspaceDetails(m_sw_scale_ctx,
sws_getCoefficients(buf->color_space), buf->full_range,
sws_getCoefficients(AVCOL_SPC_BT709), buf->full_range,
0, 1 << 16, 1 << 16);
uint8_t* src[YuvImage::MAX_PLANES];
int srcStride[YuvImage::MAX_PLANES];
buf->GetDataPlanes(src, srcStride);
D3D11_MAPPED_SUBRESOURCE mapping;
if (target.LockRect(0, &mapping, D3D11_MAP_WRITE_DISCARD))
{
uint8_t *dst[] = { static_cast<uint8_t*>(mapping.pData), nullptr, nullptr };
int dstStride[] = { static_cast<int>(mapping.RowPitch), 0, 0 };
sws_scale(m_sw_scale_ctx, src, srcStride, 0, std::min(target.GetHeight(), buf->GetHeight()), dst, dstStride);
if (!target.UnlockRect(0))
CLog::LogF(LOGERROR, "failed to unlock swtarget texture.");
}
else
CLog::LogF(LOGERROR, "failed to lock swtarget texture into memory.");
// rotate initial rect
ReorderDrawPoints(CRect(destPoints[0], destPoints[2]), destPoints);
}
示例2: RenderHW
void CWinRenderer::RenderHW(DWORD flags, CD3DTexture* target)
{
CRenderBuffer& buf = m_renderBuffers[m_iYV12RenderBuffer];
if ( buf.format != BUFFER_FMT_D3D11_BYPASS
&& buf.format != BUFFER_FMT_D3D11_NV12
&& buf.format != BUFFER_FMT_D3D11_P010
&& buf.format != BUFFER_FMT_D3D11_P016)
return;
if (!buf.loaded)
return;
int past = 0;
int future = 0;
CRenderBuffer* views[8];
memset(views, 0, 8 * sizeof(CRenderBuffer*));
views[2] = &buf;
// set future frames
while (future < 2)
{
bool found = false;
for (int i = 0; i < m_NumYV12Buffers; i++)
{
if (m_renderBuffers[i].frameIdx == buf.frameIdx + (future*2 + 2))
{
// a future frame may not be loaded yet
if (m_renderBuffers[i].loaded || m_renderBuffers[i].UploadBuffer())
{
views[1 - future++] = &m_renderBuffers[i];
found = true;
break;
}
}
}
if (!found)
break;
}
// set past frames
while (past < 4)
{
bool found = false;
for (int i = 0; i < m_NumYV12Buffers; i++)
{
if (m_renderBuffers[i].frameIdx == buf.frameIdx - (past*2 + 2))
{
if (m_renderBuffers[i].loaded)
{
views[3 + past++] = &m_renderBuffers[i];
found = true;
break;
}
}
}
if (!found)
break;
}
CRect destRect;
switch (m_renderOrientation)
{
case 90:
destRect = CRect(m_rotatedDestCoords[3], m_rotatedDestCoords[1]);
break;
case 180:
destRect = m_destRect;
break;
case 270:
destRect = CRect(m_rotatedDestCoords[1], m_rotatedDestCoords[3]);
break;
default:
destRect = m_bUseHQScaler ? m_sourceRect : CServiceBroker::GetWinSystem()->GetGfxContext().StereoCorrection(m_destRect);
break;
}
CRect src = m_sourceRect, dst = destRect;
CRect targetRect = CRect(0.0f, 0.0f,
static_cast<float>(m_IntermediateTarget.GetWidth()),
static_cast<float>(m_IntermediateTarget.GetHeight()));
if (target != DX::Windowing()->GetBackBuffer())
{
// rendering capture
targetRect.x2 = static_cast<float>(target->GetWidth());
targetRect.y2 = static_cast<float>(target->GetHeight());
}
CWIN32Util::CropSource(src, dst, targetRect, m_renderOrientation);
m_processor->Render(src, dst, m_IntermediateTarget.Get(), views, flags, buf.frameIdx, m_renderOrientation,
m_videoSettings.m_Contrast, m_videoSettings.m_Brightness);
if (!m_bUseHQScaler)
{
if ( CServiceBroker::GetWinSystem()->GetGfxContext().GetStereoMode() == RENDER_STEREO_MODE_SPLIT_HORIZONTAL
|| CServiceBroker::GetWinSystem()->GetGfxContext().GetStereoMode() == RENDER_STEREO_MODE_SPLIT_VERTICAL)
{
CD3DTexture *backBuffer = DX::Windowing()->GetBackBuffer();
CD3D11_VIEWPORT bbSize(0.f, 0.f, static_cast<float>(backBuffer->GetWidth()), static_cast<float>(backBuffer->GetHeight()));
//.........这里部分代码省略.........