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

C++ sk_throw函数代码示例

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

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



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

示例1: vm2env

void AndroidPixelRef::globalRef(void* localref) {
    if (fWrappedPixelRef) {
        // delegate java obj management to the wrapped ref
        fWrappedPixelRef->globalRef(localref);

        // Note: we only ref and unref the wrapped AndroidPixelRef so that
        // bitmap->pixelRef()->globalRef() and globalUnref() can be used in a pair, even if
        // the bitmap has its underlying AndroidPixelRef swapped out/wrapped
        return;
    }
    if (fOnJavaHeap && sk_atomic_inc(&fGlobalRefCnt) == 0) {
        JNIEnv *env = vm2env(fVM);

        // If JNI ref was passed, it is always used
        if (localref) fStorageObj = (jbyteArray) localref;

        if (fStorageObj == NULL) {
            SkDebugf("No valid local ref to create a JNI global ref\n");
            sk_throw();
        }
        if (fHasGlobalRef) {
            // This should never happen
            SkDebugf("Already holding a JNI global ref");
            sk_throw();
        }

        fStorageObj = (jbyteArray) env->NewGlobalRef(fStorageObj);
        // TODO: Check for failure here
        fHasGlobalRef = true;
    }
    ref();
}
开发者ID:lovelifer,项目名称:graduate,代码行数:32,代码来源:Graphics.cpp


示例2: ref_ft_face

static SkFaceRec* ref_ft_face(uint32_t fontID) {
    SkFaceRec* rec = gFaceRecHead;
    while (rec) {
        if (rec->fFontID == fontID) {
            SkASSERT(rec->fFace);
            rec->fRefCnt += 1;
            return rec;
        }
        rec = rec->fNext;
    }

    SkStream* strm = SkFontHost::OpenStream(fontID);
    if (NULL == strm) {
        SkDEBUGF(("SkFontHost::OpenStream failed opening %x\n", fontID));
        sk_throw();
        return 0;
    }

    // this passes ownership of strm to the rec
    rec = SkNEW_ARGS(SkFaceRec, (strm, fontID));

    FT_Open_Args    args;
    memset(&args, 0, sizeof(args));
    const void* memoryBase = strm->getMemoryBase();

    if (NULL != memoryBase) {
//printf("mmap(%s)\n", keyString.c_str());
        args.flags = FT_OPEN_MEMORY;
        args.memory_base = (const FT_Byte*)memoryBase;
        args.memory_size = strm->getLength();
    } else {
//printf("fopen(%s)\n", keyString.c_str());
        args.flags = FT_OPEN_STREAM;
        args.stream = &rec->fFTStream;
    }

    FT_Error err = FT_Open_Face(gFTLibrary, &args, 0, &rec->fFace);

    if (err) {    // bad filename, try the default font
        fprintf(stderr, "ERROR: unable to open font '%x'\n", fontID);
        SkDELETE(rec);
        sk_throw();
        return 0;
    } else {
        SkASSERT(rec->fFace);
        //fprintf(stderr, "Opened font '%s'\n", filename.c_str());
        rec->fNext = gFaceRecHead;
        gFaceRecHead = rec;
        rec->fRefCnt = 1;
        return rec;
    }
}
开发者ID:edrikL,项目名称:gears,代码行数:52,代码来源:SkFontHost_FreeType.cpp


示例3: init_skin_anim

void init_skin_anim(const char path[], SkAnimator* anim) {
    SkASSERT(path && anim);

    SkAutoTUnref<SkStream> stream(SkStream::NewFromFile(path));
    if (!stream.get()) {
        SkDEBUGF(("init_skin_anim: loading skin failed <%s>\n", path));
        sk_throw();
    }

    if (!anim->decodeStream(stream)) {
        SkDEBUGF(("init_skin_anim: decoding skin failed <%s>\n", path));
        sk_throw();
    }
}
开发者ID:3rdexp,项目名称:soui,代码行数:14,代码来源:SkWidgetViews.cpp


示例4: fTotalSize

JavaMemoryUsageReporter::JavaMemoryUsageReporter(JNIEnv* env)
    : fTotalSize(0) {
    if (env->GetJavaVM(&fVM) != JNI_OK) {
        SkDebugf("------ [%p] env->GetJavaVM failed\n", env);
        sk_throw();
    }
}
开发者ID:ConicalRom,项目名称:platform_frameworks_base,代码行数:7,代码来源:Graphics.cpp


示例5: sk_malloc_flags

void* sk_malloc_flags(size_t size, unsigned flags) {
    void* p;
#if defined(ANDROID)
    // Android doesn't have std::set_new_handler.
    p = malloc(size);
#else
    if (!(flags & SK_MALLOC_THROW)) {
#if defined(OS_MACOSX) && !defined(OS_IOS)
      p = base::UncheckedMalloc(size);
#else
      SkAutoMutexAcquire lock(gSkNewHandlerMutex);
      std::new_handler old_handler = std::set_new_handler(NULL);
      p = malloc(size);
      std::set_new_handler(old_handler);
#endif
    } else {
      p = malloc(size);
    }
#endif
    if (p == NULL) {
        if (flags & SK_MALLOC_THROW) {
            sk_throw();
        }
    }
    return p;
}
开发者ID:AchironOS,项目名称:chromium.src,代码行数:26,代码来源:SkMemory_new_handler.cpp


示例6: SkASSERT

SkFlattenable* SkFlattenableReadBuffer::readFlattenable() {
    SkFlattenable::Factory factory = NULL;

    if (fFactoryCount > 0) {
        int32_t index = this->readU32();
        if (0 == index) {
            return NULL; // writer failed to give us the flattenable
        }
        index = -index; // we stored the negative of the index
        index -= 1;     // we stored the index-base-1
        SkASSERT(index < fFactoryCount);
        factory = fFactoryArray[index];
    } else if (fFactoryTDArray) {
        const int32_t* peek = (const int32_t*)this->peek();
        if (*peek <= 0) {
            int32_t index = this->readU32();
            if (0 == index) {
                return NULL; // writer failed to give us the flattenable
            }
            index = -index; // we stored the negative of the index
            index -= 1;     // we stored the index-base-1
            factory = (*fFactoryTDArray)[index];
        } else {
            const char* name = this->readString();
            factory = SkFlattenable::NameToFactory(name);
            if (factory) {
                SkASSERT(fFactoryTDArray->find(factory) < 0);
                *fFactoryTDArray->append() = factory;
            } else {
//                SkDebugf("can't find factory for [%s]\n", name);
            }
            // if we didn't find a factory, that's our failure, not the writer's,
            // so we fall through, so we can skip the sizeRecorded data.
        }
    } else {
        factory = (SkFlattenable::Factory)readFunctionPtr();
        if (NULL == factory) {
            return NULL; // writer failed to give us the flattenable
        }
    }

    // if we get here, factory may still be null, but if that is the case, the
    // failure was ours, not the writer.
    SkFlattenable* obj = NULL;
    uint32_t sizeRecorded = this->readU32();
    if (factory) {
        uint32_t offset = this->offset();
        obj = (*factory)(*this);
        // check that we read the amount we expected
        uint32_t sizeRead = this->offset() - offset;
        if (sizeRecorded != sizeRead) {
            // we could try to fix up the offset...
            sk_throw();
        }
    } else {
        // we must skip the remaining data
        this->skip(sizeRecorded);
    }
    return obj;
}
开发者ID:AliFarahnak,项目名称:XobotOS,代码行数:60,代码来源:SkFlattenable.cpp


示例7: load_system_fonts

SkTypeface* SkFontHost::Deserialize(SkStream* stream) {
#if 0
    load_system_fonts();
    
    int style = stream->readU8();
    
    int len = stream->readPackedUInt();
    if (len > 0) {
        SkString str;
        str.resize(len);
        stream->read(str.writable_str(), len);
        
        const FontInitRec* rec = gSystemFonts;
        for (size_t i = 0; i < SK_ARRAY_COUNT(gSystemFonts); i++) {
            if (strcmp(rec[i].fFileName, str.c_str()) == 0) {
                // backup until we hit the fNames
                for (int j = i; j >= 0; --j) {
                    if (rec[j].fNames != NULL) {
                        return SkFontHost::CreateTypeface(NULL, rec[j].fNames[0], NULL, 0,
                                                          (SkTypeface::Style)style);
                    }
                }
            }
        }
    }
    return SkFontHost::CreateTypeface(NULL, NULL, NULL, 0, (SkTypeface::Style)style);
#endif
    sk_throw();
    return NULL;
}
开发者ID:AliFarahnak,项目名称:XobotOS,代码行数:30,代码来源:SkFontHost_linux.cpp


示例8: fReportSizeToVM

JavaPixelAllocator::JavaPixelAllocator(JNIEnv* env, bool reportSizeToVM)
    : fReportSizeToVM(reportSizeToVM) {
    if (env->GetJavaVM(&fVM) != JNI_OK) {
        SkDebugf("------ [%p] env->GetJavaVM failed\n", env);
        sk_throw();
    }
}
开发者ID:ConicalRom,项目名称:platform_frameworks_base,代码行数:7,代码来源:Graphics.cpp


示例9: fStorageObj

JavaPixelAllocator::JavaPixelAllocator(JNIEnv* env)
    : fStorageObj(NULL),
      fAllocCount(0) {
    if (env->GetJavaVM(&fVM) != JNI_OK) {
        SkDebugf("------ [%p] env->GetJavaVM failed\n", env);
        sk_throw();
    }
}
开发者ID:0xr0ot,项目名称:frameworks_base,代码行数:8,代码来源:Graphics.cpp


示例10: sk_malloc_flags

void* sk_malloc_flags(size_t size, unsigned flags) {
    void* p = MALLOC(size | ALLOC_NO_ZMEM);
    if (p == NULL) {
        if (flags & SK_MALLOC_THROW) {
            sk_throw();
        }
    }
    return p;
}
开发者ID:0omega,项目名称:platform_external_skia,代码行数:9,代码来源:SkMemory_brew.cpp


示例11: init_skin_anim

void init_skin_anim(const char path[], SkAnimator* anim)
{
	SkASSERT(path && anim);

	SkFILEStream	stream(path);

	if (!stream.isValid())
	{
		SkDEBUGF(("init_skin_anim: loading skin failed <%s>\n", path));
		sk_throw();
	}

	if (!anim->decodeStream(&stream))
	{
		SkDEBUGF(("init_skin_anim: decoding skin failed <%s>\n", path));
		sk_throw();
	}
}
开发者ID:chromium-googlesource-mirror,项目名称:skia,代码行数:18,代码来源:SkWidgetViews.cpp


示例12: INHERITED

SkLocalMatrixShader::SkLocalMatrixShader(SkReadBuffer& buffer) : INHERITED(buffer) {
    if (buffer.isVersionLT(SkReadBuffer::kSimplifyLocalMatrix_Version)) {
        buffer.readMatrix(&(INHERITED::fLocalMatrix));
    }
    fProxyShader.reset(buffer.readShader());
    if (NULL == fProxyShader.get()) {
        sk_throw();
    }
}
开发者ID:DXGL,项目名称:skia,代码行数:9,代码来源:SkLocalMatrixShader.cpp


示例13: sk_new_handler

	static void sk_new_handler()
	{
		if (SkGraphics::SetFontCacheUsed(0))
			return;
		if (gPrevNewHandler)
			gPrevNewHandler();
		else
			sk_throw();
	}
开发者ID:AliFarahnak,项目名称:XobotOS,代码行数:9,代码来源:SkOSWindow_Mac.cpp


示例14: sk_throw

SkImageInfo GrSurface::info(SkAlphaType alphaType) const {
    SkColorType colorType;
    SkColorProfileType profileType;
    if (!GrPixelConfig2ColorAndProfileType(this->config(), &colorType, &profileType)) {
        sk_throw();
    }
    return SkImageInfo::Make(this->width(), this->height(), colorType, alphaType,
                             profileType);
}
开发者ID:mariospr,项目名称:chromium-browser,代码行数:9,代码来源:GrSurface.cpp


示例15: sk_throw

SkImageInfo GrSurface::info() const {
    SkImageInfo info;
    if (!GrPixelConfig2ColorType(this->config(), &info.fColorType)) {
        sk_throw();
    }
    info.fWidth = this->width();
    info.fHeight = this->height();
    info.fAlphaType = kPremul_SkAlphaType;
    return info;
}
开发者ID:hobinjk,项目名称:gecko-dev,代码行数:10,代码来源:GrSurface.cpp


示例16: AndroidPixelRef

    /** Allocate the specified buffer for pixels. The memory is freed when the
        last owner of this pixelref is gone. Our caller has already informed
        the VM of our allocation.
    */
    AndroidPixelRef(JNIEnv* env, void* storage, size_t size,
            SkColorTable* ctable) : SkMallocPixelRef(storage, size, ctable) {
        SkASSERT(storage);
        SkASSERT(env);

        if (env->GetJavaVM(&fVM) != JNI_OK) {
            SkDebugf("------ [%p] env->GetJavaVM failed\n", env);
            sk_throw();
        }        
    }
开发者ID:Achotjan,项目名称:FreeXperia,代码行数:14,代码来源:Graphics.cpp


示例17: sk_realloc_throw

void* sk_realloc_throw(void* addr, size_t size) {
    void* p = REALLOC(addr, size | ALLOC_NO_ZMEM);
    if (size == 0) {
        return p;
    }
    if (p == NULL) {
        sk_throw();
    }
    return p;
}
开发者ID:0omega,项目名称:platform_external_skia,代码行数:10,代码来源:SkMemory_brew.cpp


示例18: vm2env

static JNIEnv* vm2env(JavaVM* vm)
{
    JNIEnv* env = NULL;
    if (vm->GetEnv((void**)&env, JNI_VERSION_1_4) != JNI_OK || NULL == env)
    {
        SkDebugf("------- [%p] vm->GetEnv() failed\n", vm);
        sk_throw();
    }
    return env;
}
开发者ID:0xr0ot,项目名称:frameworks_base,代码行数:10,代码来源:Graphics.cpp


示例19: sk_realloc_throw

void* sk_realloc_throw(void* addr, size_t size) {
    void* p = realloc(addr, size);
    if (size == 0) {
        return p;
    }
    if (p == NULL) {
        sk_throw();
    }
    return p;
}
开发者ID:1065672644894730302,项目名称:Chromium,代码行数:10,代码来源:SkMemory_new_handler.cpp


示例20: sk_realloc_throw

void* sk_realloc_throw(void* addr, size_t size) {
    gSkMemStats.updateBytes(size - gSkMemStats.getBlockSize(addr));
    void* p = realloc(addr, size);
    if (size == 0) {
        return p;
    }
    if (p == NULL) {
        sk_throw();
    }
    return p;
}
开发者ID:jiezh,项目名称:h5vcc,代码行数:11,代码来源:SkMemory_new_handler.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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