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

C++ GetBuffer函数代码示例

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

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



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

示例1:

			Air::U1 Buffer11::Read( U32 uiOffset,U32 uiSize,void* pData )
			{

				DxContext*	pContext	=	(DxContext*)(pDevice->GetContext());
				ID3D11Resource*	pResource	=	(ID3D11Resource*)GetBuffer();
				D3D11_MAPPED_SUBRESOURCE res;

				HRESULT	hr	=	pContext->Map(pResource,0,D3D11_MAP_READ,0,&res);
				if(SUCCEEDED(hr)){
					U8*	pDst	=	(U8*)res.pData;
					memcpy(pData,&pDst[uiOffset],uiSize);
					pContext->Unmap(pResource,0);
				}
				return true;
			}
开发者ID:ingeyu,项目名称:airengine,代码行数:15,代码来源:AirRenderBuffer11.cpp


示例2: GetLength

// Delete       - Deletes a segment of the string and resizes it
// Returns      - Reference to the same string object
// pos          - Position of the string segment to remove
// len          - Number of characters to remove
CStringEx& CStringEx::Delete(int pos, int len)
{
        int strLen = GetLength();

        if( pos >= strLen)
                return *this;
        if(len < 0 ||len > strLen - pos)
                len = strLen - pos;

        LPTSTR str = GetBuffer( strLen );
        memmove(str+pos, str+pos+len, sizeof(_T(' ')) *(strLen-pos));
        ReleaseBuffer( strLen - len );

        return *this;
}
开发者ID:akavel,项目名称:wed-editor,代码行数:19,代码来源:stringex.cpp


示例3: dc

// TODO: this code require full information about editabel register in dialog
// TODO: to make editable all registers which is output
void RegRichTextCtrl::OnLeftDClick(wxMouseEvent& event)
{
	wxClientDC dc(this);
	PrepareDC(dc);
	dc.SetFont(GetFont());

	long position = 0;
	GetBuffer().HitTest(dc, event.GetLogicalPosition(dc), position);
	long linePos = GetBuffer().GetVisibleLineNumber(position, true, true);
	wxString line = GetLineText(linePos);

	const size_t szRegNames = 15;

	for (size_t i = 0; i < szRegNames; ++i)
		if (line.Find(RegistersName[i]) != wxNOT_FOUND)
	{
		wxString str = GetStringSelection();

		bool bShowEditBox = true;

		for (size_t k = 0; k < szRegNames; ++k)
		{
			if ( 0 == str.Cmp(RegistersName[k]) )
			{
				bShowEditBox = false;
				break;
			}
		}

		if (bShowEditBox)
		{
			EditRegister(RegistersName[i], str);
			break;
		}
	}
}
开发者ID:bizdon,项目名称:opendbg,代码行数:38,代码来源:regframe.cpp


示例4: ReadHeader

static ParseStatus ReadHeader(MemBuffer* const mem) {
  const size_t min_size = RIFF_HEADER_SIZE + CHUNK_HEADER_SIZE;
  uint32_t riff_size;

  // Basic file level validation.
  if (MemDataSize(mem) < min_size) return PARSE_NEED_MORE_DATA;
  if (memcmp(GetBuffer(mem), "RIFF", CHUNK_SIZE_BYTES) ||
      memcmp(GetBuffer(mem) + CHUNK_HEADER_SIZE, "WEBP", CHUNK_SIZE_BYTES)) {
    return PARSE_ERROR;
  }

  riff_size = GetLE32(GetBuffer(mem) + TAG_SIZE);
  if (riff_size < CHUNK_HEADER_SIZE) return PARSE_ERROR;
  if (riff_size > MAX_CHUNK_PAYLOAD) return PARSE_ERROR;

  // There's no point in reading past the end of the RIFF chunk
  mem->riff_end_ = riff_size + CHUNK_HEADER_SIZE;
  if (mem->buf_size_ > mem->riff_end_) {
    mem->buf_size_ = mem->end_ = mem->riff_end_;
  }

  Skip(mem, RIFF_HEADER_SIZE);
  return PARSE_OK;
}
开发者ID:gameduell,项目名称:media,代码行数:24,代码来源:demux.c


示例5: memcpy

	size_t GarlicRoutingSession::CreateDeliveryStatusClove (uint8_t * buf, uint32_t msgID)
	{
		size_t size = 0;
		if (m_Owner)
		{
			auto inboundTunnel = m_Owner->GetTunnelPool ()->GetNextInboundTunnel ();
			if (inboundTunnel)
			{
				buf[size] = eGarlicDeliveryTypeTunnel << 5; // delivery instructions flag tunnel
				size++;
				// hash and tunnelID sequence is reversed for Garlic
				memcpy (buf + size, inboundTunnel->GetNextIdentHash (), 32); // To Hash
				size += 32;
				htobe32buf (buf + size, inboundTunnel->GetNextTunnelID ()); // tunnelID
				size += 4;
				// create msg
				auto msg = CreateDeliveryStatusMsg (msgID);
				if (m_Owner)
				{
					//encrypt
					uint8_t key[32], tag[32];
					RAND_bytes (key, 32); // random session key
					RAND_bytes (tag, 32); // random session tag
					m_Owner->SubmitSessionKey (key, tag);
					GarlicRoutingSession garlic (key, tag);
					msg = garlic.WrapSingleMessage (msg);
				}
				memcpy (buf + size, msg->GetBuffer (), msg->GetLength ());
				size += msg->GetLength ();
				// fill clove
				uint64_t ts = i2p::util::GetMillisecondsSinceEpoch () + 8000; // 8 sec
				uint32_t cloveID;
				RAND_bytes ((uint8_t *)&cloveID, 4);
				htobe32buf (buf + size, cloveID); // CloveID
				size += 4;
				htobe64buf (buf + size, ts); // Expiration of clove
				size += 8;
				memset (buf + size, 0, 3); // certificate of clove
				size += 3;
			}
			else
				LogPrint (eLogError, "Garlic: No inbound tunnels in the pool for DeliveryStatus");
		}
		else
			LogPrint (eLogWarning, "Garlic: Missing local LeaseSet");

		return size;
	}
开发者ID:majestrate,项目名称:i2pd,代码行数:48,代码来源:Garlic.cpp


示例6: RenderLine

		void RenderLine(uint8 *pStart, float xOff, float vLineTop, float vLineBottom, int nCursor, int nSelStart, int nSelEnd, View *pcView, bool bSelected)
		{			
			Color32_s sCursCol(40,40,40);
			Color32_s sCursLineCol(255,235,186);
			
			if( ! bSelected )
			{
				sCursCol = lighten_color(sCursCol);
				sCursLineCol = lighten_color(sCursLineCol);
			}
		
			float vCharWidth = GetCharWidth();
			float vCharHeight = GetCharHeight();
			
			uint8 *pEnd = GetBuffer() + GetBufferLength();
			static char zLine[(BYTES_PER_LINE) + 1];
			for( int x = 0; x < BYTES_PER_LINE; x++ )
			{
				uint8 *p = pStart + x;
				zLine[x] = p >= pEnd || *p < 32 || *p > 126?'.':*p;
			}
					
			Rect cRect(xOff + GetX() + 2, vLineTop, xOff + GetX() + GetWidth() - 2, vLineBottom);
			
			pcView->SetFgColor(Color32_s(0,0,0));
			if( nSelStart < 0 )
			{				
				if( nCursor >= 0 )
					pcView->FillRect(cRect, sCursLineCol);
				
				pcView->DrawText(cRect, zLine);
	
				if( nCursor >= 0 )			
				{
					float vCursorX = cRect.left + (vCharWidth * nCursor);
					pcView->SetFgColor(sCursCol);
					pcView->DrawLine(Point(vCursorX, vLineTop), Point(vCursorX, vLineBottom));
					vCursorX++;
					pcView->DrawLine(Point(vCursorX, vLineTop), Point(vCursorX, vLineBottom));
				}
			}
			else
			{
				IPoint cSel1((int)(nSelStart * vCharWidth), (int)vCharHeight);
				IPoint cSel2((int)((nSelEnd * vCharWidth) + 1), (int)vCharHeight);
				pcView->DrawSelectedText(cRect, zLine, cSel1, cSel2, SEL_CHAR);
			}
		}
开发者ID:PyroOS,项目名称:Pyro,代码行数:48,代码来源:Column.cpp


示例7: TINYCLR_HEADER

HRESULT CLR_RT_HeapBlock_XmlReader::Read()
{
    TINYCLR_HEADER();

    CLR_RT_XmlState* state = GetState();

    state->State.bufferStart = GetBuffer();
    state->State.buffer      = state->State.bufferStart + GetOffset();
    state->State.bufferEnd   = state->State.buffer + GetLength();
    state->State.reader      = this;

    if(state->State.initFn)
    {
        state->State.initFn( state );
    }

    while(true)
    {
        TINYCLR_CHECK_HRESULT(state->State.stateFn( state ));
    }

    TINYCLR_CLEANUP();

    if(hr == XML_E_NEED_MORE_DATA)
    {
        if(state->State.cleanUpFn)
        {
            state->State.cleanUpFn( state );
        }
        else
        {
            state->State.ShiftBuffer( state->State.buffer );
        }

        // if after buffer adjustment, there's no room for new data, then we know that
        // we've exceeded one of the system constraints (either the length of name or
        // attribute value is over buffer size)
        if(state->State.bufferEnd - state->State.bufferStart == XmlBufferSize)
        {
            hr = XML_E_LIMIT_EXCEEDED;
        }
    }

    SetOffset( state->State.buffer    - state->State.bufferStart );
    SetLength( state->State.bufferEnd - state->State.buffer      );

    TINYCLR_CLEANUP_END();
}
开发者ID:koson,项目名称:.NETMF_for_LPC17xx,代码行数:48,代码来源:XmlReader.cpp


示例8: MOZ_ASSERT

bool
BufferTextureClient::AllocateForSurface(gfx::IntSize aSize)
{
  MOZ_ASSERT(IsValid());
  MOZ_ASSERT(mFormat != gfx::FORMAT_YUV, "This textureClient cannot use YCbCr data");

  int bufSize
    = ImageDataSerializer::ComputeMinBufferSize(aSize, mFormat);
  if (!Allocate(bufSize)) {
    return false;
  }
  ImageDataSerializer serializer(GetBuffer());
  serializer.InitializeBufferInfo(aSize, mFormat);
  mSize = aSize;
  return true;
}
开发者ID:armikhael,项目名称:cunaguaro,代码行数:16,代码来源:TextureClient.cpp


示例9: set_structure_element

void Binarization::HMT(unsigned char *buffer_in, unsigned char *buffer_out, bool inverse) {
	set_structure_element(mixture_structure_element_2_);
	unsigned char *buffer = GetBuffer(BUFFER_INTERMEDIATE - 1);
	Invert(buffer_in, buffer);
	Erode(buffer, buffer, inverse);

	set_structure_element(mixture_structure_element_1_);
	Erode(buffer_in, buffer_out, inverse);

	for(int i = 1; i < height_ - 1; i++)
		for(int j = 1; j < width_ - 1; j++) {
			buffer_out[(i * width_ + j) * 3 + 2] = inverse ? buffer_out[(i * width_ + j) * 3 + 2] | buffer[(i * width_ + j) * 3 + 2] : buffer_out[(i * width_ + j) * 3 + 2] & buffer[(i * width_ + j) * 3 + 2];
			buffer_out[(i * width_ + j) * 3 + 1] = inverse ? buffer_out[(i * width_ + j) * 3 + 1] | buffer[(i * width_ + j) * 3 + 1] : buffer_out[(i * width_ + j) * 3 + 1] & buffer[(i * width_ + j) * 3 + 1];
			buffer_out[(i * width_ + j) * 3 + 0] = inverse ? buffer_out[(i * width_ + j) * 3 + 0] | buffer[(i * width_ + j) * 3 + 0] : buffer_out[(i * width_ + j) * 3 + 0] & buffer[(i * width_ + j) * 3 + 0];
		}
}
开发者ID:chaosink,项目名称:image-binarization,代码行数:16,代码来源:binarization.cpp


示例10: GetSize

bool
BufferTextureData::BorrowMappedData(MappedTextureData& aData)
{
  if (GetFormat() == gfx::SurfaceFormat::YUV) {
    return false;
  }

  gfx::IntSize size = GetSize();

  aData.data = GetBuffer();
  aData.size = size;
  aData.format = GetFormat();
  aData.stride = ImageDataSerializer::ComputeRGBStride(aData.format, size.width);

  return true;
}
开发者ID:devtools-html,项目名称:gecko-dev,代码行数:16,代码来源:BufferTexture.cpp


示例11: ASSERT

LPSTR IUrlDownloader::CreateCharCopy() const
{
    ASSERT(GetStatus() == S_Success);
    LPSTR ret = NULL;
    if (GetStatus() == S_Success)
    {
        UINT bfLen = GetBufferSize();
        if (bfLen > 0)
        {
            ret = new CHAR[bfLen + 1];
            strncpy(ret, (LPCSTR)GetBuffer(), bfLen);
            ret[bfLen] = 0;
        }
    }
    return ret;
}
开发者ID:KurzedMetal,项目名称:Jaangle,代码行数:16,代码来源:IUrlDownloader.cpp


示例12: CameraEventData

      /// ctor; parses event data
      CameraEventData(prVoid* pEventData)
         :m_uiEventCode(0)
      {
         BYTE* pbData = reinterpret_cast<BYTE*>(pEventData);

         std::vector<BYTE>& vecBuffer = GetBuffer();
         vecBuffer.assign(pbData, pbData + 12);// at least 12 bytes

         // read length of event data
         prUInt32 uiLength = ReadUint32();

         vecBuffer.assign(pbData, pbData + uiLength);

         unsigned int uiNumParams = (uiLength - 12) / 4;
         Parse(uiNumParams);
      }
开发者ID:vividos,项目名称:RemotePhotoTool,代码行数:17,代码来源:PsrecCameraEventData.hpp


示例13: ofs

void ImageProcessing::Output(const char *output, int buffer_num) {
	std::ofstream ofs(output, std::ifstream::binary);

	ofs.write((char *)head_, head_size_);

	unsigned char *canvas = GetBuffer(buffer_num);
	for(int i = 0; i < height_; i++)
		for(int j = 0; j < width_; j++) {
			image_[image_size_ / height_ * i + j * 3 + 2] = canvas[(i * width_ + j) * 3 + 2];
			image_[image_size_ / height_ * i + j * 3 + 1] = canvas[(i * width_ + j) * 3 + 1];
			image_[image_size_ / height_ * i + j * 3 + 0] = canvas[(i * width_ + j) * 3 + 0];
		}
	ofs.write((char *)image_, image_size_);

	ofs.close();
}
开发者ID:chaosink,项目名称:image-spatial-filtering,代码行数:16,代码来源:image_processing.cpp


示例14: GetLength

void CComplexBinary::Append (CDatum dDatum)

//	Append
//
//	Appends data

	{
	const CString &sNewData = dDatum;
	if (sNewData.GetLength() == 0)
		return;

	//	Compute the new length

	int iOldLen = GetLength();
	int iNewLen = iOldLen + sNewData.GetLength();

	//	Allocate a new buffer

	char *pNewBuffer = new char [sizeof(DWORD) + iNewLen + 1];
	char *pPos = pNewBuffer;
	*(DWORD *)pPos = iNewLen;
	pPos += sizeof(DWORD);

	//	Copy the original data

	if (iOldLen)
		{
		utlMemCopy(m_pData, pPos, iOldLen);
		pPos += iOldLen;
		}

	//	Copy the new data

	utlMemCopy(sNewData.GetParsePointer(), pPos, sNewData.GetLength());
	pPos += sNewData.GetLength();

	//	NULL-terminator

	*pPos++ = '\0';

	//	Free our original buffer and swap

	if (m_pData)
		delete [] GetBuffer();

	m_pData = pNewBuffer + sizeof(DWORD);
	}
开发者ID:kronosaur,项目名称:Hexarc,代码行数:47,代码来源:CComplexBinary.cpp


示例15: ASSERT

void CFileName::ReplaceExtension(LPCTSTR pszNewExt)
{
  ASSERT(pszNewExt);
  if(_TCHAR('.')==*pszNewExt){
    // Be tolerant of whether '.' is included in what we are passed:
    pszNewExt++;
  }
  LPTSTR pch=GetBuffer(2+GetLength()+_tcslen(pszNewExt));
  LPTSTR pcExt=_tcsrchr(pch,_TCHAR('.'));
  if(NULL==pcExt || _tcschr(pcExt,cSep)){
    // No existing extension
    pcExt=pch+GetLength();
    *pcExt++=_TCHAR('.');
  }
  _tcscpy(pcExt+1,pszNewExt);
  ReleaseBuffer();
}
开发者ID:Robertysc,项目名称:ecos,代码行数:17,代码来源:FileName.cpp


示例16: GetDTBuffer

void
ContentClientSingleBuffered::SyncFrontBufferToBackBuffer()
{
  if (!mFrontAndBackBufferDiffer) {
    return;
  }

  if (SupportsAzureContent()) {
    DrawTarget* backBuffer = GetDTBuffer();
    if (!backBuffer && mDeprecatedTextureClient) {
      backBuffer = mDeprecatedTextureClient->LockDrawTarget();
    }

    RefPtr<DrawTarget> oldBuffer;
    oldBuffer = SetDTBuffer(backBuffer,
                            mBufferRect,
                            mBufferRotation);

    backBuffer = GetDTBufferOnWhite();
    if (!backBuffer && mDeprecatedTextureClientOnWhite) {
      backBuffer = mDeprecatedTextureClientOnWhite->LockDrawTarget();
    }

    oldBuffer = SetDTBufferOnWhite(backBuffer);
  } else {
    gfxASurface* backBuffer = GetBuffer();
    if (!backBuffer && mDeprecatedTextureClient) {
      backBuffer = mDeprecatedTextureClient->LockSurface();
    }

    nsRefPtr<gfxASurface> oldBuffer;
    oldBuffer = SetBuffer(backBuffer,
                          mBufferRect,
                          mBufferRotation);

    backBuffer = GetBufferOnWhite();
    if (!backBuffer && mDeprecatedTextureClientOnWhite) {
      backBuffer = mDeprecatedTextureClientOnWhite->LockSurface();
    }

    oldBuffer = SetBufferOnWhite(backBuffer);
  }

  mIsNewBuffer = false;
  mFrontAndBackBufferDiffer = false;
}
开发者ID:Jaxo,项目名称:releases-mozilla-central,代码行数:46,代码来源:ContentClient.cpp


示例17: parseBreakpointWatchpointCommandArguments

static void parseBreakpointWatchpointCommandArguments(BreakpointWatchpointArguments* pArguments)
{
    Buffer*    pBuffer = GetBuffer();
    
    __try
    {
        __throwing_func( pArguments->type = Buffer_ReadChar(pBuffer) );
        __throwing_func( ThrowIfNextCharIsNotEqualTo(pBuffer, ',') );
        __throwing_func( pArguments->address = ReadUIntegerArgument(pBuffer) );
        __throwing_func( ThrowIfNextCharIsNotEqualTo(pBuffer, ',') );
        __throwing_func( pArguments->kind = ReadUIntegerArgument(pBuffer) );
    }
    __catch
    {
        __rethrow;
    }
}
开发者ID:CNCBASHER,项目名称:mri,代码行数:17,代码来源:cmd_break_watch.c


示例18: RefCountDXGIObject

WrappedIDXGISwapChain2::WrappedIDXGISwapChain2(IDXGISwapChain* real, HWND wnd, WrappedID3D11Device *device)
	: RefCountDXGIObject(real), m_pReal(real), m_pDevice(device), m_iRefcount(1), m_Wnd(wnd)
{
	DXGI_SWAP_CHAIN_DESC desc;
	real->GetDesc(&desc);
	
#if defined(INCLUDE_DXGI_1_2)
	m_pReal1 = NULL;
	real->QueryInterface(__uuidof(IDXGISwapChain1), (void **)&m_pReal1);
	m_pReal2 = NULL;
	real->QueryInterface(__uuidof(IDXGISwapChain2), (void **)&m_pReal2);
#endif

	int bufCount = desc.BufferCount;

	if(desc.SwapEffect == DXGI_SWAP_EFFECT_DISCARD)
		bufCount = 1;

	RDCASSERT(bufCount < MAX_NUM_BACKBUFFERS);

	for(int i=0; i < MAX_NUM_BACKBUFFERS; i++)
	{
		m_pBackBuffers[i] = NULL;

		if(i < bufCount)
		{
			GetBuffer(i, __uuidof(ID3D11Texture2D), (void **)&m_pBackBuffers[i]);

			WrappedID3D11Texture2D *wrapped = (WrappedID3D11Texture2D *)m_pBackBuffers[i];

			if(wrapped)
			{
				// keep ref as a 'view' (invisible to user)
				wrapped->ViewAddRef();
				wrapped->Release();
			}
		}
	}

	SAFE_ADDREF(m_pDevice);

	// we do a 'fake' present right at the start, so that we can capture frame 1, by
	// going from this fake present to the first present.
	m_pDevice->FirstFrame(this);
}
开发者ID:dougbinks,项目名称:renderdoc,代码行数:45,代码来源:dxgi_wrapped.cpp


示例19: GetPrivateProfileString

int CxString :: GetPrivateProfileString( const char *sec, const char *ent,
				const char *def, int size, const char *file )
{
	if (NULL == file || 0 == strlen(file))	// ohne ini-Dateiname kein Resultat
		return 0;
		
int		result = size;
char	*text;

	ASSERT( def );
	ASSERT( file );

	if ( result <= 10 ) result = 10;
	text = GetBuffer( result );
	result = ::GetPrivateProfileString( sec, ent, def, text, result, file );
	ReleaseBuffer();
	return result;
}	// GetPrivateProfileString
开发者ID:hkaiser,项目名称:TRiAS,代码行数:18,代码来源:CXSTRING.CPP


示例20: SeekNextFrameFromStream

void
prefix::CRenderableVideo::Update( float fSeconds )
{
     // decode next frame from the stream.
     SeekNextFrameFromStream(static_cast<int>(fSeconds*1000.0f));
     //UpdateBuffer();
     // prepare frame buffer for rendering
     m_Renderer.CommitFrameBufferSingle(*m_pFrameBufferObj, 0);
     // flip image vertically
     glRasterPos2i( 0, 240);
     glPixelZoom(1,-1);
     //glRasterPos2i(0,0);
     // put pixels into buffer
     glDrawPixels(GetWidth(),GetHeight(), GL_RGB, GL_UNSIGNED_BYTE, GetBuffer());
     // restore things back to normal
     glPixelZoom(1,1);
     m_Renderer.RollbackFrameBuffer( *m_pFrameBufferObj );
}
开发者ID:moose3d,项目名称:moose,代码行数:18,代码来源:MooseRenderableVideo.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ GetBufferSize函数代码示例发布时间:2022-05-30
下一篇:
C++ GetBuddyHwnd函数代码示例发布时间: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