X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=retrace%2Fglretrace_ws.cpp;h=97762eda10edb41a77091b9a3fc81dd8458cf6f8;hb=958d980c85810ed01ad45f8c2af924368dde20f4;hp=ccc70233a73a5b7427148732205f39cff7e51bad;hpb=cb9d2e002ba98b743851db4016dc68ba3ddbd845;p=apitrace diff --git a/retrace/glretrace_ws.cpp b/retrace/glretrace_ws.cpp index ccc7023..97762ed 100644 --- a/retrace/glretrace_ws.cpp +++ b/retrace/glretrace_ws.cpp @@ -188,4 +188,26 @@ updateDrawable(int width, int height) { } +int +parseAttrib(const trace::Value *attribs, int param, int default_ = 0) { + const trace::Array *attribs_ = dynamic_cast(attribs); + + if (attribs_) { + for (size_t i = 0; i + 1 < attribs_->values.size(); i += 2) { + int param_i = attribs_->values[i]->toSInt(); + if (param_i == 0) { + break; + } + + if (param_i == param) { + int value = attribs_->values[i + 1]->toSInt(); + return value; + } + } + } + + return default_; +} + + } /* namespace glretrace */