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


C++ SkTDArray::deleteAll方法代码示例

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


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

示例1: getFamilies

void
SkFontData::loadXml( SkTDArray<FontInitRec> &info )
{
    SkTDArray<FontFamily*> families;
    getFamilies( families );
    info.reset();

    for( int i = 0 ; i < families.count() ; ++i )
    {
        FontFamily * family = families[i];

        for( int j = 0 ; j < family->fFontFileArray.count() ; ++j )
        {
            const char * filename = family->fFontFileArray[j]->fFileName;
#ifndef DEPRECATED_CODE
            HyLogif( "DEPRECATED_CODE" );
            if( haveSystemFont( filename ) )
                continue;
#endif
            FontInitRec fontInfoRecord;
            fontInfoRecord.fFileName = filename;

            if( j == 0 )
            {
                if( family->fNames.count() == 0 )
                    fontInfoRecord.fNames = ( char ** )gFBNames; // fallback.
                else
                {
                    SkTDArray<const char*> names = family->fNames;
                    const char ** nameList = ( const char ** )calloc( ( names.count() + 1 ), sizeof( char * ) );

                    if( nameList == NULL )
                    {
                        break;
                    }

                    for( int n = 0 ; n < names.count() ; ++n )
                    {
                        nameList[n] = names[n];
                    }

                    nameList[names.count()] = NULL;
                    fontInfoRecord.fNames = nameList;
                }
            }
            else
            {
                fontInfoRecord.fNames = NULL;
            }

            *info.append() = fontInfoRecord;
        }
    }

    families.deleteAll();
}
开发者ID:,项目名称:,代码行数:56,代码来源:

示例2: base

 SkFontMgr_Android(const SkFontMgr_Android_CustomFonts* custom) {
     SkTDArray<FontFamily*> families;
     if (custom && SkFontMgr_Android_CustomFonts::kPreferSystem != custom->fSystemFontUse) {
         SkString base(custom->fBasePath);
         SkFontMgr_Android_Parser::GetCustomFontFamilies(
             families, base, custom->fFontsXml, custom->fFallbackFontsXml);
     }
     if (!custom ||
         (custom && SkFontMgr_Android_CustomFonts::kOnlyCustom != custom->fSystemFontUse))
     {
         SkFontMgr_Android_Parser::GetSystemFontFamilies(families);
     }
     if (custom && SkFontMgr_Android_CustomFonts::kPreferSystem == custom->fSystemFontUse) {
         SkString base(custom->fBasePath);
         SkFontMgr_Android_Parser::GetCustomFontFamilies(
             families, base, custom->fFontsXml, custom->fFallbackFontsXml);
     }
     this->buildNameToFamilyMap(families, custom ? custom->fIsolated : false);
     this->findDefaultStyleSet();
     families.deleteAll();
 }
开发者ID:sylvestre,项目名称:skia,代码行数:21,代码来源:SkFontMgr_android.cpp

示例3: load_font_info

/*  Load info from a configuration file that populates the system/fallback font structures
*/
static void load_font_info() {
    SkTDArray<FontFamily*> fontFamilies;
    if (gTestMainConfigFile) {
        getTestFontFamilies(fontFamilies, gTestMainConfigFile, gTestFallbackConfigFile);
    } else {
        getFontFamilies(fontFamilies);
    }

    SkTDArray<FontInitRec> fontInfo;
    bool firstInFamily = false;
    for (int i = 0; i < fontFamilies.count(); ++i) {
        FontFamily *family = fontFamilies[i];
        firstInFamily = true;
        for (int j = 0; j < family->fFileNames.count(); ++j) {
            FontInitRec fontInfoRecord;
            fontInfoRecord.fFileName = family->fFileNames[j];
            if (j == 0) {
                if (family->fNames.count() == 0) {
                    // Fallback font
                    fontInfoRecord.fNames = (char **)gFBNames;
                } else {
                    SkTDArray<const char*> names = family->fNames;
                    const char **nameList = (const char**)
                            malloc((names.count() + 1) * sizeof(char*));
                    if (nameList == NULL) {
                        // shouldn't get here
                        SkDEBUGFAIL("Failed to allocate nameList");
                        break;
                    }
                    if (gDefaultNames == NULL) {
                        gDefaultNames = (char**) nameList;
                    }
                    for (int i = 0; i < names.count(); ++i) {
                        nameList[i] = names[i];
                    }
                    nameList[names.count()] = NULL;
                    fontInfoRecord.fNames = nameList;
                }
            } else {
                fontInfoRecord.fNames = NULL;
            }
            *fontInfo.append() = fontInfoRecord;
        }
    }
    gNumSystemFonts = fontInfo.count();
    gSystemFonts = (FontInitRec*) malloc(gNumSystemFonts * sizeof(FontInitRec));
    gFallbackFonts = (uint32_t*) malloc((gNumSystemFonts + 1) * sizeof(uint32_t));
    if (gSystemFonts == NULL) {
        // shouldn't get here
        SkDEBUGFAIL("No system fonts were found");
        gNumSystemFonts = 0;
    }

#if SK_DEBUG_FONTS
    SkDebugf("---- We have %d system fonts", gNumSystemFonts);
#endif
    for (size_t i = 0; i < gNumSystemFonts; ++i) {
        gSystemFonts[i].fFileName = fontInfo[i].fFileName;
        gSystemFonts[i].fNames = fontInfo[i].fNames;
#if SK_DEBUG_FONTS
        SkDebugf("---- gSystemFonts[%d] fileName=%s", i, fontInfo[i].fFileName);
#endif
    }
    fontFamilies.deleteAll();
}
开发者ID:bunhere,项目名称:skia,代码行数:67,代码来源:SkFontHost_android.cpp

示例4: tool_main

int tool_main(int argc, char** argv) {
    SetupCrashHandler();
    SkAutoGraphics ag;
    SkCommandLineFlags::Parse(argc, argv);

    const double overhead = estimate_timer_overhead();

    if (FLAGS_verbose) {
        // No header.
    } else if (FLAGS_quiet) {
        SkDebugf("min\tbench\tconfig\n");
    } else {
        SkDebugf("loops\tmin\tmean\tmax\tstddev\tbench\tconfig\n");
    }

    for (const BenchRegistry* r = BenchRegistry::Head(); r != NULL; r = r->next()) {
        SkAutoTDelete<Benchmark> bench(r->factory()(NULL));
        if (SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getName())) {
            continue;
        }

        SkTDArray<SkSurface*> surfaces;
        SkTDArray<const char*> configs;
        create_surfaces(bench.get(), &surfaces, &configs);

        bench->preDraw();
        for (int j = 0; j < surfaces.count(); j++) {
            SkCanvas* canvas = surfaces[j] ? surfaces[j]->getCanvas() : NULL;
            const char* config = configs[j];

            bench->draw(1, canvas);  // Just paranoid warmup.
            safe_flush(canvas);
            const int loops = guess_loops(overhead, bench.get(), canvas);

            SkAutoTMalloc<double> samples(FLAGS_samples);
            WallTimer timer;
            for (int i = 0; i < FLAGS_samples; i++) {
                timer.start();
                bench->draw(loops, canvas);
                safe_flush(canvas);
                timer.end();
                samples[i] = timer.fWall / loops;
            }

            Stats stats(samples.get(), FLAGS_samples);

            if (FLAGS_verbose) {
                for (int i = 0; i < FLAGS_samples; i++) {
                    SkDebugf("%s  ", humanize(samples[i]).c_str());
                }
                SkDebugf("%s\n", bench->getName());
            } else if (FLAGS_quiet) {
                if (configs.count() == 1) {
                    config = ""; // Only print the config if we run the same bench on more than one.
                }
                SkDebugf("%s\t%s\t%s\n", humanize(stats.min).c_str(), bench->getName(), config);
            } else {
                const double stddev_percent = 100 * sqrt(stats.var) / stats.mean;
                SkDebugf("%d\t%s\t%s\t%s\t%.0f%%\t%s\t%s\n"
                        , loops
                        , humanize(stats.min).c_str()
                        , humanize(stats.mean).c_str()
                        , humanize(stats.max).c_str()
                        , stddev_percent
                        , bench->getName()
                        , config
                        );
            }
        }
        surfaces.deleteAll();
    }

    return 0;
}
开发者ID:Crawping,项目名称:skia_custom,代码行数:74,代码来源:nanobench.cpp


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