diff --git a/src/GPUFontAtlasLayerCombo.cpp b/src/GPUFontAtlasLayerCombo.cpp index 1bb6286..1285df1 100644 --- a/src/GPUFontAtlasLayerCombo.cpp +++ b/src/GPUFontAtlasLayerCombo.cpp @@ -51,6 +51,7 @@ void GPUFontAtlasLayerCombo::setup(const ComboIdentifier & identifier, cout << "Render type " << r->getType() << endl; } void GPUFontAtlasLayerCombo::update(){ + OFX_PROFILER_FUNCTION(); for(const auto & layer : layers){ layer->update(); if(layer->isDirtyDirty()){ @@ -133,6 +134,7 @@ const vector > & GPUFontAtlasLayerCombo::getLayers(){ return layers; } void GPUFontAtlasLayerCombo::draw(){ + OFX_PROFILER_FUNCTION(); GLuint location; int width = ofGetWidth(); @@ -159,6 +161,7 @@ void GPUFontAtlasLayerCombo::draw(){ float superLineHeight = 0; if(font){ + OFX_PROFILER_SCOPE("draw font"); fontShaderProgram = fontShader->program; glUseProgram(fontShaderProgram); @@ -192,6 +195,7 @@ void GPUFontAtlasLayerCombo::draw(){ std::vector outerBoundingBoxes; for(const auto & layer : layers){ + OFX_PROFILER_SCOPE("draw layer"); float lineHeight = font->getLineHeight(layer->getProps().fontSize_px); float ascender = font->getAscender(layer->getProps().fontSize_px); superLineHeight = lineHeight; diff --git a/src/GPUFontAtlasLayerCombo.h b/src/GPUFontAtlasLayerCombo.h index 71b37ac..df9701e 100644 --- a/src/GPUFontAtlasLayerCombo.h +++ b/src/GPUFontAtlasLayerCombo.h @@ -4,6 +4,7 @@ #include "ofMain.h" #include "AtlasLayerCombo.h" #include "GPUFontLayer.h" +#include "ofxProfiler.h" #ifdef TARGET_EMSCRIPTEN #include #include diff --git a/src/GPUFontLayer.cpp b/src/GPUFontLayer.cpp index 102e572..79fd3bb 100644 --- a/src/GPUFontLayer.cpp +++ b/src/GPUFontLayer.cpp @@ -65,13 +65,16 @@ void GPUFontLayer::setMomsComboIdentifier(const ComboIdentifier & identifier){ } void GPUFontLayer::setProps(const Props & props){ + OFX_PROFILER_FUNCTION(); if(propsBuffer.size() == 0 || props.text != propsBuffer[0].text || propsBuffer[0].fontVariations != props.fontVariations){ + OFX_PROFILER_SCOPE("variations"); setDirtyDirty(true); variationText.clear(); variationText.resize(props.text.size()); int i = 0; for(const char c : props.text){ + OFX_PROFILER_SCOPE("char"); ofxGPUFont::GlyphIdentity glyphIdentity; glyphIdentity.charcode = ofxGPUFont::decodeCharcode(&c); const Props & vProps = getProps(i * props.letterDelay); diff --git a/src/GPUFontLayer.h b/src/GPUFontLayer.h index 6121f14..57dbf63 100644 --- a/src/GPUFontLayer.h +++ b/src/GPUFontLayer.h @@ -1,5 +1,6 @@ #pragma once +#include "ofxProfiler.h" #include "AtlasLayerCombo.h" #include "font.hpp" #include "ofMain.h"