本文整理汇总了C++中SkTScopedComPtr::release方法的典型用法代码示例。如果您正苦于以下问题:C++ SkTScopedComPtr::release方法的具体用法?C++ SkTScopedComPtr::release怎么用?C++ SkTScopedComPtr::release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkTScopedComPtr
的用法示例。
在下文中一共展示了SkTScopedComPtr::release方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindOrAdd
int FindOrAdd(IDWriteFontFileLoader* fontFileLoader,
const void* refKey, UINT32 refKeySize) const
{
SkTScopedComPtr<IUnknown> fontFileLoaderId;
HR_GENERAL(fontFileLoader->QueryInterface(&fontFileLoaderId),
"Failed to re-convert to IDWriteFontFileLoader.",
SkFontIdentity::kInvalidDataId);
SkAutoMutexAcquire ama(fDataIdCacheMutex);
int count = fDataIdCache.count();
int i;
for (i = 0; i < count; ++i) {
const DataId& current = fDataIdCache[i];
if (fontFileLoaderId.get() == current.fLoader &&
refKeySize == current.fKeySize &&
0 == memcmp(refKey, current.fKey, refKeySize))
{
return i;
}
}
DataId& added = fDataIdCache.push_back();
added.fLoader = fontFileLoaderId.release(); // Ref is passed.
added.fKey = sk_malloc_throw(refKeySize);
memcpy(added.fKey, refKey, refKeySize);
added.fKeySize = refKeySize;
return i;
}
示例2: CreateStreamFromKey
HRESULT StreamFontFileLoader::CreateStreamFromKey(
void const* fontFileReferenceKey,
UINT32 fontFileReferenceKeySize,
IDWriteFontFileStream** fontFileStream)
{
SkTScopedComPtr<SkDWriteFontFileStreamWrapper> stream;
HR(SkDWriteFontFileStreamWrapper::Create(fStream->duplicate(), &stream));
*fontFileStream = stream.release();
return S_OK;
}
示例3: onCreateFamilyNameIterator
SkTypeface::LocalizedStrings* DWriteFontTypeface::onCreateFamilyNameIterator() const {
SkTypeface::LocalizedStrings* nameIter =
SkOTUtils::LocalizedStrings_NameTable::CreateForFamilyNames(*this);
if (nullptr == nameIter) {
SkTScopedComPtr<IDWriteLocalizedStrings> familyNames;
HRNM(fDWriteFontFamily->GetFamilyNames(&familyNames), "Could not obtain family names.");
nameIter = new LocalizedStrings_IDWriteLocalizedStrings(familyNames.release());
}
return nameIter;
}
示例4: CreateEnumeratorFromKey
HRESULT StreamFontCollectionLoader::CreateEnumeratorFromKey(
IDWriteFactory* factory,
void const* collectionKey,
UINT32 collectionKeySize,
IDWriteFontFileEnumerator** fontFileEnumerator)
{
SkTScopedComPtr<StreamFontFileEnumerator> enumerator;
HR(StreamFontFileEnumerator::Create(factory, fFontFileLoader.get(), &enumerator));
*fontFileEnumerator = enumerator.release();
return S_OK;
}
示例5: NewFromEncodedWIC
//.........这里部分代码省略.........
if (FAILED(hr)) {
return nullptr;
}
// Create an IStream.
SkTScopedComPtr<IStream> iStream;
// Note that iStream will take ownership of the new memory stream because
// we set |deleteOnRelease| to true.
hr = SkIStream::CreateFromSkStream(new SkMemoryStream(data), true, &iStream);
if (FAILED(hr)) {
return nullptr;
}
// Create the decoder from the stream.
SkTScopedComPtr<IWICBitmapDecoder> decoder;
hr = imagingFactory->CreateDecoderFromStream(iStream.get(), nullptr,
WICDecodeMetadataCacheOnDemand, &decoder);
if (FAILED(hr)) {
return nullptr;
}
// Select the first frame from the decoder.
SkTScopedComPtr<IWICBitmapFrameDecode> imageFrame;
hr = decoder->GetFrame(0, &imageFrame);
if (FAILED(hr)) {
return nullptr;
}
// Treat the frame as an image source.
SkTScopedComPtr<IWICBitmapSource> imageSource;
hr = imageFrame->QueryInterface(IID_PPV_ARGS(&imageSource));
if (FAILED(hr)) {
return nullptr;
}
// Get the size of the image.
UINT width;
UINT height;
hr = imageSource->GetSize(&width, &height);
if (FAILED(hr)) {
return nullptr;
}
// Get the encoded pixel format.
WICPixelFormatGUID format;
hr = imageSource->GetPixelFormat(&format);
if (FAILED(hr)) {
return nullptr;
}
// Recommend kOpaque if the image is opaque and kPremul otherwise.
// FIXME: We are stuck recommending kPremul for all indexed formats
// (Ex: GUID_WICPixelFormat8bppIndexed) because we don't have
// a way to check if the image has alpha.
SkAlphaType alphaType = kPremul_SkAlphaType;
if (GUID_WICPixelFormat16bppBGR555 == format ||
GUID_WICPixelFormat16bppBGR565 == format ||
GUID_WICPixelFormat32bppBGR101010 == format ||
GUID_WICPixelFormatBlackWhite == format ||
GUID_WICPixelFormat2bppGray == format ||
GUID_WICPixelFormat4bppGray == format ||
GUID_WICPixelFormat8bppGray == format ||
GUID_WICPixelFormat16bppGray == format ||
GUID_WICPixelFormat16bppGrayFixedPoint == format ||
GUID_WICPixelFormat16bppGrayHalf == format ||
GUID_WICPixelFormat32bppGrayFloat == format ||
GUID_WICPixelFormat32bppGrayFixedPoint == format ||
GUID_WICPixelFormat32bppRGBE == format ||
GUID_WICPixelFormat24bppRGB == format ||
GUID_WICPixelFormat24bppBGR == format ||
GUID_WICPixelFormat32bppBGR == format ||
GUID_WICPixelFormat48bppRGB == format ||
GUID_WICPixelFormat48bppBGR == format ||
GUID_WICPixelFormat48bppRGBFixedPoint == format ||
GUID_WICPixelFormat48bppBGRFixedPoint == format ||
GUID_WICPixelFormat48bppRGBHalf == format ||
GUID_WICPixelFormat64bppRGBFixedPoint == format ||
GUID_WICPixelFormat64bppRGBHalf == format ||
GUID_WICPixelFormat96bppRGBFixedPoint == format ||
GUID_WICPixelFormat128bppRGBFloat == format ||
GUID_WICPixelFormat128bppRGBFixedPoint == format ||
GUID_WICPixelFormat32bppRGB == format ||
GUID_WICPixelFormat64bppRGB == format ||
GUID_WICPixelFormat96bppRGBFloat == format ||
GUID_WICPixelFormat32bppCMYK == format ||
GUID_WICPixelFormat64bppCMYK == format ||
GUID_WICPixelFormat8bppY == format ||
GUID_WICPixelFormat8bppCb == format ||
GUID_WICPixelFormat8bppCr == format ||
GUID_WICPixelFormat16bppCbCr == format)
{
alphaType = kOpaque_SkAlphaType;
}
// FIXME: If we change the implementation to handle swizzling ourselves,
// we can support more output formats.
SkImageInfo info = SkImageInfo::MakeN32(width, height, alphaType);
return new SkImageGeneratorWIC(info, imagingFactory.release(), imageSource.release(), data);
}