| 4167 | } |
| 4168 | |
| 4169 | void TextureViewer::ShowPixelHistory(bool failedDebug) |
| 4170 | { |
| 4171 | TextureDescription *texptr = GetCurrentTexture(); |
| 4172 | |
| 4173 | if(!texptr || !m_Output) |
| 4174 | return; |
| 4175 | |
| 4176 | ANALYTIC_SET(UIFeatures.PixelHistory, true); |
| 4177 | |
| 4178 | int x = MipCoordFromBase(m_PickedPoint.x(), texptr->width); |
| 4179 | int y = MipCoordFromBase(m_PickedPoint.y(), texptr->height); |
| 4180 | |
| 4181 | uint32_t mipHeight = qMax(1U, texptr->height >> (int)m_TexDisplay.subresource.mip); |
| 4182 | |
| 4183 | if(m_TexDisplay.flipY) |
| 4184 | y = (int)(mipHeight - 1) - y; |
| 4185 | |
| 4186 | uint32_t view = m_TexDisplay.subresource.slice - m_Following.GetFirstArraySlice(m_Ctx); |
| 4187 | IPixelHistoryView *hist = m_Ctx.ViewPixelHistory(texptr->resourceId, x, y, view, m_TexDisplay); |
| 4188 | |
| 4189 | if(failedDebug) |
| 4190 | hist->SetFailedDebug(); |
| 4191 | |
| 4192 | m_Ctx.AddDockWindow(hist->Widget(), DockReference::TransientPopupArea, this, 0.3f); |
| 4193 | |
| 4194 | // we use this pointer to ensure that the history viewer is still visible (and hasn't been closed) |
| 4195 | // by the time we want to set the results. |
| 4196 | QPointer<QWidget> histWidget = hist->Widget(); |
| 4197 | |
| 4198 | // add a short delay so that controls repainting after a new panel appears can get at the |
| 4199 | // render thread before we insert the long blocking pixel history task |
| 4200 | LambdaThread *thread = new LambdaThread([this, texptr, x, y, hist, histWidget]() { |
| 4201 | QThread::msleep(150); |
| 4202 | m_Ctx.Replay().AsyncInvoke([this, texptr, x, y, hist, histWidget](IReplayController *r) { |
| 4203 | rdcarray<PixelModification> history = |
| 4204 | r->PixelHistory(texptr->resourceId, (uint32_t)x, (int32_t)y, m_TexDisplay.subresource, |
| 4205 | m_TexDisplay.typeCast); |
| 4206 | |
| 4207 | GUIInvoke::call(this, [hist, histWidget, history] { |
| 4208 | if(histWidget) |
| 4209 | hist->SetHistory(history); |
| 4210 | }); |
| 4211 | }); |
| 4212 | }); |
| 4213 | thread->selfDelete(true); |
| 4214 | thread->start(); |
| 4215 | } |
| 4216 | |
| 4217 | void TextureViewer::on_texListShow_clicked() |
| 4218 | { |
nothing calls this directly
no test coverage detected