Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Mar 11, 2025
1 parent 1d1ac96 commit 055850b
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 16 deletions.
2 changes: 1 addition & 1 deletion include/mbgl/gfx/dynamic_texture.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class DynamicTexture {
return addImage(image.data ? image.data.get() : nullptr, image.size, id);
}
std::optional<TextureHandle> addImage(const void* pixelData, const Size& imageSize, int32_t id = -1);

void removeTexture(const TextureHandle& texHandle);

private:
Expand Down
10 changes: 6 additions & 4 deletions src/mbgl/gfx/drawable_atlases_tweaker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ void DrawableAtlasesTweaker::setupTextures(gfx::Drawable& drawable, const bool l
assert(*glyphTextureId != *iconTextureId);
drawable.setTexture(atlases ? gfx::Context::getDynamicTextureAlpha()->getTextureAtlas() : nullptr,
*glyphTextureId);
drawable.setTexture(atlases ? gfx::Context::getDynamicTextureRGBA()->getTextureAtlas() : nullptr, *iconTextureId);
drawable.setTexture(atlases ? gfx::Context::getDynamicTextureRGBA()->getTextureAtlas() : nullptr,
*iconTextureId);
} else {
drawable.setTexture(
atlases ? (isText ? gfx::Context::getDynamicTextureAlpha()->getTextureAtlas() : gfx::Context::getDynamicTextureRGBA()->getTextureAtlas()) : nullptr,
*glyphTextureId);
drawable.setTexture(atlases ? (isText ? gfx::Context::getDynamicTextureAlpha()->getTextureAtlas()
: gfx::Context::getDynamicTextureRGBA()->getTextureAtlas())
: nullptr,
*glyphTextureId);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/mbgl/mtl/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Context::~Context() noexcept {
#if !defined(NDEBUG)
Log::Debug(Event::General, "Rendering Stats:\n" + stats.toString("\n"));
#endif
//assert(stats.isZero());
// assert(stats.isZero());
}
}

Expand Down
9 changes: 6 additions & 3 deletions src/mbgl/renderer/image_atlas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

namespace mbgl {

ImagePosition::ImagePosition(const mapbox::Bin& bin, const style::Image::Impl& image, uint32_t version_, std::optional<gfx::TextureHandle> handle_)
ImagePosition::ImagePosition(const mapbox::Bin& bin,
const style::Image::Impl& image,
uint32_t version_,
std::optional<gfx::TextureHandle> handle_)
: handle(handle_),
pixelRatio(image.pixelRatio),
paddedRect(bin.x, bin.y, bin.w, bin.h),
Expand Down Expand Up @@ -56,7 +59,7 @@ ImagePositions uploadIcons(const ImageMap& icons, const ImageVersionMap& version
iconPositions.emplace(image.id, ImagePosition{*iconHandle->getBin(), image, version, iconHandle});
}
}

return iconPositions;
}

Expand All @@ -75,7 +78,7 @@ ImagePositions uploadPatterns(const ImageMap& patterns, const ImageVersionMap& v
patternPositions.emplace(image.id, ImagePosition{*patternHandle->getBin(), image, version, patternHandle});
}
}

return patternPositions;
}

Expand Down
5 changes: 4 additions & 1 deletion src/mbgl/renderer/image_atlas.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ class ImageManager;

class ImagePosition {
public:
ImagePosition(const mapbox::Bin&, const style::Image::Impl&, uint32_t version = 0, std::optional<gfx::TextureHandle> handle = std::nullopt);
ImagePosition(const mapbox::Bin&,
const style::Image::Impl&,
uint32_t version = 0,
std::optional<gfx::TextureHandle> handle = std::nullopt);

static constexpr const uint16_t padding = 1u;
std::optional<gfx::TextureHandle> handle;
Expand Down
7 changes: 4 additions & 3 deletions src/mbgl/tile/geometry_tile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,10 @@ void GeometryTileRenderData::upload(gfx::UploadPass& uploadPass) {
if (!imagePatches.empty()) {
for (const auto& imagePatch : imagePatches) { // patch updated images.
#if MLN_DRAWABLE_RENDERER
gfx::Context::getDynamicTextureRGBA()->getTextureAtlas()->uploadSubRegion(imagePatch.image->image,
imagePatch.paddedRect.x + ImagePosition::padding,
imagePatch.paddedRect.y + ImagePosition::padding);
gfx::Context::getDynamicTextureRGBA()->getTextureAtlas()->uploadSubRegion(
imagePatch.image->image,
imagePatch.paddedRect.x + ImagePosition::padding,
imagePatch.paddedRect.y + ImagePosition::padding);
#else
uploadPass.updateTextureSub(*atlasTextures->icon,
imagePatch.image->image,
Expand Down
10 changes: 7 additions & 3 deletions src/mbgl/tile/geometry_tile_worker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,8 @@ void GeometryTileWorker::finalizeLayout() {
}

// layout adds the bucket to buckets
layout->createBucket(patternPositions, featureIndex, renderData, firstLoad, showCollisionBoxes, id.canonical);
layout->createBucket(
patternPositions, featureIndex, renderData, firstLoad, showCollisionBoxes, id.canonical);
}
}

Expand All @@ -530,8 +531,11 @@ void GeometryTileWorker::finalizeLayout() {
<< id.canonical.y << " Time");

parent.invoke(&GeometryTile::onLayout,
std::make_shared<GeometryTile::LayoutResult>(
std::move(renderData), std::move(featureIndex), std::move(glyphPositions), std::move(iconPositions), std::move(patternPositions)),
std::make_shared<GeometryTile::LayoutResult>(std::move(renderData),
std::move(featureIndex),
std::move(glyphPositions),
std::move(iconPositions),
std::move(patternPositions)),
correlationID);
}

Expand Down

0 comments on commit 055850b

Please sign in to comment.