MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / paintGL

Method paintGL

Gui/Histogram.cpp:1149–1231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1147#endif // ifdef NATRON_HISTOGRAM_USING_OPENGL
1148
1149void
1150Histogram::paintGL()
1151{
1152 // always running in the main thread
1153 assert( qApp && qApp->thread() == QThread::currentThread() );
1154 assert( QOpenGLContext::currentContext() == context() );
1155
1156 if ( !appPTR->isOpenGLLoaded() ) {
1157 return;
1158 }
1159
1160
1161 glCheckError();
1162 double w = (double)width();
1163 double h = (double)height();
1164
1165 ///don't bother painting an invisible widget, this may be caused to a splitter collapsed.
1166 if ( (w <= 1) || (h <= 1) ) {
1167 return;
1168 }
1169
1170 {
1171 double screenPixelRatio = getScreenPixelRatio();
1172 if (screenPixelRatio != _imp->_screenPixelRatio) {
1173 _imp->_screenPixelRatio = screenPixelRatio;
1174 _imp->_textFont.reset(new QFont(appFont, appFontSize * screenPixelRatio));
1175 }
1176 }
1177 assert(_imp->_textFont);
1178
1179 assert(_imp->zoomCtx.factor() > 0.);
1180
1181 double zoomLeft = _imp->zoomCtx.left();
1182 double zoomRight = _imp->zoomCtx.right();
1183 double zoomBottom = _imp->zoomCtx.bottom();
1184 double zoomTop = _imp->zoomCtx.top();
1185 if ( (zoomLeft == zoomRight) || (zoomTop == zoomBottom) ) {
1186 glClearColor(0, 0, 0, 1);
1187 glClear(GL_COLOR_BUFFER_BIT);
1188 glCheckErrorIgnoreOSXBug();
1189
1190 return;
1191 }
1192
1193 {
1194 GLProtectAttrib a(GL_TRANSFORM_BIT | GL_COLOR_BUFFER_BIT);
1195 GLProtectMatrix p(GL_PROJECTION);
1196 glLoadIdentity();
1197 glOrtho(zoomLeft, zoomRight, zoomBottom, zoomTop, 1, -1);
1198 GLProtectMatrix m(GL_MODELVIEW);
1199 glLoadIdentity();
1200 glCheckError();
1201
1202 glClearColor(0, 0, 0, 1);
1203 glClear(GL_COLOR_BUFFER_BIT);
1204 glCheckErrorIgnoreOSXBug();
1205
1206 _imp->drawScale();

Callers

nothing calls this directly

Calls 12

isOpenGLLoadedMethod · 0.80
drawHistogramCPUMethod · 0.80
drawPickerMethod · 0.80
drawWarningsMethod · 0.80
drawViewerPickerMethod · 0.80
drawMissingImageMethod · 0.80
resetMethod · 0.45
leftMethod · 0.45
rightMethod · 0.45
bottomMethod · 0.45
topMethod · 0.45
drawScaleMethod · 0.45

Tested by

no test coverage detected