当前位置: 首页>>代码示例>>C++>>正文


C++ SurfaceDescriptor::get_SurfaceStreamDescriptor方法代码示例

本文整理汇总了C++中SurfaceDescriptor::get_SurfaceStreamDescriptor方法的典型用法代码示例。如果您正苦于以下问题:C++ SurfaceDescriptor::get_SurfaceStreamDescriptor方法的具体用法?C++ SurfaceDescriptor::get_SurfaceStreamDescriptor怎么用?C++ SurfaceDescriptor::get_SurfaceStreamDescriptor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SurfaceDescriptor的用法示例。


在下文中一共展示了SurfaceDescriptor::get_SurfaceStreamDescriptor方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CreateTextureClient

void
CanvasClientSurfaceStream::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
{
  if (!mTextureClient) {
    mTextureClient = CreateTextureClient(TEXTURE_STREAM_GL);
    MOZ_ASSERT(mTextureClient, "Failed to create texture client");
  }

  NS_ASSERTION(aLayer->mGLContext, "CanvasClientSurfaceStream should only be used with GL canvases");

  // the content type won't be used
  mTextureClient->EnsureAllocated(aSize, gfxASurface::CONTENT_COLOR);

  GLScreenBuffer* screen = aLayer->mGLContext->Screen();
  SurfaceStream* stream = screen->Stream();

  bool isCrossProcess = !(XRE_GetProcessType() == GoannaProcessType_Default);
  if (isCrossProcess) {
    // swap staging -> consumer so we can send it to the compositor
    SharedSurface* surf = stream->SwapConsumer();
    if (!surf) {
      printf_stderr("surf is null post-SwapConsumer!\n");
      return;
    }

#ifdef MOZ_WIDGET_GONK
    if (surf->Type() != SharedSurfaceType::Gralloc) {
      printf_stderr("Unexpected non-Gralloc SharedSurface in IPC path!");
      return;
    }

    SharedSurface_Gralloc* grallocSurf = SharedSurface_Gralloc::Cast(surf);
    mTextureClient->SetDescriptor(grallocSurf->GetDescriptor());
#else
    printf_stderr("isCrossProcess, but not MOZ_WIDGET_GONK! Someone needs to write some code!");
    MOZ_ASSERT(false);
#endif
    mNeedsUpdate = true;
  } else {
    SurfaceStreamHandle handle = stream->GetShareHandle();
    SurfaceDescriptor *desc = mTextureClient->GetDescriptor();
    if (desc->type() != SurfaceDescriptor::TSurfaceStreamDescriptor ||
        desc->get_SurfaceStreamDescriptor().handle() != handle) {
      *desc = SurfaceStreamDescriptor(handle, false);

      // Ref this so the SurfaceStream doesn't disappear unexpectedly. The
      // Compositor will need to unref it when finished.
      aLayer->mGLContext->AddRef();
      
      mNeedsUpdate = true;
    }
  }

  aLayer->Painted();
}
开发者ID:Pulfer,项目名称:Pale-Moon,代码行数:55,代码来源:CanvasClient.cpp

示例2: CreateBackendIndependentTextureHost

// static
TemporaryRef<TextureHost>
TextureHost::Create(const SurfaceDescriptor& aDesc,
                    ISurfaceAllocator* aDeallocator,
                    TextureFlags aFlags)
{
  switch (aDesc.type()) {
    case SurfaceDescriptor::TSurfaceDescriptorShmem:
    case SurfaceDescriptor::TSurfaceDescriptorMemory:
      return CreateBackendIndependentTextureHost(aDesc, aDeallocator, aFlags);

    case SurfaceDescriptor::TSharedTextureDescriptor:
    case SurfaceDescriptor::TNewSurfaceDescriptorGralloc:
      return CreateTextureHostOGL(aDesc, aDeallocator, aFlags);

    case SurfaceDescriptor::TSurfaceStreamDescriptor:
      return new StreamTextureHost(aFlags, aDesc.get_SurfaceStreamDescriptor());

    case SurfaceDescriptor::TSurfaceDescriptorMacIOSurface:
      if (Compositor::GetBackend() == LayersBackend::LAYERS_OPENGL) {
        return CreateTextureHostOGL(aDesc, aDeallocator, aFlags);
      } else {
        return CreateTextureHostBasic(aDesc, aDeallocator, aFlags);
      }

#ifdef MOZ_X11
    case SurfaceDescriptor::TSurfaceDescriptorX11: {
      const SurfaceDescriptorX11& desc = aDesc.get_SurfaceDescriptorX11();
      RefPtr<TextureHost> result = new X11TextureHost(aFlags, desc);
      return result;
    }
#endif

#ifdef XP_WIN
    case SurfaceDescriptor::TSurfaceDescriptorD3D9:
    case SurfaceDescriptor::TSurfaceDescriptorDIB:
      return CreateTextureHostD3D9(aDesc, aDeallocator, aFlags);

    case SurfaceDescriptor::TSurfaceDescriptorD3D10:
      if (Compositor::GetBackend() == LayersBackend::LAYERS_D3D9) {
        return CreateTextureHostD3D9(aDesc, aDeallocator, aFlags);
      } else {
        return CreateTextureHostD3D11(aDesc, aDeallocator, aFlags);
      }
#endif
    default:
      MOZ_CRASH("Unsupported Surface type");
  }
}
开发者ID:aeddi,项目名称:gecko-dev,代码行数:49,代码来源:TextureHost.cpp

示例3: switch

TemporaryRef<TextureHost>
CreateTextureHostOGL(const SurfaceDescriptor& aDesc,
                     ISurfaceAllocator* aDeallocator,
                     TextureFlags aFlags)
{
    RefPtr<TextureHost> result;
    switch (aDesc.type()) {
    case SurfaceDescriptor::TSurfaceDescriptorShmem:
    case SurfaceDescriptor::TSurfaceDescriptorMemory: {
        result = CreateBackendIndependentTextureHost(aDesc,
                 aDeallocator, aFlags);
        break;
    }
    case SurfaceDescriptor::TSharedTextureDescriptor: {
        const SharedTextureDescriptor& desc = aDesc.get_SharedTextureDescriptor();
        result = new SharedTextureHostOGL(aFlags,
                                          desc.shareType(),
                                          desc.handle(),
                                          desc.size(),
                                          desc.inverted());
        break;
    }
    case SurfaceDescriptor::TSurfaceStreamDescriptor: {
        const SurfaceStreamDescriptor& desc = aDesc.get_SurfaceStreamDescriptor();
        result = new StreamTextureHostOGL(aFlags, desc);
        break;
    }
#ifdef XP_MACOSX
    case SurfaceDescriptor::TSurfaceDescriptorMacIOSurface: {
        const SurfaceDescriptorMacIOSurface& desc =
            aDesc.get_SurfaceDescriptorMacIOSurface();
        result = new MacIOSurfaceTextureHostOGL(aFlags, desc);
        break;
    }
#endif
#ifdef MOZ_WIDGET_GONK
    case SurfaceDescriptor::TNewSurfaceDescriptorGralloc: {
        const NewSurfaceDescriptorGralloc& desc =
            aDesc.get_NewSurfaceDescriptorGralloc();
        result = new GrallocTextureHostOGL(aFlags, desc);
        break;
    }
#endif
    default:
        return nullptr;
    }
    return result.forget();
}
开发者ID:,项目名称:,代码行数:48,代码来源:

示例4:

void
SurfaceStreamHostOGL::UpdateImpl(const SurfaceDescriptor& aImage,
                                 nsIntRegion* aRegion,
                                 nsIntPoint* aOffset)
{
  MOZ_ASSERT(aImage.type() == SurfaceDescriptor::TSurfaceStreamDescriptor,
             "Invalid descriptor");

  // Bug 894405
  //
  // The SurfaceStream's GLContext was refed before being passed up to us, so
  // we need to ensure it gets unrefed when we are finished.
  const SurfaceStreamDescriptor& streamDesc =
      aImage.get_SurfaceStreamDescriptor();

  SurfaceStream *stream = SurfaceStream::FromHandle(streamDesc.handle());
  if (stream == mStream) {
    return;
  }
  mStream = stream;
  MOZ_ASSERT(mStream);
  mStreamGL = dont_AddRef(mStream->GLContext());
}
开发者ID:captainbrosset,项目名称:mozilla-central,代码行数:23,代码来源:TextureHostOGL.cpp


注:本文中的SurfaceDescriptor::get_SurfaceStreamDescriptor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。