BufferTextureData* BufferTextureData::CreateForYCbCr(ClientIPCAllocator* aAllocator, gfx::IntSize aYSize, gfx::IntSize aCbCrSize, StereoMode aStereoMode, TextureFlags aTextureFlags) { uint32_t bufSize = ImageDataSerializer::ComputeYCbCrBufferSize(aYSize, aCbCrSize); if (bufSize == 0) { return nullptr; } uint32_t yOffset; uint32_t cbOffset; uint32_t crOffset; ImageDataSerializer::ComputeYCbCrOffsets(aYSize.width, aYSize.height, aCbCrSize.width, aCbCrSize.height, yOffset, cbOffset, crOffset); YCbCrDescriptor descriptor = YCbCrDescriptor(aYSize, aCbCrSize, yOffset, cbOffset, crOffset, aStereoMode); return CreateInternal(aAllocator, descriptor, gfx::BackendType::NONE, bufSize, aTextureFlags); }
BufferTextureData* BufferTextureData::CreateForYCbCr(KnowsCompositor* aAllocator, gfx::IntSize aYSize, gfx::IntSize aCbCrSize, StereoMode aStereoMode, TextureFlags aTextureFlags) { uint32_t bufSize = ImageDataSerializer::ComputeYCbCrBufferSize(aYSize, aCbCrSize); if (bufSize == 0) { return nullptr; } uint32_t yOffset; uint32_t cbOffset; uint32_t crOffset; ImageDataSerializer::ComputeYCbCrOffsets(aYSize.width, aYSize.height, aCbCrSize.width, aCbCrSize.height, yOffset, cbOffset, crOffset); bool hasIntermediateBuffer = aAllocator ? ComputeHasIntermediateBuffer(gfx::SurfaceFormat::YUV, aAllocator->GetCompositorBackendType()) : true; YCbCrDescriptor descriptor = YCbCrDescriptor(aYSize, aCbCrSize, yOffset, cbOffset, crOffset, aStereoMode, hasIntermediateBuffer); return CreateInternal(aAllocator ? aAllocator->GetTextureForwarder() : nullptr, descriptor, gfx::BackendType::NONE, bufSize, aTextureFlags); }
BufferTextureData* BufferTextureData::CreateForYCbCrWithBufferSize(KnowsCompositor* aAllocator, int32_t aBufferSize, YUVColorSpace aYUVColorSpace, uint32_t aBitDepth, TextureFlags aTextureFlags) { if (aBufferSize == 0 || !gfx::Factory::CheckBufferSize(aBufferSize)) { return nullptr; } bool hasIntermediateBuffer = aAllocator ? ComputeHasIntermediateBuffer(gfx::SurfaceFormat::YUV, aAllocator->GetCompositorBackendType()) : true; // Initialize the metadata with something, even if it will have to be rewritten // afterwards since we don't know the dimensions of the texture at this point. BufferDescriptor desc = YCbCrDescriptor(gfx::IntSize(), 0, gfx::IntSize(), 0, 0, 0, 0, StereoMode::MONO, aYUVColorSpace, aBitDepth, hasIntermediateBuffer); return CreateInternal(aAllocator ? aAllocator->GetTextureForwarder() : nullptr, desc, gfx::BackendType::NONE, aBufferSize, aTextureFlags); }
BufferTextureData* BufferTextureData::CreateForYCbCrWithBufferSize(ClientIPCAllocator* aAllocator, int32_t aBufferSize, TextureFlags aTextureFlags) { if (aBufferSize == 0 || !gfx::Factory::CheckBufferSize(aBufferSize)) { return nullptr; } // Initialize the metadata with something, even if it will have to be rewritten // afterwards since we don't know the dimensions of the texture at this point. BufferDescriptor desc = YCbCrDescriptor(gfx::IntSize(), gfx::IntSize(), 0, 0, 0, StereoMode::MONO); return CreateInternal(aAllocator, desc, gfx::BackendType::NONE, aBufferSize, aTextureFlags); }