| 1147 | #endif // ifdef NATRON_HISTOGRAM_USING_OPENGL |
| 1148 | |
| 1149 | void |
| 1150 | Histogram::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(); |
nothing calls this directly
no test coverage detected