本文整理汇总了C++中SharedImage::get_YCbCrImage方法的典型用法代码示例。如果您正苦于以下问题:C++ SharedImage::get_YCbCrImage方法的具体用法?C++ SharedImage::get_YCbCrImage怎么用?C++ SharedImage::get_YCbCrImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SharedImage
的用法示例。
在下文中一共展示了SharedImage::get_YCbCrImage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: shmemImage
void
ShadowImageLayerOGL::RenderLayer(int aPreviousFrameBuffer,
const nsIntPoint& aOffset)
{
if (mOGLManager->CompositingDisabled()) {
return;
}
mOGLManager->MakeCurrent();
if (mImageContainerID) {
ImageContainerParent::SetCompositorIDForImage(mImageContainerID,
mOGLManager->GetCompositorID());
uint32_t imgVersion = ImageContainerParent::GetSharedImageVersion(mImageContainerID);
SharedImage* img = ImageContainerParent::GetSharedImage(mImageContainerID);
if (imgVersion != mImageVersion) {
if (img && (img->type() == SharedImage::TYUVImage)) {
UploadSharedYUVToTexture(img->get_YUVImage());
mImageVersion = imgVersion;
} else if (img && (img->type() == SharedImage::TYCbCrImage)) {
ShmemYCbCrImage shmemImage(img->get_YCbCrImage().data(),
img->get_YCbCrImage().offset());
UploadSharedYCbCrToTexture(shmemImage, img->get_YCbCrImage().picture());
mImageVersion = imgVersion;
} else if (img && (img->type() == SharedImage::TRGBImage)) {
UploadSharedRGBToTexture(&img->get_RGBImage().data(),
img->get_RGBImage().picture(),
img->get_RGBImage().rgbFormat());
mImageVersion = imgVersion;
}
}
#ifdef MOZ_WIDGET_GONK
if (img
&& (img->type() == SharedImage::TSurfaceDescriptor)
&& (img->get_SurfaceDescriptor().type() == SurfaceDescriptor::TSurfaceDescriptorGralloc)) {
const SurfaceDescriptorGralloc& desc = img->get_SurfaceDescriptor().get_SurfaceDescriptorGralloc();
sp<GraphicBuffer> graphicBuffer = GrallocBufferActor::GetFrom(desc);
mSize = gfxIntSize(graphicBuffer->getWidth(), graphicBuffer->getHeight());
if (!mExternalBufferTexture.IsAllocated()) {
mExternalBufferTexture.Allocate(gl());
}
gl()->MakeCurrent();
gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
gl()->BindExternalBuffer(mExternalBufferTexture.GetTextureID(), graphicBuffer->getNativeBuffer());
mImageVersion = imgVersion;
}
#endif
}
if (mTexImage) {
NS_ASSERTION(mTexImage->GetContentType() != gfxASurface::CONTENT_ALPHA,
"Image layer has alpha image");
ShaderProgramOGL *colorProgram =
mOGLManager->GetProgram(mTexImage->GetShaderProgramType(), GetMaskLayer());
colorProgram->Activate();
colorProgram->SetTextureUnit(0);
colorProgram->SetLayerTransform(GetEffectiveTransform());
colorProgram->SetLayerOpacity(GetEffectiveOpacity());
colorProgram->SetRenderOffset(aOffset);
colorProgram->LoadMask(GetMaskLayer());
mTexImage->SetFilter(mFilter);
mTexImage->BeginTileIteration();
if (gl()->CanUploadNonPowerOfTwo()) {
do {
nsIntRect rect = mTexImage->GetTileRect();
if (!rect.IsEmpty()) {
TextureImage::ScopedBindTextureAndApplyFilter texBind(mTexImage, LOCAL_GL_TEXTURE0);
colorProgram->SetLayerQuadRect(rect);
mOGLManager->BindAndDrawQuad(colorProgram);
}
} while (mTexImage->NextTile());
} else {
do {
nsIntRect rect = mTexImage->GetTileRect();
if (!rect.IsEmpty()) {
TextureImage::ScopedBindTextureAndApplyFilter texBind(mTexImage, LOCAL_GL_TEXTURE0);
colorProgram->SetLayerQuadRect(rect);
// We can't use BindAndDrawQuad because that always uploads the whole texture from 0.0f -> 1.0f
// in x and y. We use BindAndDrawQuadWithTextureRect to actually draw a subrect of the texture
mOGLManager->BindAndDrawQuadWithTextureRect(colorProgram,
nsIntRect(0, 0, mTexImage->GetTileRect().width,
mTexImage->GetTileRect().height),
mTexImage->GetTileRect().Size());
}
} while (mTexImage->NextTile());
}
#ifdef MOZ_WIDGET_GONK
} else if (mExternalBufferTexture.IsAllocated()) {
gl()->MakeCurrent();
gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
gl()->fBindTexture(LOCAL_GL_TEXTURE_EXTERNAL, mExternalBufferTexture.GetTextureID());
ShaderProgramOGL *program = mOGLManager->GetProgram(RGBAExternalLayerProgramType, GetMaskLayer());
gl()->ApplyFilterToBoundTexture(LOCAL_GL_TEXTURE_EXTERNAL, mFilter);
//.........这里部分代码省略.........