本文整理汇总了C++中SharedSurface::WaitSync方法的典型用法代码示例。如果您正苦于以下问题:C++ SharedSurface::WaitSync方法的具体用法?C++ SharedSurface::WaitSync怎么用?C++ SharedSurface::WaitSync使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SharedSurface
的用法示例。
在下文中一共展示了SharedSurface::WaitSync方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: boundsSize
void
CanvasLayerD3D9::UpdateSurface()
{
if (!IsDirty() && mTexture)
return;
Painted();
if (!mTexture) {
CreateTexture();
if (!mTexture) {
NS_WARNING("CanvasLayerD3D9::Updated called but no texture present and creation failed!");
return;
}
}
// WebGL reads entire surface.
LockTextureRectD3D9 textureLock(mTexture);
if (!textureLock.HasLock()) {
NS_WARNING("Failed to lock CanvasLayer texture.");
return;
}
D3DLOCKED_RECT rect = textureLock.GetLockRect();
IntSize boundsSize(mBounds.width, mBounds.height);
RefPtr<DrawTarget> rectDt = Factory::CreateDrawTargetForData(BackendType::CAIRO,
(uint8_t*)rect.pBits,
boundsSize,
rect.Pitch,
SurfaceFormat::B8G8R8A8);
if (mGLContext) {
auto screen = mGLContext->Screen();
MOZ_ASSERT(screen);
SharedSurface* surf = screen->Front()->Surf();
if (!surf)
return;
surf->WaitSync();
if (!ReadbackSharedSurface(surf, rectDt)) {
NS_WARNING("Failed to readback into texture.");
}
} else {
RefPtr<SourceSurface> surface = mDrawTarget->Snapshot();
Rect drawRect(0, 0, surface->GetSize().width, surface->GetSize().height);
rectDt->DrawSurface(surface, drawRect, drawRect,
DrawSurfaceOptions(), DrawOptions(1.0F, CompositionOp::OP_SOURCE));
rectDt->Flush();
}
}
示例2:
SharedSurface*
SurfaceStream::SwapConsumer()
{
MOZ_ASSERT(mIsAlive);
SharedSurface* ret = SwapConsumer_NoWait();
if (!ret)
return nullptr;
if (!ret->WaitSync()) {
return nullptr;
}
return ret;
}