• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ byRef函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中byRef函数的典型用法代码示例。如果您正苦于以下问题:C++ byRef函数的具体用法?C++ byRef怎么用?C++ byRef使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: MOZ_ASSERT

CompositingRenderTargetD3D11::CompositingRenderTargetD3D11(ID3D11Texture2D* aTexture)
{
  MOZ_ASSERT(aTexture);
  
  mTextures[0] = aTexture;

  RefPtr<ID3D11Device> device;
  mTextures[0]->GetDevice(byRef(device));

  HRESULT hr = device->CreateRenderTargetView(mTextures[0], nullptr, byRef(mRTView));

  if (FAILED(hr)) {
    LOGD3D11("Failed to create RenderTargetView.");
  }
}
开发者ID:jasager,项目名称:mozilla-central,代码行数:15,代码来源:TextureD3D11.cpp


示例2: DataSourceSurfaceD2DTarget

already_AddRefed<DataSourceSurface>
SourceSurfaceD2DTarget::GetDataSurface()
{
  RefPtr<DataSourceSurfaceD2DTarget> dataSurf =
    new DataSourceSurfaceD2DTarget(mFormat);

  D3D10_TEXTURE2D_DESC desc;
  mTexture->GetDesc(&desc);

  desc.CPUAccessFlags = D3D10_CPU_ACCESS_READ;
  desc.Usage = D3D10_USAGE_STAGING;
  desc.BindFlags = 0;
  desc.MiscFlags = 0;

  if (!Factory::GetDirect3D10Device()) {
    gfxCriticalError() << "Invalid D3D10 device in D2D target surface";
    return nullptr;
  }

  HRESULT hr = Factory::GetDirect3D10Device()->CreateTexture2D(&desc, nullptr, byRef(dataSurf->mTexture));

  if (FAILED(hr)) {
    gfxDebug() << "Failed to create staging texture for SourceSurface. Code: " << hexa(hr);
    return nullptr;
  }
  Factory::GetDirect3D10Device()->CopyResource(dataSurf->mTexture, mTexture);

  return dataSurf.forget();
}
开发者ID:Jar-win,项目名称:Waterfox,代码行数:29,代码来源:SourceSurfaceD2DTarget.cpp


示例3: gfxDebug

bool
SourceSurfaceD2D::InitFromData(unsigned char *aData,
                               const IntSize &aSize,
                               int32_t aStride,
                               SurfaceFormat aFormat,
                               ID2D1RenderTarget *aRT)
{
  HRESULT hr;

  mFormat = aFormat;
  mSize = aSize;

  if ((uint32_t)aSize.width > aRT->GetMaximumBitmapSize() ||
      (uint32_t)aSize.height > aRT->GetMaximumBitmapSize()) {
    gfxDebug() << "Bitmap does not fit in texture.";
    return false;
  }

  D2D1_BITMAP_PROPERTIES props =
    D2D1::BitmapProperties(D2D1::PixelFormat(DXGIFormat(aFormat), AlphaMode(aFormat)));
  hr = aRT->CreateBitmap(D2DIntSize(aSize), aData, aStride, props, byRef(mBitmap));

  if (FAILED(hr)) {
    gfxWarning() << "Failed to create D2D Bitmap for data. Code: " << hr;
    return false;
  }

  DrawTargetD2D::mVRAMUsageSS += GetByteSize();
  mDevice = Factory::GetDirect3D10Device();

  return true;
}
开发者ID:Incognito,项目名称:mozilla-central,代码行数:32,代码来源:SourceSurfaceD2D.cpp


示例4: NS_ENSURE_TRUE

HRESULT
MFTDecoder::SetDecoderOutputType(ConfigureOutputCallback aCallback, void* aData)
{
  NS_ENSURE_TRUE(mDecoder != nullptr, E_POINTER);

  // Iterate the enumerate the output types, until we find one compatible
  // with what we need.
  HRESULT hr;
  RefPtr<IMFMediaType> outputType;
  UINT32 typeIndex = 0;
  while (SUCCEEDED(mDecoder->GetOutputAvailableType(0, typeIndex++, byRef(outputType)))) {
    BOOL resultMatch;
    hr = mOutputType->Compare(outputType, MF_ATTRIBUTES_MATCH_OUR_ITEMS, &resultMatch);
    if (SUCCEEDED(hr) && resultMatch == TRUE) {
      if (aCallback) {
        hr = aCallback(outputType, aData);
        NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
      }
      hr = mDecoder->SetOutputType(0, outputType, 0);
      NS_ENSURE_TRUE(SUCCEEDED(hr), hr);

      hr = mDecoder->GetOutputStreamInfo(0, &mOutputStreamInfo);
      NS_ENSURE_TRUE(SUCCEEDED(hr), hr);

      mMFTProvidesOutputSamples = IsFlagSet(mOutputStreamInfo.dwFlags, MFT_OUTPUT_STREAM_PROVIDES_SAMPLES);

      return S_OK;
    }
    outputType = nullptr;
  }
  return E_FAIL;
}
开发者ID:lgarner,项目名称:mozilla-central,代码行数:32,代码来源:MFTDecoder.cpp


示例5: byRef

void
SourceSurfaceD2DTarget::DrawTargetWillChange()
{
  RefPtr<ID3D10Texture2D> oldTexture = mTexture;

  D3D10_TEXTURE2D_DESC desc;
  mTexture->GetDesc(&desc);

  // Our original texture might implement the keyed mutex flag. We shouldn't
  // need that here. We actually specifically don't want it since we don't lock
  // our texture for usage!
  desc.MiscFlags = 0;

  // Get a copy of the surface data so the content at snapshot time was saved.
  Factory::GetDirect3D10Device()->CreateTexture2D(&desc, nullptr, byRef(mTexture));
  Factory::GetDirect3D10Device()->CopyResource(mTexture, oldTexture);

  mBitmap = nullptr;

  DrawTargetD2D::mVRAMUsageSS += desc.Width * desc.Height * BytesPerPixel(mFormat);
  mOwnsCopy = true;

  // We now no longer depend on the source surface content remaining the same.
  MarkIndependent();
}
开发者ID:gp-b2g,项目名称:gp-revolution-gecko,代码行数:25,代码来源:SourceSurfaceD2DTarget.cpp


示例6: mustBeRef

bool Func::mustBeRef(int32_t arg) const {
  if (byRef(arg)) {
    return arg < m_numParams || !(m_attrs & AttrVariadicByRef) ||
      !info() || !(info()->attribute & ClassInfo::MixedVariableArguments);
  }
  return false;
}
开发者ID:GitOrganization,项目名称:hiphop-php,代码行数:7,代码来源:func.cpp


示例7: D2DPixelFormat

TemporaryRef<SourceSurface>
DrawTargetD2D1::OptimizeSourceSurface(SourceSurface* aSurface) const
{
  if (aSurface->GetType() == SurfaceType::D2D1_1_IMAGE) {
    return aSurface;
  }

  RefPtr<DataSourceSurface> data = aSurface->GetDataSurface();

  DataSourceSurface::MappedSurface map;
  if (!data->Map(DataSourceSurface::MapType::READ, &map)) {
    return nullptr;
  }

  RefPtr<ID2D1Bitmap1> bitmap;
  HRESULT hr = mDC->CreateBitmap(D2DIntSize(data->GetSize()), map.mData, map.mStride,
                                 D2D1::BitmapProperties1(D2D1_BITMAP_OPTIONS_NONE, D2DPixelFormat(data->GetFormat())),
                                 byRef(bitmap));

  data->Unmap();

  if (!bitmap) {
    return data;
  }

  return new SourceSurfaceD2D1(bitmap.get(), mDC, data->GetFormat(), data->GetSize());
}
开发者ID:Wrichik1999,项目名称:gecko-dev,代码行数:27,代码来源:DrawTargetD2D1.cpp


示例8: gfxWarning

bool
SourceSurfaceD2D::InitFromTexture(ID3D10Texture2D *aTexture,
                                  SurfaceFormat aFormat,
                                  ID2D1RenderTarget *aRT)
{
  HRESULT hr;

  RefPtr<IDXGISurface> surf;

  hr = aTexture->QueryInterface((IDXGISurface**)&surf);

  if (FAILED(hr)) {
    gfxWarning() << "Failed to QI texture to surface. Code: " << hr;
    return false;
  }

  D3D10_TEXTURE2D_DESC desc;
  aTexture->GetDesc(&desc);

  mSize = IntSize(desc.Width, desc.Height);
  mFormat = aFormat;

  D2D1_BITMAP_PROPERTIES props =
    D2D1::BitmapProperties(D2D1::PixelFormat(DXGIFormat(aFormat), AlphaMode(aFormat)));
  hr = aRT->CreateSharedBitmap(IID_IDXGISurface, surf, &props, byRef(mBitmap));

  if (FAILED(hr)) {
    gfxWarning() << "Failed to create SharedBitmap. Code: " << hr;
    return false;
  }

  DrawTargetD2D::mVRAMUsageSS += GetByteSize();

  return true;
}
开发者ID:lofter2011,项目名称:Icefox,代码行数:35,代码来源:SourceSurfaceD2D.cpp


示例9: newDesc

bool
TextureClientD3D11::AllocateForSurface(gfx::IntSize aSize, TextureAllocationFlags aFlags)
{
  mSize = aSize;
  ID3D10Device* device = gfxWindowsPlatform::GetPlatform()->GetD3D10Device();

  CD3D10_TEXTURE2D_DESC newDesc(DXGI_FORMAT_B8G8R8A8_UNORM,
                                aSize.width, aSize.height, 1, 1,
                                D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE);

  newDesc.MiscFlags = D3D10_RESOURCE_MISC_SHARED_KEYEDMUTEX;

  HRESULT hr = device->CreateTexture2D(&newDesc, nullptr, byRef(mTexture));

  if (FAILED(hr)) {
    LOGD3D11("Error creating texture for client!");
    return false;
  }

  // Defer clearing to the next time we lock to avoid an extra (expensive) lock.
  mNeedsClear = aFlags & ALLOC_CLEAR_BUFFER;
  mNeedsClearWhite = aFlags & ALLOC_CLEAR_BUFFER_WHITE;

  return true;
}
开发者ID:chenhequn,项目名称:gecko,代码行数:25,代码来源:TextureD3D11.cpp


示例10: __uuidof

void
SharedSurface_ANGLEShareHandle::ConsumerAcquireImpl()
{
    if (!mConsumerTexture) {
        RefPtr<ID3D11Texture2D> tex;
        HRESULT hr = gfxWindowsPlatform::GetPlatform()->GetD3D11Device()->OpenSharedResource(mShareHandle,
                                                                                             __uuidof(ID3D11Texture2D),
                                                                                             (void**)(ID3D11Texture2D**)byRef(tex));
        if (SUCCEEDED(hr)) {
            mConsumerTexture = tex;
            RefPtr<IDXGIKeyedMutex> mutex;
            hr = tex->QueryInterface((IDXGIKeyedMutex**)byRef(mutex));

            if (SUCCEEDED(hr)) {
                mConsumerKeyedMutex = mutex;
            }
        }
    }

    if (mConsumerKeyedMutex) {
      HRESULT hr = mConsumerKeyedMutex->AcquireSync(0, 10000);
      if (hr == WAIT_TIMEOUT) {
        MOZ_CRASH();
      }
    }
}
开发者ID:JasonJinCn,项目名称:gecko-dev,代码行数:26,代码来源:SharedSurfaceANGLE.cpp


示例11: D2DColor

TemporaryRef<GradientStops>
DrawTargetD2D1::CreateGradientStops(GradientStop *rawStops, uint32_t aNumStops, ExtendMode aExtendMode) const
{
  D2D1_GRADIENT_STOP *stops = new D2D1_GRADIENT_STOP[aNumStops];

  for (uint32_t i = 0; i < aNumStops; i++) {
    stops[i].position = rawStops[i].offset;
    stops[i].color = D2DColor(rawStops[i].color);
  }

  RefPtr<ID2D1GradientStopCollection> stopCollection;

  HRESULT hr =
    mDC->CreateGradientStopCollection(stops, aNumStops,
                                      D2D1_GAMMA_2_2, D2DExtend(aExtendMode),
                                      byRef(stopCollection));
  delete [] stops;

  if (FAILED(hr)) {
    gfxWarning() << *this << ": Failed to create GradientStopCollection. Code: " << hr;
    return nullptr;
  }

  return new GradientStopsD2D(stopCollection);
}
开发者ID:Wrichik1999,项目名称:gecko-dev,代码行数:25,代码来源:DrawTargetD2D1.cpp


示例12: MOZ_ASSERT

ID3D11ShaderResourceView*
TextureSourceD3D11::GetShaderResourceView()
{
  MOZ_ASSERT(mTexture == GetD3D11Texture(), "You need to override GetShaderResourceView if you're overriding GetD3D11Texture!");

  if (!mSRV && mTexture) {
    RefPtr<ID3D11Device> device;
    mTexture->GetDevice(byRef(device));
    HRESULT hr = device->CreateShaderResourceView(mTexture, nullptr, byRef(mSRV));
    if (FAILED(hr)) {
      gfxCriticalError(CriticalLog::DefaultOptions(false)) << "[D3D11] TextureSourceD3D11:GetShaderResourceView CreateSRV failure " << gfx::hexa(hr);
      return nullptr;
    }
  }
  return mSRV;
}
开发者ID:JasonJinCn,项目名称:gecko-dev,代码行数:16,代码来源:TextureD3D11.cpp


示例13: NS_ENSURE_TRUE

STDMETHODIMP
WMFByteStream::EndRead(IMFAsyncResult* aResult, ULONG *aBytesRead)
{
  NS_ENSURE_TRUE(aResult, E_POINTER);
  NS_ENSURE_TRUE(aBytesRead, E_POINTER);

  ReentrantMonitorAutoEnter mon(mReentrantMonitor);

  // Extract our state object.
  RefPtr<IUnknown> unknown;
  HRESULT hr = aResult->GetObject(byRef(unknown));
  if (FAILED(hr) || !unknown) {
    return E_INVALIDARG;
  }
  ReadRequest* requestState =
    static_cast<ReadRequest*>(unknown.get());

  // Report result.
  *aBytesRead = requestState->mBytesRead;

  WMF_BS_LOG("[%p] WMFByteStream::EndRead() offset=%lld *aBytesRead=%u mOffset=%lld status=0x%x hr=0x%x eof=%d",
             this, requestState->mOffset, *aBytesRead, mOffset, aResult->GetStatus(), hr, IsEOS());

  return aResult->GetStatus();
}
开发者ID:AtulKumar2,项目名称:gecko-dev,代码行数:25,代码来源:WMFByteStream.cpp


示例14: MOZ_ASSERT

void
SourceSurfaceD2D1::DrawTargetWillChange()
{
  // At this point in time this should always be true here.
  MOZ_ASSERT(mRealizedBitmap);

  RefPtr<ID2D1Bitmap1> oldBitmap = mRealizedBitmap;

  D2D1_BITMAP_PROPERTIES1 props;
  props.dpiX = 96;
  props.dpiY = 96;
  props.pixelFormat = D2DPixelFormat(mFormat);
  props.colorContext = nullptr;
  props.bitmapOptions = D2D1_BITMAP_OPTIONS_TARGET;
  mDC->CreateBitmap(D2DIntSize(mSize), nullptr, 0, props, (ID2D1Bitmap1**)byRef(mRealizedBitmap));

  D2D1_POINT_2U point = D2D1::Point2U(0, 0);
  D2D1_RECT_U rect = D2D1::RectU(0, 0, mSize.width, mSize.height);
  mRealizedBitmap->CopyFromBitmap(&point, oldBitmap, &rect);
  mImage = mRealizedBitmap;

  DrawTargetD2D1::mVRAMUsageSS += mSize.width * mSize.height * BytesPerPixel(mFormat);
  mDrawTarget = nullptr;

  // We now no longer depend on the source surface content remaining the same.
  MarkIndependent();
}
开发者ID:Gabuzo,项目名称:mozilla-central,代码行数:27,代码来源:SourceSurfaceD2D1.cpp


示例15: EnsureRealizedBitmap

TemporaryRef<DataSourceSurface>
SourceSurfaceD2D1::GetDataSurface()
{
  HRESULT hr;

  EnsureRealizedBitmap();

  RefPtr<ID2D1Bitmap1> softwareBitmap;
  D2D1_BITMAP_PROPERTIES1 props;
  props.dpiX = 96;
  props.dpiY = 96;
  props.pixelFormat = D2DPixelFormat(mFormat);
  props.colorContext = nullptr;
  props.bitmapOptions = D2D1_BITMAP_OPTIONS_CANNOT_DRAW |
                        D2D1_BITMAP_OPTIONS_CPU_READ;
  hr = mDC->CreateBitmap(D2DIntSize(mSize), nullptr, 0, props, (ID2D1Bitmap1**)byRef(softwareBitmap));

  if (FAILED(hr)) {
    gfxCriticalError() << "Failed to create software bitmap: " << mSize << " Code: " << hexa(hr);
    return nullptr;
  }

  D2D1_POINT_2U point = D2D1::Point2U(0, 0);
  D2D1_RECT_U rect = D2D1::RectU(0, 0, mSize.width, mSize.height);
  
  hr = softwareBitmap->CopyFromBitmap(&point, mRealizedBitmap, &rect);

  if (FAILED(hr)) {
    gfxWarning() << "Failed to readback into software bitmap. Code: " << hexa(hr);
    return nullptr;
  }

  return MakeAndAddRef<DataSourceSurfaceD2D1>(softwareBitmap, mFormat);
}
开发者ID:lgarner,项目名称:mozilla-central,代码行数:34,代码来源:SourceSurfaceD2D1.cpp


示例16: MOZ_ASSERT

TemporaryRef<CompositingRenderTarget>
CompositorD3D11::CreateRenderTarget(const gfx::IntRect& aRect,
                                    SurfaceInitMode aInit)
{
  MOZ_ASSERT(aRect.width != 0 && aRect.height != 0);

  if (aRect.width * aRect.height == 0) {
    return nullptr;
  }

  CD3D11_TEXTURE2D_DESC desc(DXGI_FORMAT_B8G8R8A8_UNORM, aRect.width, aRect.height, 1, 1,
                             D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET);

  RefPtr<ID3D11Texture2D> texture;
  HRESULT hr = mDevice->CreateTexture2D(&desc, nullptr, byRef(texture));
  if (Failed(hr) || !texture) {
    return nullptr;
  }

  RefPtr<CompositingRenderTargetD3D11> rt = new CompositingRenderTargetD3D11(texture, aRect.TopLeft());
  rt->SetSize(IntSize(aRect.width, aRect.height));

  if (aInit == INIT_MODE_CLEAR) {
    FLOAT clear[] = { 0, 0, 0, 0 };
    mContext->ClearRenderTargetView(rt->mRTView, clear);
  }

  return rt;
}
开发者ID:msliu,项目名称:gecko-dev,代码行数:29,代码来源:CompositorD3D11.cpp


示例17: CompositingRenderTarget

CompositingRenderTargetD3D11::CompositingRenderTargetD3D11(ID3D11Texture2D* aTexture,
                                                           const gfx::IntPoint& aOrigin)
  : CompositingRenderTarget(aOrigin)
{
  MOZ_ASSERT(aTexture);

  mTexture = aTexture;

  RefPtr<ID3D11Device> device;
  mTexture->GetDevice(byRef(device));

  HRESULT hr = device->CreateRenderTargetView(mTexture, nullptr, byRef(mRTView));

  if (FAILED(hr)) {
    LOGD3D11("Failed to create RenderTargetView.");
  }
}
开发者ID:chenhequn,项目名称:gecko,代码行数:17,代码来源:TextureD3D11.cpp


示例18: MOZ_ASSERT

bool
ScaledFontDWrite::GetFontFileData(FontFileDataOutput aDataCallback, void *aBaton)
{
  UINT32 fileCount = 0;
  mFontFace->GetFiles(&fileCount, nullptr);

  if (fileCount > 1) {
    MOZ_ASSERT(false);
    return false;
  }

  RefPtr<IDWriteFontFile> file;
  mFontFace->GetFiles(&fileCount, byRef(file));

  const void *referenceKey;
  UINT32 refKeySize;
  // XXX - This can currently crash for webfonts, as when we get the reference
  // key out of the file, that can be an invalid reference key for the loader
  // we use it with. The fix to this is not obvious but it will probably 
  // have to happen inside thebes.
  file->GetReferenceKey(&referenceKey, &refKeySize);

  RefPtr<IDWriteFontFileLoader> loader;
  file->GetLoader(byRef(loader));
  
  RefPtr<IDWriteFontFileStream> stream;
  loader->CreateStreamFromKey(referenceKey, refKeySize, byRef(stream));

  UINT64 fileSize64;
  stream->GetFileSize(&fileSize64);
  if (fileSize64 > UINT32_MAX) {
    MOZ_ASSERT(false);
    return false;
  }
  
  uint32_t fileSize = static_cast<uint32_t>(fileSize64);
  const void *fragmentStart;
  void *context;
  stream->ReadFileFragment(&fragmentStart, 0, fileSize, &context);

  aDataCallback((uint8_t*)fragmentStart, fileSize, mFontFace->GetIndex(), mSize, aBaton);

  stream->ReleaseFileFragment(context);

  return true;
}
开发者ID:ConradIrwin,项目名称:gecko-dev,代码行数:46,代码来源:ScaledFontDWrite.cpp


示例19:

void
DeprecatedTextureHostDXGID3D11::ReleaseTexture()
{
  RefPtr<IDXGIKeyedMutex> mutex;
  mTextures[0]->QueryInterface((IDXGIKeyedMutex**)byRef(mutex));

  mutex->ReleaseSync(0);
}
开发者ID:jasager,项目名称:mozilla-central,代码行数:8,代码来源:TextureD3D11.cpp


示例20:

TemporaryRef<IMFAttributes>
MFTDecoder::GetAttributes()
{
  RefPtr<IMFAttributes> attr;
  HRESULT hr = mDecoder->GetAttributes(byRef(attr));
  NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);
  return attr;
}
开发者ID:Andrel322,项目名称:gecko-dev,代码行数:8,代码来源:MFTDecoder.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ bye函数代码示例发布时间:2022-05-30
下一篇:
C++ bwrite函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap