| 436 | } |
| 437 | |
| 438 | fg_histogram ForgeManager::getHistogram(fg_chart chart, int nBins, |
| 439 | fg_dtype type) { |
| 440 | unsigned long long key = |
| 441 | ((static_cast<unsigned long long>(nBins) & _48BIT) << 16U) | |
| 442 | (type & _16BIT); |
| 443 | |
| 444 | ChartKey keypair = make_pair(key, chart); |
| 445 | auto iter = mHstMap.find(keypair); |
| 446 | |
| 447 | if (iter == mHstMap.end()) { |
| 448 | fg_chart_type chart_type; |
| 449 | FG_CHECK(mPlugin->fg_get_chart_type(&chart_type, chart)); |
| 450 | if (chart_type != FG_CHART_2D) { |
| 451 | AF_ERROR("Histogram can only be added to chart of type FG_CHART_2D", |
| 452 | AF_ERR_TYPE); |
| 453 | } |
| 454 | fg_histogram hst = nullptr; |
| 455 | FG_CHECK(mPlugin->fg_create_histogram(&hst, nBins, type)); |
| 456 | FG_CHECK(mPlugin->fg_append_histogram_to_chart(chart, hst)); |
| 457 | mHstMap[keypair] = HistogramPtr(new Histogram({hst})); |
| 458 | } |
| 459 | return mHstMap[keypair]->handle; |
| 460 | } |
| 461 | |
| 462 | fg_surface ForgeManager::getSurface(fg_chart chart, int nX, int nY, |
| 463 | fg_dtype type) { |