GrallocTextureHostOGL::GrallocTextureHostOGL(TextureFlags aFlags, const NewSurfaceDescriptorGralloc& aDescriptor) : TextureHost(aFlags) { android::GraphicBuffer* graphicBuffer = nullptr; gfx::SurfaceFormat format = gfx::SurfaceFormat::UNKNOWN; mSize = aDescriptor.size(); mGrallocActor = static_cast<GrallocBufferActor*>(aDescriptor.bufferParent()); if (mGrallocActor) { mGrallocActor->AddTextureHost(this); graphicBuffer = mGrallocActor->GetGraphicBuffer(); } if (graphicBuffer) { format = SurfaceFormatForAndroidPixelFormat(graphicBuffer->getPixelFormat(), aFlags & TEXTURE_RB_SWAPPED); } mTextureSource = new GrallocTextureSourceOGL(nullptr, graphicBuffer, format); }
GrallocTextureHostOGL::GrallocTextureHostOGL(uint64_t aID, TextureFlags aFlags, const NewSurfaceDescriptorGralloc& aDescriptor) : TextureHost(aID, aFlags) { mGrallocActor = static_cast<GrallocBufferActor*>(aDescriptor.bufferParent()); android::GraphicBuffer* graphicBuffer = mGrallocActor->GetGraphicBuffer(); mSize = aDescriptor.size(); gfx::SurfaceFormat format = SurfaceFormatForAndroidPixelFormat(graphicBuffer->getPixelFormat(), aFlags & TEXTURE_RB_SWAPPED); mTextureSource = new GrallocTextureSourceOGL(nullptr, graphicBuffer, format); }