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


C++ TransformState::getPixelRatio方法代码示例

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


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

示例1: update

void Style::update(MapData& data,
                   const TransformState& transform,
                   TexturePool& texturePool) {
    const float pixelRatio = transform.getPixelRatio();
    if (!sprite || !sprite->hasPixelRatio(pixelRatio)) {
        sprite = std::make_unique<Sprite>(spriteURL, pixelRatio);
        sprite->setObserver(this);

        spriteAtlas->resize(pixelRatio);
        spriteAtlas->setSprite(sprite);
    }

    bool allTilesUpdated = true;
    for (const auto& source : sources) {
        if (!source->update(data, transform, *this, *glyphAtlas, *glyphStore,
                       *spriteAtlas, sprite, texturePool, shouldReparsePartialTiles)) {
            allTilesUpdated = false;
        }
    }

    // We can only stop updating "partial" tiles when all of them
    // were notified of the arrival of the new resources.
    if (allTilesUpdated) {
        shouldReparsePartialTiles = false;
    }
}
开发者ID:kod3r,项目名称:mapbox-gl-native,代码行数:26,代码来源:style.cpp

示例2: prepare

void Map::prepare() {
    view.make_active();

    // Update transform transitions.
    animationTime = util::now();
    if (transform.needsTransition()) {
        transform.updateTransitions(animationTime);
    }

    const TransformState oldState = state;
    state = transform.currentState();

    bool pixelRatioChanged = oldState.getPixelRatio() != state.getPixelRatio();
    bool dimensionsChanged = oldState.getFramebufferWidth() != state.getFramebufferWidth() ||
                             oldState.getFramebufferHeight() != state.getFramebufferHeight();

    if (pixelRatioChanged) {
        style->sprite = std::make_shared<Sprite>(*this, state.getPixelRatio());
        style->sprite->load(kSpriteURL);

        spriteAtlas->resize(state.getPixelRatio());
    }

    if (pixelRatioChanged || dimensionsChanged) {
        painter.clearFramebuffers();
    }

    style->cascade(state.getNormalizedZoom());

    // Update style transitions.
    animationTime = util::now();
    if (style->needsTransition()) {
        style->updateTransitions(animationTime);
        update();
    }

    // Allow the sprite atlas to potentially pull new sprite images if needed.
    if (style->sprite && style->sprite->isLoaded()) {
        spriteAtlas->update(*style->sprite);
    }

    updateTiles();
}
开发者ID:FlavioFalcao,项目名称:mapbox-gl-native,代码行数:43,代码来源:map.cpp

示例3: update

void ResourceLoader::update(MapData& data,
                            const TransformState& transform,
                            GlyphAtlas& glyphAtlas,
                            GlyphStore& glyphStore,
                            SpriteAtlas& spriteAtlas,
                            TexturePool& texturePool) {
    if (!style_) {
        return;
    }

    const float pixelRatio = transform.getPixelRatio();
    if (!sprite_ || !sprite_->hasPixelRatio(pixelRatio)) {
        sprite_ = util::make_unique<Sprite>(style_->getSpriteURL(), pixelRatio);
        sprite_->setObserver(this);

        spriteAtlas.resize(pixelRatio);
        spriteAtlas.setSprite(sprite_);
    }

    for (const auto& source : style_->sources) {
        source->update(
            data, transform, *style_, glyphAtlas, glyphStore, spriteAtlas, sprite_, texturePool);
    }
}
开发者ID:Dyziorek,项目名称:mapbox-gl-native,代码行数:24,代码来源:resource_loader.cpp

示例4: getZoom

double Source::getZoom(const TransformState& state) const {
    double offset = std::log(util::tileSize / info.tile_size) / std::log(2);
    offset += (state.getPixelRatio() > 1.0 ? 1 :0);
    return state.getZoom() + offset;
}
开发者ID:ariosx,项目名称:mapbox-gl-native,代码行数:5,代码来源:source.cpp


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