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


C++ SkString::remove方法代码示例

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


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

示例1: make_png_name

static SkString make_png_name(const char* filename) {
    SkString pngName = SkString(filename);
    pngName.remove(pngName.size() - 3, 3);
    pngName.append("png");
    return pngName;
}
开发者ID:MIPS,项目名称:external-skia,代码行数:6,代码来源:SkpSkGrTest.cpp

示例2: render

bool CopyTilesRenderer::render(SkBitmap** out) {
    int i = 0;
    bool success = true;
    SkBitmap dst;
    for (int x = 0; x < this->getViewWidth(); x += fLargeTileWidth) {
        for (int y = 0; y < this->getViewHeight(); y += fLargeTileHeight) {
            SkAutoCanvasRestore autoRestore(fCanvas, true);
            // Translate so that we draw the correct portion of the picture.
            // Perform a postTranslate so that the scaleFactor does not interfere with the
            // positioning.
            SkMatrix mat(fCanvas->getTotalMatrix());
            mat.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y));
            fCanvas->setMatrix(mat);
            // Draw the picture
            if (fUseMultiPictureDraw) {
                SkMultiPictureDraw mpd;

                mpd.add(fCanvas, fPicture);

                mpd.draw();
            } else {
                fCanvas->drawPicture(fPicture);
            }
            // Now extract the picture into tiles
            SkBitmap baseBitmap;
            fCanvas->readPixels(SkIRect::MakeSize(fCanvas->getBaseLayerSize()), &baseBitmap);
            SkIRect subset;
            for (int tileY = 0; tileY < fLargeTileHeight; tileY += this->getTileHeight()) {
                for (int tileX = 0; tileX < fLargeTileWidth; tileX += this->getTileWidth()) {
                    subset.set(tileX, tileY, tileX + this->getTileWidth(),
                               tileY + this->getTileHeight());
                    SkDEBUGCODE(bool extracted =)
                    baseBitmap.extractSubset(&dst, subset);
                    SkASSERT(extracted);
                    if (!fWritePath.isEmpty()) {
                        // Similar to write() in PictureRenderer.cpp, but just encodes
                        // a bitmap directly.
                        // TODO: Share more common code with write() to do this, to properly
                        // write out the JSON summary, etc.
                        SkString pathWithNumber = SkOSPath::Join(fWritePath.c_str(),
                                                  fInputFilename.c_str());
                        pathWithNumber.remove(pathWithNumber.size() - 4, 4);
                        pathWithNumber.appendf("%i.png", i++);
                        SkBitmap copy;
#if SK_SUPPORT_GPU
                        if (isUsingGpuDevice()) {
                            dst.pixelRef()->readPixels(&copy, &subset);
                        } else {
#endif
                            dst.copyTo(&copy);
#if SK_SUPPORT_GPU
                        }
#endif
                        success &= SkImageEncoder::EncodeFile(pathWithNumber.c_str(), copy,
                                                              SkImageEncoder::kPNG_Type, 100);
                    }
                }
            }
        }
    }
    return success;
}
开发者ID:jagannathanraman,项目名称:skia,代码行数:62,代码来源:CopyTilesRenderer.cpp


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