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


C++ ComPtr::GetAddressOf方法代码示例

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


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

示例1: CompileShaderFromFile

HRESULT CompileShaderFromFile(const std::wstring &file
        , const StageInfo &info, ID3D10Blob** ppBlobOut)
{
    DWORD dwShaderFlags = D3DCOMPILE_ENABLE_STRICTNESS;
#if defined(DEBUG) || defined(_DEBUG)
    dwShaderFlags |= D3DCOMPILE_DEBUG;
#endif//defiend(DEBUG) || defined(_DEBUG)
#if defined(NDEBUG) || defined(_NDEBUG)
    dwShaderFlags |= D3DCOMPILE_OPTIMIZATION_LEVEL3;
#endif//defined(NDEBUG) || defined(_NDEBUG)

    Microsoft::WRL::ComPtr<ID3DBlob> pErrorBlob;
    auto hr = D3DCompileFromFile(
            file.c_str()
            , NULL
            , D3D_COMPILE_STANDARD_FILE_INCLUDE
            , info.entrypoint.c_str()
            , info.model.c_str()
            , dwShaderFlags
            , 0
            , ppBlobOut
            , pErrorBlob.GetAddressOf() 
            );
    if ( FAILED( hr ) ) {
        if (pErrorBlob) { 
            // エラーメッセージを出力.
            OutputDebugStringA( (char*)pErrorBlob->GetBufferPointer() ); 
        }
    }

    return hr;
}
开发者ID:HatsuneMiku,项目名称:MinTriangle,代码行数:32,代码来源:D3DShaderResource.cpp

示例2: Shape

RoundedRectangle::RoundedRectangle(FLOAT x, FLOAT y, FLOAT width, FLOAT height,
	FLOAT xRadius, FLOAT yRadius) : Shape(ShapeType::RoundedRectangle),
		m_X(x),
		m_Y(y),
		m_Width(width + x),
		m_Height(height + y),
		m_XRadius(xRadius),
		m_YRadius(yRadius)
{
	HRESULT hr = E_FAIL;
	const D2D1_ROUNDED_RECT rect = { m_X, m_Y, m_Width, m_Height, m_XRadius, m_YRadius };

	Microsoft::WRL::ComPtr<ID2D1RoundedRectangleGeometry> rectangle;
	hr = Canvas::c_D2DFactory->CreateRoundedRectangleGeometry(rect, rectangle.GetAddressOf());
	if (FAILED(hr))
	{
		LogErrorF(
			L"Could not create rounded rectangle object. X=%i, Y=%i, W=%i, H=%i, XRadius=%i, YRadius=%i",
			(int)m_X, (int)m_Y, (int)m_Width, (int)m_Height, (int)m_XRadius, (int)m_YRadius);
		return;
	}

	hr = rectangle.CopyTo(m_Shape.GetAddressOf());
	if (FAILED(hr)) LogErrorF(
		L"Could not copy rounded rectangle object to shape object. X=%i, Y=%i, W=%i, H=%i, XRadius=%i, YRadius=%i",
		(int)m_X, (int)m_Y, (int)m_Width, (int)m_Height, (int)m_XRadius, (int)m_YRadius);
}
开发者ID:NighthawkSLO,项目名称:rainmeter,代码行数:27,代码来源:RoundedRectangle.cpp

示例3: createVB

	bool createVB(const Microsoft::WRL::ComPtr<ID3D11Device> &pDevice)
	{
		// Create VB
		auto size = 0.5f;
		Vertex pVertices[] =
		{
			// x
			{ DirectX::XMFLOAT4(-size, -size, -size, 1.0f), DirectX::XMFLOAT4(0.5f, 0.0f, 0.0f, 1.0f), DirectX::XMFLOAT2(0, 1) },
			{ DirectX::XMFLOAT4(-size, -size, size, 1.0f), DirectX::XMFLOAT4(0.5f, 0.0f, 0.0f, 1.0f), DirectX::XMFLOAT2(0, 0) },
			{ DirectX::XMFLOAT4(-size, size, size, 1.0f), DirectX::XMFLOAT4(0.5f, 0.0f, 0.0f, 1.0f), DirectX::XMFLOAT2(1, 0) },
			{ DirectX::XMFLOAT4(-size, size, -size, 1.0f), DirectX::XMFLOAT4(0.5f, 0.0f, 0.0f, 1.0f), DirectX::XMFLOAT2(1, 1) },

			{ DirectX::XMFLOAT4(size, -size, -size, 1.0f), DirectX::XMFLOAT4(1.0f, 0.0f, 0.0f, 1.0f), DirectX::XMFLOAT2(0, 1) },
			{ DirectX::XMFLOAT4(size, size, -size, 1.0f), DirectX::XMFLOAT4(1.0f, 0.0f, 0.0f, 1.0f), DirectX::XMFLOAT2(1, 1) },
			{ DirectX::XMFLOAT4(size, size, size, 1.0f), DirectX::XMFLOAT4(1.0f, 0.0f, 0.0f, 1.0f), DirectX::XMFLOAT2(1, 0) },
			{ DirectX::XMFLOAT4(size, -size, size, 1.0f), DirectX::XMFLOAT4(1.0f, 0.0f, 0.0f, 1.0f), DirectX::XMFLOAT2(0, 0) },
			// y
			{ DirectX::XMFLOAT4(-size, size, -size, 1.0f), DirectX::XMFLOAT4(0.0f, 1.0f, 0.0f, 1.0f), DirectX::XMFLOAT2(0, 1) },
			{ DirectX::XMFLOAT4(-size, size, size, 1.0f), DirectX::XMFLOAT4(0.0f, 1.0f, 0.0f, 1.0f), DirectX::XMFLOAT2(0, 0) },
			{ DirectX::XMFLOAT4(size, size, size, 1.0f), DirectX::XMFLOAT4(0.0f, 1.0f, 0.0f, 1.0f), DirectX::XMFLOAT2(1, 0) },
			{ DirectX::XMFLOAT4(size, size, -size, 1.0f), DirectX::XMFLOAT4(0.0f, 1.0f, 0.0f, 1.0f), DirectX::XMFLOAT2(1, 1) },

			{ DirectX::XMFLOAT4(-size, -size, -size, 1.0f), DirectX::XMFLOAT4(0.0f, 0.5f, 0.0f, 1.0f), DirectX::XMFLOAT2(0, 1) },
			{ DirectX::XMFLOAT4(size, -size, -size, 1.0f), DirectX::XMFLOAT4(0.0f, 0.5f, 0.0f, 1.0f), DirectX::XMFLOAT2(1, 1) },
			{ DirectX::XMFLOAT4(size, -size, size, 1.0f), DirectX::XMFLOAT4(0.0f, 0.5f, 0.0f, 1.0f), DirectX::XMFLOAT2(1, 0) },
			{ DirectX::XMFLOAT4(-size, -size, size, 1.0f), DirectX::XMFLOAT4(0.0f, 0.5f, 0.0f, 1.0f), DirectX::XMFLOAT2(0, 0) },
			// z
			{ DirectX::XMFLOAT4(-size, -size, -size, 1.0f), DirectX::XMFLOAT4(0.0f, 0.0f, 0.5f, 1.0f), DirectX::XMFLOAT2(0, 1) },
			{ DirectX::XMFLOAT4(-size, size, -size, 1.0f), DirectX::XMFLOAT4(0.0f, 0.0f, 0.5f, 1.0f), DirectX::XMFLOAT2(0, 0) },
			{ DirectX::XMFLOAT4(size, size, -size, 1.0f), DirectX::XMFLOAT4(0.0f, 0.0f, 0.5f, 1.0f), DirectX::XMFLOAT2(1, 0) },
			{ DirectX::XMFLOAT4(size, -size, -size, 1.0f), DirectX::XMFLOAT4(0.0f, 0.0f, 0.5f, 1.0f), DirectX::XMFLOAT2(1, 1) },

			{ DirectX::XMFLOAT4(-size, -size, size, 1.0f), DirectX::XMFLOAT4(0.0f, 0.0f, 1.0f, 1.0f), DirectX::XMFLOAT2(0, 1) },
			{ DirectX::XMFLOAT4(size, -size, size, 1.0f), DirectX::XMFLOAT4(0.0f, 0.0f, 1.0f, 1.0f), DirectX::XMFLOAT2(1, 1) },
			{ DirectX::XMFLOAT4(size, size, size, 1.0f), DirectX::XMFLOAT4(0.0f, 0.0f, 1.0f, 1.0f), DirectX::XMFLOAT2(1, 0) },
			{ DirectX::XMFLOAT4(-size, size, size, 1.0f), DirectX::XMFLOAT4(0.0f, 0.0f, 1.0f, 1.0f), DirectX::XMFLOAT2(0, 0) },
		};
		unsigned int vsize = sizeof(pVertices);

		D3D11_BUFFER_DESC vdesc;
		ZeroMemory(&vdesc, sizeof(vdesc));
		vdesc.ByteWidth = vsize;
		vdesc.Usage = D3D11_USAGE_DEFAULT;
		vdesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
		vdesc.CPUAccessFlags = 0;

		D3D11_SUBRESOURCE_DATA vertexData;
		ZeroMemory(&vertexData, sizeof(vertexData));
		vertexData.pSysMem = pVertices;

		HRESULT hr = pDevice->CreateBuffer(&vdesc, &vertexData, m_pVertexBuf.GetAddressOf());
		if (FAILED(hr)){
			return false;
		}

		return true;
	}
开发者ID:HatsuneMiku,项目名称:MinTriangle,代码行数:57,代码来源:shader.cpp

示例4: CreateEvent

int sound_xaudio2::init(osd_options const &options)
{
	HRESULT result;
	WAVEFORMATEX format = {0};
	auto init_start = std::chrono::system_clock::now();
	std::chrono::milliseconds init_time;

	CoInitializeEx(nullptr, COINIT_MULTITHREADED);

	// Make sure our XAudio2Create entrypoint is bound
	if (!XAudio2Create)
	{
		osd_printf_error("Could not find XAudio2. Please try to reinstall DirectX runtime package.\n");
		return 1;
	}

	// Create the IXAudio2 object
	HR_GOERR(this->XAudio2Create(m_xAudio2.GetAddressOf(), 0, XAUDIO2_DEFAULT_PROCESSOR));

	// make a format description for what we want
	format.wBitsPerSample = 16;
	format.wFormatTag = WAVE_FORMAT_PCM;
	format.nChannels = 2;
	format.nSamplesPerSec = sample_rate();
	format.nBlockAlign = format.wBitsPerSample * format.nChannels / 8;
	format.nAvgBytesPerSec = format.nSamplesPerSec * format.nBlockAlign;

	m_sample_bytes = format.nBlockAlign;

	// Create the buffers
	create_buffers(format);

	// Initialize our events
	m_hEventBufferCompleted = CreateEvent(nullptr, FALSE, FALSE, nullptr);
	m_hEventDataAvailable = CreateEvent(nullptr, FALSE, FALSE, nullptr);
	m_hEventExiting = CreateEvent(nullptr, FALSE, FALSE, nullptr);

	// create the voices and start them
	HR_GOERR(create_voices(format));
	HR_GOERR(m_sourceVoice->Start());

	// Start the thread listening
	m_audioThread = std::thread([](sound_xaudio2* self) { self->process_audio(); }, this);

	init_time = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - init_start);
	osd_printf_verbose("Sound: XAudio2 initialized. %d ms.\n", static_cast<int>(init_time.count()));

	m_initialized = TRUE;
	return 0;

Error:
	this->exit();
	return 1;
}
开发者ID:goofwear,项目名称:mame,代码行数:54,代码来源:xaudio2_sound.cpp

示例5: call

EncodedJSValue JSC_HOST_CALL COMMethodCall::call(ExecState* execState) {
    COMMethodCall* callee = jsCast<COMMethodCall*>(execState->callee());
    if (execState->argumentCount() != callee->_parameterCells.size()) {
        // TODO: error
        CRASH();
    }

    COMInterop* interop = jsCast<GlobalObject*>(execState->lexicalGlobalObject())->interop();

    size_t numberOfABIParameters = callee->_parameterCells.size() + (callee->_isVoid ? 1 : 2);

    HRESULT hr;

    Microsoft::WRL::ComPtr<IUnknown> self;
    hr = interop->wrap(execState->thisValue(), callee->_methodInterface, self.GetAddressOf());

    void** vtable = *reinterpret_cast<void***>(self.Get());
    void* fn = vtable[callee->_methodIndex];

    WTF::Vector<void*> arguments;
    arguments.reserveCapacity(numberOfABIParameters);

    IUnknown* thisValue = self.Get();
    arguments.append(&thisValue);

    for (int i = 0; i < callee->_parameterCells.size(); i++) {
        JSCell* type = callee->_parameterCells[i].get();
        void* buffer = _alloca(std::max(sizeof(ffi_arg), callee->_parameterTypes[i + 1]->size));
        getFFIMethodTable(type)->marshalJSToNative(type, execState, execState->uncheckedArgument(i), buffer);
        arguments.append(buffer);
    }

    void* returnBuffer = nullptr;
    if (!callee->_isVoid) {
        returnBuffer = _alloca(std::max(sizeof(ffi_arg), callee->_parameterTypes[numberOfABIParameters - 1]->size));
        arguments.append(&returnBuffer);
    }

    ffi_call(&callee->_cif, FFI_FN(fn), &hr, arguments.data());

    JSValue jsResult;
    if (!SUCCEEDED(hr)) {
        _com_error error(hr, nullptr);
        jsResult = execState->vm().throwException(execState, createError(execState, error.ErrorMessage()));
    } else if (!callee->_isVoid) {
        JSCell* returnType = callee->_returnType.get();
        jsResult = getFFIMethodTable(returnType)->marshalNativeToJS(returnType, execState, returnBuffer);
    } else {
        jsResult = jsUndefined();
    }

    return JSValue::encode(jsResult);
}
开发者ID:Happy-Ferret,项目名称:windows-runtime,代码行数:53,代码来源:COMMethodCall.cpp

示例6: GetGDIFamilyNameFromDWriteFont

HRESULT GetGDIFamilyNameFromDWriteFont(IDWriteFont* font, WCHAR* buffer, UINT bufferSize)
{
	Microsoft::WRL::ComPtr<IDWriteLocalizedStrings> strings;
	BOOL stringsExist;
	font->GetInformationalStrings(
		DWRITE_INFORMATIONAL_STRING_WIN32_FAMILY_NAMES, strings.GetAddressOf(), &stringsExist);
	if (strings && stringsExist)
	{
		return strings->GetString(0, buffer, bufferSize);
	}

	return E_FAIL;
}
开发者ID:ATTRAYANTDESIGNS,项目名称:rainmeter,代码行数:13,代码来源:DWriteHelpers.cpp

示例7:

RenderTexture::RenderTexture(Canvas& canvas, UINT width, UINT height) : m_Bitmap()
{
    m_Bitmap.m_Width = width;
    m_Bitmap.m_Height = height;

	D2D1_BITMAP_PROPERTIES1 bProps = D2D1::BitmapProperties1(D2D1_BITMAP_OPTIONS_TARGET,
		D2D1::PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED));

    Microsoft::WRL::ComPtr<ID2D1Bitmap1> segment;
    canvas.m_Target->CreateBitmap(D2D1::SizeU(width, height), NULL, 0, bProps, segment.GetAddressOf());

    m_Bitmap.AddSegment(segment, 0u, 0u, width, height);
}
开发者ID:TheAzack9,项目名称:rainmeter,代码行数:13,代码来源:RenderTexture.cpp

示例8: CreateMemoryStream

    static inline HRESULT CreateMemoryStream( _Outptr_ IStream** stream )
    {
        Microsoft::WRL::ComPtr<ABI::Windows::Storage::Streams::IRandomAccessStream> abiStream;
        HRESULT hr = Windows::Foundation::ActivateInstance(
            Microsoft::WRL::Wrappers::HStringReference( RuntimeClass_Windows_Storage_Streams_InMemoryRandomAccessStream ).Get(),
            abiStream.GetAddressOf() );

        if (SUCCEEDED(hr))
        {
            hr = CreateStreamOverRandomAccessStream( abiStream.Get(), IID_PPV_ARGS( stream ) );
        }
        return hr;
    }
开发者ID:151706061,项目名称:D3DSamples,代码行数:13,代码来源:DirectXTexWIC.cpp

示例9:

Microsoft::WRL::ComPtr<ID3D12Resource> d3dUtil::CreateDefaultBuffer(
	ID3D12Device* device,
	ID3D12GraphicsCommandList* cmdList,
	const void* initData,
	UINT64 byteSize,
	Microsoft::WRL::ComPtr<ID3D12Resource>& uploadBuffer)
{
	ComPtr<ID3D12Resource> defaultBuffer;

	// Create the actual default buffer resource.
	ThrowIfFailed(device->CreateCommittedResource(
		&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT),
		D3D12_HEAP_FLAG_NONE,
		&CD3DX12_RESOURCE_DESC::Buffer(byteSize),
		D3D12_RESOURCE_STATE_COMMON,
		nullptr,
		IID_PPV_ARGS(defaultBuffer.GetAddressOf())));

	// In order to copy CPU memory data into our default buffer, we need to create
	// an intermediate upload heap. 
	ThrowIfFailed(device->CreateCommittedResource(
		&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_UPLOAD),
		D3D12_HEAP_FLAG_NONE,
		&CD3DX12_RESOURCE_DESC::Buffer(byteSize),
		D3D12_RESOURCE_STATE_GENERIC_READ,
		nullptr,
		IID_PPV_ARGS(uploadBuffer.GetAddressOf())));


	// Describe the data we want to copy into the default buffer.
	D3D12_SUBRESOURCE_DATA subResourceData ={};
	subResourceData.pData = initData;
	subResourceData.RowPitch = byteSize;
	subResourceData.SlicePitch = subResourceData.RowPitch;

	// Schedule to copy the data to the default buffer resource.  At a high level, the helper function UpdateSubresources
	// will copy the CPU memory into the intermediate upload heap.  Then, using ID3D12CommandList::CopySubresourceRegion,
	// the intermediate upload heap data will be copied to mBuffer.
	cmdList->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(defaultBuffer.Get(),
		D3D12_RESOURCE_STATE_COMMON, D3D12_RESOURCE_STATE_COPY_DEST));
	UpdateSubresources<1>(cmdList, defaultBuffer.Get(), uploadBuffer.Get(), 0, 0, 1, &subResourceData);
	cmdList->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(defaultBuffer.Get(),
		D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_GENERIC_READ));

	// Note: uploadBuffer has to be kept alive after the above function calls because
	// the command list has not been executed yet that performs the actual copy.
	// The caller can Release the uploadBuffer after it knows the copy has been executed.


	return defaultBuffer;
}
开发者ID:byhj,项目名称:byhj-Render,代码行数:51,代码来源:d3d12Util.cpp

示例10: ApplyInlineFormat

void TextInlineFormat_Color::ApplyInlineFormat(ID2D1RenderTarget* target, IDWriteTextLayout* layout)
{
	if (!target || !layout) return;

	Microsoft::WRL::ComPtr<ID2D1SolidColorBrush> solidBrush;
	HRESULT hr = target->CreateSolidColorBrush(ToColorF(m_Color), solidBrush.GetAddressOf());
	if (FAILED(hr)) return;

	for (const auto& range : GetRanges())
	{
		if (range.length <= 0) continue;

		layout->SetDrawingEffect(solidBrush.Get(), range);
	}
}
开发者ID:Crawping,项目名称:rainmeter,代码行数:15,代码来源:TextInlineFormatColor.cpp

示例11: LoadTextures

void TextureManager::LoadTextures(const std::vector<std::string>& TexturesLocation)
{
  for (std::string TextureLoc : TexturesLocation)
  {
    const std::string &fixed = "..\\examples\\assets\\" + TextureLoc.substr(0, TextureLoc.find_last_of('.')) + ".DDS";
    std::ifstream DDSFile(fixed, std::ifstream::binary);
    irr::video::CImageLoaderDDS DDSPic(DDSFile);
#ifdef GLBUILD
    WrapperResource *res = (WrapperResource*)malloc(sizeof(WrapperResource));
    // TODO : clean it
    GLTexture *tmptexture = new GLTexture(DDSPic.getLoadedImage());
    res->GLValue.Resource = tmptexture->Id;
    res->GLValue.Type = GL_TEXTURE_2D;
#endif

#ifdef DXBUILD
    D3DTexture TextureInRam(DDSPic.getLoadedImage());
    WrapperResource *res = (WrapperResource*)malloc(sizeof(WrapperResource));

    HRESULT hr = Context::getInstance()->dev->CreateCommittedResource(
      &CD3D12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT),
      D3D12_HEAP_MISC_NONE,
      &CD3D12_RESOURCE_DESC::Tex2D(TextureInRam.getFormat(), (UINT)TextureInRam.getWidth(), (UINT)TextureInRam.getHeight(), 1, (UINT16)TextureInRam.getMipLevelsCount()),
      D3D12_RESOURCE_USAGE_GENERIC_READ,
      nullptr,
      IID_PPV_ARGS(&res->D3DValue.resource)
      );

    Microsoft::WRL::ComPtr<ID3D12CommandAllocator> cmdalloc;
    Context::getInstance()->dev->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&cmdalloc));
    Microsoft::WRL::ComPtr<ID3D12GraphicsCommandList> cmdlist;
    Context::getInstance()->dev->CreateCommandList(1, D3D12_COMMAND_LIST_TYPE_DIRECT, cmdalloc.Get(), nullptr, IID_PPV_ARGS(&cmdlist));

    TextureInRam.CreateUploadCommandToResourceInDefaultHeap(cmdlist.Get(), res->D3DValue.resource);

    cmdlist->Close();
    Context::getInstance()->cmdqueue->ExecuteCommandLists(1, (ID3D12CommandList**)cmdlist.GetAddressOf());
    HANDLE handle = getCPUSyncHandle(Context::getInstance()->cmdqueue.Get());
    res->D3DValue.description.TextureView.SRV = TextureInRam.getResourceViewDesc();

    WaitForSingleObject(handle, INFINITE);
    CloseHandle(handle);
#endif
    textureSet.emplace(TextureLoc, res);
  }
}
开发者ID:RedJun,项目名称:YAGF,代码行数:46,代码来源:texturemanager.cpp

示例12:

void CanvasD2D::FillRectangle(Gdiplus::Rect& rect, const Gdiplus::SolidBrush& brush)
{
	if (!m_Target)  // Use GDI+ if D2D render target has not been created.
	{
		m_GdipGraphics->FillRectangle(&brush, rect);
		return;
	}

	Gdiplus::Color color;
	brush.GetColor(&color);

	Microsoft::WRL::ComPtr<ID2D1SolidColorBrush> solidBrush;
	HRESULT hr = m_Target->CreateSolidColorBrush(ToColorF(color), solidBrush.GetAddressOf());
	if (SUCCEEDED(hr))
	{
		m_Target->FillRectangle(ToRectF(rect), solidBrush.Get());
	}
}
开发者ID:asdlei00,项目名称:rainmeter,代码行数:18,代码来源:CanvasD2D.cpp

示例13: ApplyInlineFormat

void TextInlineFormat_Typography::ApplyInlineFormat(IDWriteTextLayout* layout)
{
	if (!layout) return;

	for (const auto& range : GetRanges())
	{
		if (range.length <= 0) continue;

		Microsoft::WRL::ComPtr<IDWriteTypography> typography;
		HRESULT hr = Canvas::c_DWFactory->CreateTypography(typography.GetAddressOf());
		if (FAILED(hr)) continue;

		DWRITE_FONT_FEATURE feature = { m_Tag, m_Parameter };
		hr = typography->AddFontFeature(feature);
		if (FAILED(hr)) continue;

		layout->SetTypography(typography.Get(), range);
	}
}
开发者ID:Crawping,项目名称:rainmeter,代码行数:19,代码来源:TextInlineFormatTypography.cpp

示例14: DXWrapper_InitDeviceAndContext

void DXWrapper_InitDeviceAndContext( Microsoft::WRL::ComPtr<ID3D11Device1> pDevice,
                                     Microsoft::WRL::ComPtr<ID3D11DeviceContext1> pContext,
                                     Microsoft::WRL::ComPtr<ID3D11RenderTargetView> pRenderTargetView,
                                     Microsoft::WRL::ComPtr<ID3D11DepthStencilView> pDepthStencilView )
{
    g_pD3DDevice = pDevice;
    g_pD3DContext = pContext;
    g_pD3DRenderTargetView = pRenderTargetView;
    g_pD3DDepthStencilView = pDepthStencilView;

    g_pD3DContext->OMSetRenderTargets( 1, g_pD3DRenderTargetView.GetAddressOf(), g_pD3DDepthStencilView.Get() );

    D3DCreateDepthStencilStates();
    D3DCreateSamplerStates();
    D3DCreateBlendStates();

    float blendfactor[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
    g_pD3DContext->OMSetBlendState( g_pD3DBlendStateEnabled.Get(), blendfactor, 0xfff );

    UpdateDepthState();
}
开发者ID:pmeneguzzi,项目名称:MyFramework,代码行数:21,代码来源:DXWrapper.cpp

示例15: onKeyUp

void Scene::onKeyUp(UINT8 key)
{
	if (key == 'Z') {

		DXGI_SWAP_CHAIN_DESC desc;
		this->mpSwapChain->GetDesc(&desc);

		Microsoft::WRL::ComPtr<IDXGIOutput> pOutput;
		if (desc.Windowed) {
			//全画面モードに切り替える際はどのディスプレイを対象にするか決めれる
			if (DXGI_ERROR_NOT_FOUND == this->mpAdapter->EnumOutputs(0, pOutput.GetAddressOf())) {
				throw std::runtime_error("アダプターの出力先が見つかりません。");
			}
		}

		auto hr = this->mpSwapChain->SetFullscreenState(desc.Windowed, pOutput.Get());
		if (FAILED(hr)) {
			throw std::runtime_error("フルスリーンモードとウィンドウモードの切り替えに失敗。");
		}
	}
}
开发者ID:tositeru,项目名称:ImasaraDX11,代码行数:21,代码来源:Scene.cpp


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