From 8df98846248a93aa068989a3ebd0d2f0f16e5e69 Mon Sep 17 00:00:00 2001 From: themancalledjakob Date: Sat, 16 Mar 2024 13:18:09 +0100 Subject: [PATCH] explicit std namespace --- example/addons.make | 1 + src/GPUFontAtlasLayerCombo.cpp | 32 ++++++++++++++++---------------- src/GPUFontLayer.cpp | 10 +++++----- src/LayerComposition.cpp | 4 ++-- src/LayerComposition.h | 12 ++++++------ src/MsdfLayer.cpp | 2 +- 6 files changed, 31 insertions(+), 30 deletions(-) diff --git a/example/addons.make b/example/addons.make index 91fa38f..8f1f741 100644 --- a/example/addons.make +++ b/example/addons.make @@ -1,3 +1,4 @@ ofxMsdfgen ofxGPUFont ofxVariableLab +ofxProfiler diff --git a/src/GPUFontAtlasLayerCombo.cpp b/src/GPUFontAtlasLayerCombo.cpp index 0118bee..5ae4959 100644 --- a/src/GPUFontAtlasLayerCombo.cpp +++ b/src/GPUFontAtlasLayerCombo.cpp @@ -251,10 +251,10 @@ void GPUFontAtlasLayerCombo::draw(int width, int height){ float max_x = -FLT_MAX; float max_y = -FLT_MAX; for(const auto & sbb : bbs){ - min_x = min(sbb.p0.x, min_x); - min_y = min(sbb.p0.y, min_y); - max_x = max(sbb.p2.x, max_x); - max_y = max(sbb.p2.y, max_y); + min_x = std::min(sbb.p0.x, min_x); + min_y = std::min(sbb.p0.y, min_y); + max_x = std::max(sbb.p2.x, max_x); + max_y = std::max(sbb.p2.y, max_y); } bb.p0.x = min_x; bb.p0.y = min_y; @@ -369,10 +369,10 @@ void GPUFontAtlasLayerCombo::draw(int width, int height){ float min_y = FLT_MAX; float max_y = -FLT_MAX; for(const auto & mbb : mirror_bbs){ - min_x = min(min_x, min(mbb.p0.x, min(mbb.p1.x, min(mbb.p2.x, mbb.p3.x)))); - max_x = max(max_x, max(mbb.p0.x, max(mbb.p1.x, max(mbb.p2.x, mbb.p3.x)))); - min_y = min(min_y, min(mbb.p0.y, min(mbb.p1.y, min(mbb.p2.y, mbb.p3.y)))); - max_y = max(max_y, max(mbb.p0.y, max(mbb.p1.y, max(mbb.p2.y, mbb.p3.y)))); + min_x = std::min(min_x, std::min(mbb.p0.x, std::min(mbb.p1.x, std::min(mbb.p2.x, mbb.p3.x)))); + max_x = std::max(max_x, std::max(mbb.p0.x, std::max(mbb.p1.x, std::max(mbb.p2.x, mbb.p3.x)))); + min_y = std::min(min_y, std::min(mbb.p0.y, std::min(mbb.p1.y, std::min(mbb.p2.y, mbb.p3.y)))); + max_y = std::max(max_y, std::max(mbb.p0.y, std::max(mbb.p1.y, std::max(mbb.p2.y, mbb.p3.y)))); } float layerWidth = max_x - min_x; float layerHeight = max_y - min_y; @@ -518,10 +518,10 @@ void GPUFontAtlasLayerCombo::draw(int width, float max_x = -FLT_MAX; float max_y = -FLT_MAX; for(const auto & sbb : bbs){ - min_x = min(sbb.p0.x, min_x); - min_y = min(sbb.p0.y, min_y); - max_x = max(sbb.p2.x, max_x); - max_y = max(sbb.p2.y, max_y); + min_x = std::min(sbb.p0.x, min_x); + min_y = std::min(sbb.p0.y, min_y); + max_x = std::max(sbb.p2.x, max_x); + max_y = std::max(sbb.p2.y, max_y); } bb.p0.x = min_x; bb.p0.y = min_y; @@ -635,10 +635,10 @@ void GPUFontAtlasLayerCombo::draw(int width, float min_y = FLT_MAX; float max_y = -FLT_MAX; for(const auto & mbb : mirror_bbs){ - min_x = min(min_x, min(mbb.p0.x, min(mbb.p1.x, min(mbb.p2.x, mbb.p3.x)))); - max_x = max(max_x, max(mbb.p0.x, max(mbb.p1.x, max(mbb.p2.x, mbb.p3.x)))); - min_y = min(min_y, min(mbb.p0.y, min(mbb.p1.y, min(mbb.p2.y, mbb.p3.y)))); - max_y = max(max_y, max(mbb.p0.y, max(mbb.p1.y, max(mbb.p2.y, mbb.p3.y)))); + min_x = std::min(min_x, std::min(mbb.p0.x, std::min(mbb.p1.x, std::min(mbb.p2.x, mbb.p3.x)))); + max_x = std::max(max_x, std::max(mbb.p0.x, std::max(mbb.p1.x, std::max(mbb.p2.x, mbb.p3.x)))); + min_y = std::min(min_y, std::min(mbb.p0.y, std::min(mbb.p1.y, std::min(mbb.p2.y, mbb.p3.y)))); + max_y = std::max(max_y, std::max(mbb.p0.y, std::max(mbb.p1.y, std::max(mbb.p2.y, mbb.p3.y)))); } float layerWidth = max_x - min_x; float layerHeight = max_y - min_y; diff --git a/src/GPUFontLayer.cpp b/src/GPUFontLayer.cpp index 9c876d7..759f95a 100644 --- a/src/GPUFontLayer.cpp +++ b/src/GPUFontLayer.cpp @@ -142,7 +142,7 @@ const Layer::Props & GPUFontLayer::getProps(float i){ if(i != 0 && propsBuffer.size() > 0){ for(const auto & ld : lastProps.letterDelays){ float delay = ld.second; - int index = max(0, min(int(propsBuffer.size() - 1), int(i * delay * settings.letterDelayRatio))); + int index = std::max(0, std::min(int(propsBuffer.size() - 1), int(i * delay * settings.letterDelayRatio))); if(ld.first == "fontSize_px"){ delayProps.fontSize_px = propsBuffer[index].fontSize_px; }else if(ld.first == "letterSpacing"){ @@ -177,10 +177,10 @@ void GPUFontLayer::setBoundingBox(const Layer::BoundingBox & boundingBox){ this->boundingBox = boundingBox; } void GPUFontLayer::setBoundingBox(const ofxGPUFont::Font::BoundingBox & bb){ - float min_x = min(bb.p0.x, min(bb.p1.x, min(bb.p2.x, bb.p3.x))); - float max_x = max(bb.p0.x, max(bb.p1.x, max(bb.p2.x, bb.p3.x))); - float min_y = min(bb.p0.y, min(bb.p1.y, min(bb.p2.y, bb.p3.y))); - float max_y = max(bb.p0.y, max(bb.p1.y, max(bb.p2.y, bb.p3.y))); + float min_x = std::min(bb.p0.x, std::min(bb.p1.x, std::min(bb.p2.x, bb.p3.x))); + float max_x = std::max(bb.p0.x, std::max(bb.p1.x, std::max(bb.p2.x, bb.p3.x))); + float min_y = std::min(bb.p0.y, std::min(bb.p1.y, std::min(bb.p2.y, bb.p3.y))); + float max_y = std::max(bb.p0.y, std::max(bb.p1.y, std::max(bb.p2.y, bb.p3.y))); float width = max_x - min_x; float height = max_y - min_y; setBoundingBox(Layer::BoundingBox{ diff --git a/src/LayerComposition.cpp b/src/LayerComposition.cpp index c87579c..45b8191 100644 --- a/src/LayerComposition.cpp +++ b/src/LayerComposition.cpp @@ -174,7 +174,7 @@ void LayerComposition::removeLayer(const LayerID & id){ Layer::n_layers--; } -const unordered_map > & LayerComposition::getLayers(){ +const std::unordered_map > & LayerComposition::getLayers(){ return layers; } shared_ptr LayerComposition::getLayer(const LayerID & layerID){ @@ -225,7 +225,7 @@ void LayerComposition::drawCamera(const ofCamera & camera) const { } } -const unordered_map > & LayerComposition::getAtlasLayerCombos() const { +const std::unordered_map > & LayerComposition::getAtlasLayerCombos() const { return atlasLayerCombos; } diff --git a/src/LayerComposition.h b/src/LayerComposition.h index d77d269..c6c9271 100644 --- a/src/LayerComposition.h +++ b/src/LayerComposition.h @@ -31,9 +31,9 @@ class LayerComposition { void findOrCreateNewMomForLayer(shared_ptr layer, ComboIdentifier idealMom); void removeLayer(const LayerID & id); // TODO: make bool, to catch nonexisting - const unordered_map > & getLayers(); + const std::unordered_map > & getLayers(); shared_ptr getLayer(const LayerID & layerID); - const unordered_map > & getAtlasLayerCombos() const; + const std::unordered_map > & getAtlasLayerCombos() const; void setVFlip(bool vFlip); void setLayerOrder(const vector & layerOrder); @@ -47,12 +47,12 @@ class LayerComposition { const LayerID getNextFreeLayerID() const; private: VFlipState vFlipState = V_FLIP_UNKNOWN; - unordered_map > layers; - unordered_map > layerIDcombos; - unordered_map > atlasLayerCombos; + std::unordered_map > layers; + std::unordered_map > layerIDcombos; + std::unordered_map > atlasLayerCombos; vector layerOrder; - //unordered_map > layers; + //std::unordered_map > layers; }; } diff --git a/src/MsdfLayer.cpp b/src/MsdfLayer.cpp index d78e5f2..e060b30 100644 --- a/src/MsdfLayer.cpp +++ b/src/MsdfLayer.cpp @@ -452,7 +452,7 @@ void MsdfLayer::setProps(const Props & props){ } const Layer::Props & MsdfLayer::getProps(float delay_seconds){ if(delay_seconds != 0 && propsBuffer.size() > 0){ - int index = max(0, min(int(propsBuffer.size() - 1), int(delay_seconds * settings.letterDelayRatio))); + int index = std::max(0, std::min(int(propsBuffer.size() - 1), int(delay_seconds * settings.letterDelayRatio))); return propsBuffer[index]; // gets newest }else{ return lastProps;