explicit std namespace

This commit is contained in:
themancalledjakob 2024-03-16 13:18:09 +01:00
parent 1910815c2a
commit 8df9884624
6 changed files with 31 additions and 30 deletions

View file

@ -1,3 +1,4 @@
ofxMsdfgen
ofxGPUFont
ofxVariableLab
ofxProfiler

View file

@ -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;

View file

@ -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{

View file

@ -174,7 +174,7 @@ void LayerComposition::removeLayer(const LayerID & id){
Layer::n_layers--;
}
const unordered_map <LayerID, shared_ptr <Layer> > & LayerComposition::getLayers(){
const std::unordered_map <LayerID, shared_ptr <Layer> > & LayerComposition::getLayers(){
return layers;
}
shared_ptr <Layer> LayerComposition::getLayer(const LayerID & layerID){
@ -225,7 +225,7 @@ void LayerComposition::drawCamera(const ofCamera & camera) const {
}
}
const unordered_map <ComboIdentifier, shared_ptr <AtlasLayerCombo> > & LayerComposition::getAtlasLayerCombos() const {
const std::unordered_map <ComboIdentifier, shared_ptr <AtlasLayerCombo> > & LayerComposition::getAtlasLayerCombos() const {
return atlasLayerCombos;
}

View file

@ -31,9 +31,9 @@ class LayerComposition {
void findOrCreateNewMomForLayer(shared_ptr <Layer> layer,
ComboIdentifier idealMom);
void removeLayer(const LayerID & id); // TODO: make bool, to catch nonexisting
const unordered_map <LayerID, shared_ptr <Layer> > & getLayers();
const std::unordered_map <LayerID, shared_ptr <Layer> > & getLayers();
shared_ptr <Layer> getLayer(const LayerID & layerID);
const unordered_map <ComboIdentifier, shared_ptr <AtlasLayerCombo> > & getAtlasLayerCombos() const;
const std::unordered_map <ComboIdentifier, shared_ptr <AtlasLayerCombo> > & getAtlasLayerCombos() const;
void setVFlip(bool vFlip);
void setLayerOrder(const vector <LayerID> & layerOrder);
@ -47,12 +47,12 @@ class LayerComposition {
const LayerID getNextFreeLayerID() const;
private:
VFlipState vFlipState = V_FLIP_UNKNOWN;
unordered_map <LayerID, shared_ptr <Layer> > layers;
unordered_map <LayerID, shared_ptr <AtlasLayerCombo> > layerIDcombos;
unordered_map <ComboIdentifier, shared_ptr <AtlasLayerCombo> > atlasLayerCombos;
std::unordered_map <LayerID, shared_ptr <Layer> > layers;
std::unordered_map <LayerID, shared_ptr <AtlasLayerCombo> > layerIDcombos;
std::unordered_map <ComboIdentifier, shared_ptr <AtlasLayerCombo> > atlasLayerCombos;
vector <LayerID> layerOrder;
//unordered_map <LayerIdentifier, shared_ptr <ofxVariableLab::Layer> > layers;
//std::unordered_map <LayerIdentifier, std::shared_ptr <ofxVariableLab::Layer> > layers;
};
}

View file

@ -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;