MCPcopy Index your code
hub / github.com/DreamSourceLab/DSView / index2pixel

Method index2pixel

DSView/pv/view/view.cpp:1416–1444  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1414}
1415
1416double View::index2pixel(uint64_t index, bool has_hoff)
1417{
1418 const uint64_t rateValue = session().cur_snap_samplerate();
1419 const double scaleValue = scale();
1420 const int64_t offsetValue = offset();
1421 const double hoffValue = trig_hoff();
1422
1423 double pixels = 0;
1424
1425 const double samples_per_pixel = rateValue * scaleValue;
1426
1427 if (has_hoff){
1428 pixels = index / samples_per_pixel - offsetValue + hoffValue / samples_per_pixel;
1429 }
1430 else{
1431 pixels = index / samples_per_pixel - offsetValue;
1432 }
1433
1434 /*
1435 const double samples_per_pixel = session().cur_snap_samplerate() * scale();
1436 double pixels;
1437 if (has_hoff)
1438 pixels = index/samples_per_pixel - offset() + trig_hoff()/samples_per_pixel;
1439 else
1440 pixels = index/samples_per_pixel - offset();
1441 */
1442
1443 return pixels;
1444}
1445
1446uint64_t View::pixel2index(double pixel)
1447{

Callers 12

paintMethod · 0.80
get_pointMethod · 0.80
get_pointMethod · 0.80
get_label_rectMethod · 0.80
paintCursorsMethod · 0.80
paintSignalsMethod · 0.80
mousePressEventMethod · 0.80
mouseMoveEventMethod · 0.80
onLogicMouseReleaseMethod · 0.80
mouseDoubleClickEventMethod · 0.80
measureMethod · 0.80
paintMeasureMethod · 0.80

Calls 1

cur_snap_samplerateMethod · 0.80

Tested by

no test coverage detected