PStats should use doubles consistently
This commit is contained in:
parent
be85a6ada1
commit
cb9b0f075d
|
|
@ -51,7 +51,7 @@ get_client_name() const {
|
|||
// thread.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void PStatClient::
|
||||
set_max_rate(PN_stdfloat rate) {
|
||||
set_max_rate(double rate) {
|
||||
get_impl()->set_max_rate(rate);
|
||||
}
|
||||
|
||||
|
|
@ -62,7 +62,7 @@ set_max_rate(PN_stdfloat rate) {
|
|||
// sent to the server per second, per thread. See
|
||||
// set_max_rate().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE PN_stdfloat PStatClient::
|
||||
INLINE double PStatClient::
|
||||
get_max_rate() const {
|
||||
return get_impl()->get_max_rate();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -744,7 +744,7 @@ start(int collector_index, int thread_index) {
|
|||
// instead, call PStatCollector::start().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void PStatClient::
|
||||
start(int collector_index, int thread_index, PN_stdfloat as_of) {
|
||||
start(int collector_index, int thread_index, double as_of) {
|
||||
#ifdef _DEBUG
|
||||
nassertv(collector_index >= 0 && collector_index < AtomicAdjust::get(_num_collectors));
|
||||
nassertv(thread_index >= 0 && thread_index < AtomicAdjust::get(_num_threads));
|
||||
|
|
@ -815,7 +815,7 @@ stop(int collector_index, int thread_index) {
|
|||
// instead, call PStatCollector::stop().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void PStatClient::
|
||||
stop(int collector_index, int thread_index, PN_stdfloat as_of) {
|
||||
stop(int collector_index, int thread_index, double as_of) {
|
||||
#ifdef _DEBUG
|
||||
nassertv(collector_index >= 0 && collector_index < AtomicAdjust::get(_num_collectors));
|
||||
nassertv(thread_index >= 0 && thread_index < AtomicAdjust::get(_num_threads));
|
||||
|
|
|
|||
|
|
@ -62,8 +62,8 @@ public:
|
|||
PUBLISHED:
|
||||
INLINE void set_client_name(const string &name);
|
||||
INLINE string get_client_name() const;
|
||||
INLINE void set_max_rate(PN_stdfloat rate);
|
||||
INLINE PN_stdfloat get_max_rate() const;
|
||||
INLINE void set_max_rate(double rate);
|
||||
INLINE double get_max_rate() const;
|
||||
|
||||
INLINE int get_num_collectors() const;
|
||||
PStatCollector get_collector(int index) const;
|
||||
|
|
@ -118,9 +118,9 @@ private:
|
|||
bool is_started(int collector_index, int thread_index) const;
|
||||
|
||||
void start(int collector_index, int thread_index);
|
||||
void start(int collector_index, int thread_index, PN_stdfloat as_of);
|
||||
void start(int collector_index, int thread_index, double as_of);
|
||||
void stop(int collector_index, int thread_index);
|
||||
void stop(int collector_index, int thread_index, PN_stdfloat as_of);
|
||||
void stop(int collector_index, int thread_index, double as_of);
|
||||
|
||||
void clear_level(int collector_index, int thread_index);
|
||||
void set_level(int collector_index, int thread_index, double level);
|
||||
|
|
@ -208,7 +208,7 @@ private:
|
|||
PStatFrameData _frame_data;
|
||||
bool _is_active;
|
||||
int _frame_number;
|
||||
PN_stdfloat _next_packet;
|
||||
double _next_packet;
|
||||
|
||||
bool _thread_active;
|
||||
BitArray _active_collectors; // no longer used.
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ get_client_name() const {
|
|||
// thread.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void PStatClientImpl::
|
||||
set_max_rate(PN_stdfloat rate) {
|
||||
set_max_rate(double rate) {
|
||||
_max_rate = rate;
|
||||
}
|
||||
|
||||
|
|
@ -62,7 +62,7 @@ set_max_rate(PN_stdfloat rate) {
|
|||
// sent to the server per second, per thread. See
|
||||
// set_max_rate().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE PN_stdfloat PStatClientImpl::
|
||||
INLINE double PStatClientImpl::
|
||||
get_max_rate() const {
|
||||
return _max_rate;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ new_frame(int thread_index) {
|
|||
return;
|
||||
}
|
||||
|
||||
PN_stdfloat frame_start = get_real_time();
|
||||
double frame_start = get_real_time();
|
||||
int frame_number = -1;
|
||||
PStatFrameData frame_data;
|
||||
|
||||
|
|
@ -245,11 +245,11 @@ transmit_frame_data(int thread_index, int frame_number,
|
|||
// server. Check that enough time has elapsed for us to send a
|
||||
// new packet. If not, we'll drop this packet on the floor and
|
||||
// send a new one next time around.
|
||||
PN_stdfloat now = get_real_time();
|
||||
double now = get_real_time();
|
||||
if (now >= thread->_next_packet) {
|
||||
// We don't want to send more than _max_rate UDP-size packets
|
||||
// per second, per thread.
|
||||
PN_stdfloat packet_delay = 1.0 / _max_rate;
|
||||
double packet_delay = 1.0 / _max_rate;
|
||||
|
||||
// Send new data.
|
||||
NetDatagram datagram;
|
||||
|
|
@ -299,7 +299,7 @@ transmit_frame_data(int thread_index, int frame_number,
|
|||
int packet_ratio =
|
||||
(datagram.get_length() + maximum_udp_datagram - 1) /
|
||||
maximum_udp_datagram;
|
||||
packet_delay *= (PN_stdfloat)packet_ratio;
|
||||
packet_delay *= (double)packet_ratio;
|
||||
}
|
||||
|
||||
thread->_next_packet = now + packet_delay;
|
||||
|
|
|
|||
|
|
@ -59,8 +59,8 @@ public:
|
|||
|
||||
INLINE void set_client_name(const string &name);
|
||||
INLINE string get_client_name() const;
|
||||
INLINE void set_max_rate(PN_stdfloat rate);
|
||||
INLINE PN_stdfloat get_max_rate() const;
|
||||
INLINE void set_max_rate(double rate);
|
||||
INLINE double get_max_rate() const;
|
||||
|
||||
INLINE double get_real_time() const;
|
||||
|
||||
|
|
@ -110,10 +110,10 @@ private:
|
|||
|
||||
string _hostname;
|
||||
string _client_name;
|
||||
PN_stdfloat _max_rate;
|
||||
double _max_rate;
|
||||
|
||||
PN_stdfloat _tcp_count_factor;
|
||||
PN_stdfloat _udp_count_factor;
|
||||
double _tcp_count_factor;
|
||||
double _udp_count_factor;
|
||||
unsigned int _tcp_count;
|
||||
unsigned int _udp_count;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -485,7 +485,7 @@ start(const PStatThread &thread) {
|
|||
// a monotonically increasing series of time values.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void PStatCollector::
|
||||
start(const PStatThread &thread, PN_stdfloat as_of) {
|
||||
start(const PStatThread &thread, double as_of) {
|
||||
_client->start(_index, thread._index, as_of);
|
||||
}
|
||||
|
||||
|
|
@ -509,7 +509,7 @@ stop(const PStatThread &thread) {
|
|||
// a monotonically increasing series of time values.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void PStatCollector::
|
||||
stop(const PStatThread &thread, PN_stdfloat as_of) {
|
||||
stop(const PStatThread &thread, double as_of) {
|
||||
_client->stop(_index, thread._index, as_of);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -92,9 +92,9 @@ PUBLISHED:
|
|||
INLINE bool is_active(const PStatThread &thread);
|
||||
INLINE bool is_started(const PStatThread &thread);
|
||||
INLINE void start(const PStatThread &thread);
|
||||
INLINE void start(const PStatThread &thread, PN_stdfloat as_of);
|
||||
INLINE void start(const PStatThread &thread, double as_of);
|
||||
INLINE void stop(const PStatThread &thread);
|
||||
INLINE void stop(const PStatThread &thread, PN_stdfloat as_of);
|
||||
INLINE void stop(const PStatThread &thread, double as_of);
|
||||
|
||||
INLINE void clear_level(const PStatThread &thread);
|
||||
INLINE void set_level(const PStatThread &thread, double level);
|
||||
|
|
@ -137,9 +137,9 @@ PUBLISHED:
|
|||
|
||||
INLINE bool is_active(const PStatThread &) { return false; }
|
||||
INLINE void start(const PStatThread &) { }
|
||||
INLINE void start(const PStatThread &, PN_stdfloat) { }
|
||||
INLINE void start(const PStatThread &, double) { }
|
||||
INLINE void stop(const PStatThread &) { }
|
||||
INLINE void stop(const PStatThread &, PN_stdfloat) { }
|
||||
INLINE void stop(const PStatThread &, double) { }
|
||||
|
||||
INLINE void clear_level(const PStatThread &) { }
|
||||
INLINE void set_level(const PStatThread &, double) { }
|
||||
|
|
|
|||
|
|
@ -87,13 +87,13 @@ write_datagram(Datagram &destination) const {
|
|||
destination.add_int16(_index);
|
||||
destination.add_string(_name);
|
||||
destination.add_int16(_parent_index);
|
||||
destination.add_stdfloat(_suggested_color.r);
|
||||
destination.add_stdfloat(_suggested_color.g);
|
||||
destination.add_stdfloat(_suggested_color.b);
|
||||
destination.add_float32(_suggested_color.r);
|
||||
destination.add_float32(_suggested_color.g);
|
||||
destination.add_float32(_suggested_color.b);
|
||||
destination.add_int16(_sort);
|
||||
destination.add_string(_level_units);
|
||||
destination.add_stdfloat(_suggested_scale);
|
||||
destination.add_stdfloat(_factor);
|
||||
destination.add_float32(_suggested_scale);
|
||||
destination.add_float32(_factor);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -106,11 +106,11 @@ read_datagram(DatagramIterator &source, PStatClientVersion *) {
|
|||
_index = source.get_int16();
|
||||
_name = source.get_string();
|
||||
_parent_index = source.get_int16();
|
||||
_suggested_color.r = source.get_stdfloat();
|
||||
_suggested_color.g = source.get_stdfloat();
|
||||
_suggested_color.b = source.get_stdfloat();
|
||||
_suggested_color.r = source.get_float32();
|
||||
_suggested_color.g = source.get_float32();
|
||||
_suggested_color.b = source.get_float32();
|
||||
_sort = source.get_int16();
|
||||
_level_units = source.get_string();
|
||||
_suggested_scale = source.get_stdfloat();
|
||||
_factor = source.get_stdfloat();
|
||||
_suggested_scale = source.get_float32();
|
||||
_factor = source.get_float32();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public:
|
|||
void read_datagram(DatagramIterator &source, PStatClientVersion *version);
|
||||
|
||||
struct ColorDef {
|
||||
PN_stdfloat r, g, b;
|
||||
float r, g, b;
|
||||
};
|
||||
|
||||
int _index;
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ swap(PStatFrameData &other) {
|
|||
// data.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void PStatFrameData::
|
||||
add_start(int index, PN_stdfloat time) {
|
||||
add_start(int index, double time) {
|
||||
#ifdef _DEBUG
|
||||
nassertv((index & 0x7fff) == index);
|
||||
#endif
|
||||
|
|
@ -94,7 +94,7 @@ add_start(int index, PN_stdfloat time) {
|
|||
// data.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void PStatFrameData::
|
||||
add_stop(int index, PN_stdfloat time) {
|
||||
add_stop(int index, double time) {
|
||||
#ifdef _DEBUG
|
||||
nassertv((index & 0x7fff) == index);
|
||||
#endif
|
||||
|
|
@ -111,7 +111,7 @@ add_stop(int index, PN_stdfloat time) {
|
|||
// collector to the frame data.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void PStatFrameData::
|
||||
add_level(int index, PN_stdfloat level) {
|
||||
add_level(int index, double level) {
|
||||
#ifdef _DEBUG
|
||||
nassertv((index & 0xffff) == index);
|
||||
#endif
|
||||
|
|
@ -128,7 +128,7 @@ add_level(int index, PN_stdfloat level) {
|
|||
// data. This will generally be the time of the start
|
||||
// of the frame.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE PN_stdfloat PStatFrameData::
|
||||
INLINE double PStatFrameData::
|
||||
get_start() const {
|
||||
if (is_empty()) {
|
||||
return 0.0;
|
||||
|
|
@ -144,7 +144,7 @@ get_start() const {
|
|||
// data. This will generally be the time of the end
|
||||
// of the frame.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE PN_stdfloat PStatFrameData::
|
||||
INLINE double PStatFrameData::
|
||||
get_end() const {
|
||||
nassertr(!is_empty(), 0.0);
|
||||
|
||||
|
|
@ -156,7 +156,7 @@ get_end() const {
|
|||
// Access: Public
|
||||
// Description: Returns the total time elapsed for the frame.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE PN_stdfloat PStatFrameData::
|
||||
INLINE double PStatFrameData::
|
||||
get_net_time() const {
|
||||
nassertr(!is_empty(), 0.0);
|
||||
|
||||
|
|
@ -206,7 +206,7 @@ is_start(int n) const {
|
|||
// guaranteed to be shared among all events returned
|
||||
// from a given client).
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE PN_stdfloat PStatFrameData::
|
||||
INLINE double PStatFrameData::
|
||||
get_time(int n) const {
|
||||
nassertr(n >= 0 && n < (int)_time_data.size(), 0);
|
||||
return _time_data[n]._value;
|
||||
|
|
@ -240,7 +240,7 @@ get_level_collector(int n) const {
|
|||
// Access: Public
|
||||
// Description: Returns the height of the nth level value.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE PN_stdfloat PStatFrameData::
|
||||
INLINE double PStatFrameData::
|
||||
get_level(int n) const {
|
||||
nassertr(n >= 0 && n < (int)_level_data.size(), 0);
|
||||
return _level_data[n]._value;
|
||||
|
|
|
|||
|
|
@ -52,12 +52,12 @@ write_datagram(Datagram &destination, PStatClient *client) const {
|
|||
destination.add_uint16(_time_data.size());
|
||||
for (di = _time_data.begin(); di != _time_data.end(); ++di) {
|
||||
destination.add_uint16((*di)._index);
|
||||
destination.add_stdfloat((*di)._value);
|
||||
destination.add_float32((*di)._value);
|
||||
}
|
||||
destination.add_uint16(_level_data.size());
|
||||
for (di = _level_data.begin(); di != _level_data.end(); ++di) {
|
||||
destination.add_uint16((*di)._index);
|
||||
destination.add_stdfloat((*di)._value);
|
||||
destination.add_float32((*di)._value);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -78,7 +78,7 @@ read_datagram(DatagramIterator &source, PStatClientVersion *) {
|
|||
nassertv(source.get_remaining_size() > 0);
|
||||
DataPoint dp;
|
||||
dp._index = source.get_uint16();
|
||||
dp._value = source.get_stdfloat();
|
||||
dp._value = source.get_float32();
|
||||
_time_data.push_back(dp);
|
||||
}
|
||||
int level_size = source.get_uint16();
|
||||
|
|
@ -86,7 +86,7 @@ read_datagram(DatagramIterator &source, PStatClientVersion *) {
|
|||
nassertv(source.get_remaining_size() > 0);
|
||||
DataPoint dp;
|
||||
dp._index = source.get_uint16();
|
||||
dp._value = source.get_stdfloat();
|
||||
dp._value = source.get_float32();
|
||||
_level_data.push_back(dp);
|
||||
}
|
||||
nassertv(source.get_remaining_size() == 0);
|
||||
|
|
|
|||
|
|
@ -41,24 +41,24 @@ public:
|
|||
INLINE void clear();
|
||||
INLINE void swap(PStatFrameData &other);
|
||||
|
||||
INLINE void add_start(int index, PN_stdfloat time);
|
||||
INLINE void add_stop(int index, PN_stdfloat time);
|
||||
INLINE void add_level(int index, PN_stdfloat level);
|
||||
INLINE void add_start(int index, double time);
|
||||
INLINE void add_stop(int index, double time);
|
||||
INLINE void add_level(int index, double level);
|
||||
|
||||
void sort_time();
|
||||
|
||||
INLINE PN_stdfloat get_start() const;
|
||||
INLINE PN_stdfloat get_end() const;
|
||||
INLINE PN_stdfloat get_net_time() const;
|
||||
INLINE double get_start() const;
|
||||
INLINE double get_end() const;
|
||||
INLINE double get_net_time() const;
|
||||
|
||||
INLINE int get_num_events() const;
|
||||
INLINE int get_time_collector(int n) const;
|
||||
INLINE bool is_start(int n) const;
|
||||
INLINE PN_stdfloat get_time(int n) const;
|
||||
INLINE double get_time(int n) const;
|
||||
|
||||
INLINE int get_num_levels() const;
|
||||
INLINE int get_level_collector(int n) const;
|
||||
INLINE PN_stdfloat get_level(int n) const;
|
||||
INLINE double get_level(int n) const;
|
||||
|
||||
bool write_datagram(Datagram &destination, PStatClient *client) const;
|
||||
void read_datagram(DatagramIterator &source, PStatClientVersion *version);
|
||||
|
|
@ -69,7 +69,7 @@ private:
|
|||
INLINE bool operator < (const DataPoint &other) const;
|
||||
|
||||
int _index;
|
||||
PN_stdfloat _value;
|
||||
double _value;
|
||||
};
|
||||
typedef pvector<DataPoint> Data;
|
||||
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ struct TimeCollectorProperties {
|
|||
bool is_active;
|
||||
const char *name;
|
||||
ColorDef color;
|
||||
PN_stdfloat suggested_scale;
|
||||
double suggested_scale;
|
||||
};
|
||||
|
||||
struct LevelCollectorProperties {
|
||||
|
|
@ -98,8 +98,8 @@ struct LevelCollectorProperties {
|
|||
const char *name;
|
||||
ColorDef color;
|
||||
const char *units;
|
||||
PN_stdfloat suggested_scale;
|
||||
PN_stdfloat inv_factor;
|
||||
double suggested_scale;
|
||||
double inv_factor;
|
||||
};
|
||||
|
||||
static TimeCollectorProperties time_properties[] = {
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ void signal_handler(int) {
|
|||
|
||||
struct SampleData {
|
||||
const char *category;
|
||||
PN_stdfloat min_ms;
|
||||
PN_stdfloat max_ms;
|
||||
double min_ms;
|
||||
double max_ms;
|
||||
bool is_level;
|
||||
};
|
||||
|
||||
|
|
@ -75,7 +75,7 @@ SampleData *datasets[NUM_DATASETS] = {
|
|||
|
||||
class WaitRequest {
|
||||
public:
|
||||
PN_stdfloat _time;
|
||||
double _time;
|
||||
int _index;
|
||||
bool _start;
|
||||
|
||||
|
|
@ -121,7 +121,7 @@ main(int argc, char *argv[]) {
|
|||
ds_index = atoi(argv[3]);
|
||||
} else {
|
||||
// Pick a random Dataset.
|
||||
ds_index = (int)((PN_stdfloat)NUM_DATASETS * rand() / (RAND_MAX + 1.0));
|
||||
ds_index = (int)((double)NUM_DATASETS * rand() / (RAND_MAX + 1.0));
|
||||
}
|
||||
if (ds_index < 0 || ds_index >= NUM_DATASETS) {
|
||||
nout << "Invalid dataset; choose a number in the range 0 to "
|
||||
|
|
@ -144,9 +144,9 @@ main(int argc, char *argv[]) {
|
|||
while (!user_interrupted && client->is_connected()) {
|
||||
PStatClient::main_tick();
|
||||
|
||||
PN_stdfloat total_ms = 0.0;
|
||||
PN_stdfloat now = client->get_real_time();
|
||||
PN_stdfloat start = now;
|
||||
double total_ms = 0.0;
|
||||
double now = client->get_real_time();
|
||||
double start = now;
|
||||
|
||||
typedef pvector<WaitRequest> Wait;
|
||||
Wait wait;
|
||||
|
|
@ -155,12 +155,12 @@ main(int argc, char *argv[]) {
|
|||
for (i = 0; i < (int)_collectors.size(); i++) {
|
||||
if (ds[i].is_level) {
|
||||
// Make up an amount to add/delete to the level this frame.
|
||||
PN_stdfloat increment = ds[i].max_ms * (rand() / (RAND_MAX + 1.0) - 0.5);
|
||||
double increment = ds[i].max_ms * (rand() / (RAND_MAX + 1.0) - 0.5);
|
||||
_collectors[i].add_level(increment);
|
||||
|
||||
} else {
|
||||
// A bit of random jitter so the collectors might overlap some.
|
||||
PN_stdfloat jitter_ms = (5.0 * rand() / (RAND_MAX + 1.0));
|
||||
double jitter_ms = (5.0 * rand() / (RAND_MAX + 1.0));
|
||||
|
||||
WaitRequest wr;
|
||||
wr._time = now + jitter_ms / 1000.0;
|
||||
|
|
@ -168,8 +168,8 @@ main(int argc, char *argv[]) {
|
|||
wr._start = true;
|
||||
wait.push_back(wr);
|
||||
|
||||
PN_stdfloat ms_range = ds[i].max_ms - ds[i].min_ms;
|
||||
PN_stdfloat ms = (PN_stdfloat)ds[i].min_ms +
|
||||
double ms_range = ds[i].max_ms - ds[i].min_ms;
|
||||
double ms = (double)ds[i].min_ms +
|
||||
(ms_range * rand() / (RAND_MAX + 1.0));
|
||||
now += ms / 1000.0;
|
||||
total_ms += ms;
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ set_time_units(int unit_mask) {
|
|||
// speed for the graph to the indicated value.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void GtkStatsGraph::
|
||||
set_scroll_speed(PN_stdfloat scroll_speed) {
|
||||
set_scroll_speed(double scroll_speed) {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public:
|
|||
virtual void changed_graph_size(int graph_xsize, int graph_ysize);
|
||||
|
||||
virtual void set_time_units(int unit_mask);
|
||||
virtual void set_scroll_speed(PN_stdfloat scroll_speed);
|
||||
virtual void set_scroll_speed(double scroll_speed);
|
||||
void set_pause(bool pause);
|
||||
|
||||
void user_guide_bars_changed();
|
||||
|
|
@ -102,7 +102,7 @@ protected:
|
|||
DragMode _drag_mode;
|
||||
DragMode _potential_drag_mode;
|
||||
int _drag_start_x, _drag_start_y;
|
||||
PN_stdfloat _drag_scale_start;
|
||||
double _drag_scale_start;
|
||||
int _drag_guide_bar;
|
||||
|
||||
bool _pause;
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ GtkStatsLabel(GtkStatsMonitor *monitor, GtkStatsGraph *graph,
|
|||
_bg_color.blue = (int)(rgb[2] * 65535.0f);
|
||||
|
||||
// Should our foreground be black or white?
|
||||
PN_stdfloat bright =
|
||||
double bright =
|
||||
rgb[0] * 0.299 +
|
||||
rgb[1] * 0.587 +
|
||||
rgb[2] * 0.114;
|
||||
|
|
|
|||
|
|
@ -243,7 +243,7 @@ idle() {
|
|||
|
||||
// Update the frame rate label from the main thread (thread 0).
|
||||
const PStatThreadData *thread_data = get_client_data()->get_thread_data(0);
|
||||
PN_stdfloat frame_rate = thread_data->get_frame_rate();
|
||||
double frame_rate = thread_data->get_frame_rate();
|
||||
if (frame_rate != 0.0f) {
|
||||
char buffer[128];
|
||||
sprintf(buffer, "%0.1f ms / %0.1f Hz", 1000.0f / frame_rate, frame_rate);
|
||||
|
|
@ -364,7 +364,7 @@ set_time_units(int unit_mask) {
|
|||
// speeds for all graphs to the indicated value.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void GtkStatsMonitor::
|
||||
set_scroll_speed(PN_stdfloat scroll_speed) {
|
||||
set_scroll_speed(double scroll_speed) {
|
||||
_scroll_speed = scroll_speed;
|
||||
|
||||
// First, change all of the open graphs appropriately.
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ public:
|
|||
const MenuDef *add_menu(const MenuDef &menu_def);
|
||||
|
||||
void set_time_units(int unit_mask);
|
||||
void set_scroll_speed(PN_stdfloat scroll_speed);
|
||||
void set_scroll_speed(double scroll_speed);
|
||||
void set_pause(bool pause);
|
||||
|
||||
private:
|
||||
|
|
@ -104,7 +104,7 @@ private:
|
|||
GtkWidget *_frame_rate_label;
|
||||
string _window_title;
|
||||
int _time_units;
|
||||
PN_stdfloat _scroll_speed;
|
||||
double _scroll_speed;
|
||||
bool _pause;
|
||||
|
||||
static GtkItemFactoryEntry menu_entries[];
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ clicked_label(int collector_index) {
|
|||
// horizontal axis represents. This may force a redraw.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void GtkStatsPianoRoll::
|
||||
set_horizontal_scale(PN_stdfloat time_width) {
|
||||
set_horizontal_scale(double time_width) {
|
||||
PStatPianoRoll::set_horizontal_scale(time_width);
|
||||
|
||||
gtk_widget_queue_draw(_graph_window);
|
||||
|
|
@ -258,8 +258,8 @@ consider_drag_start(int graph_x, int graph_y) {
|
|||
if (graph_x >= 0 && graph_x < get_xsize()) {
|
||||
// See if the mouse is over a user-defined guide bar.
|
||||
int x = graph_x;
|
||||
PN_stdfloat from_height = pixel_to_height(x - 2);
|
||||
PN_stdfloat to_height = pixel_to_height(x + 2);
|
||||
double from_height = pixel_to_height(x - 2);
|
||||
double to_height = pixel_to_height(x + 2);
|
||||
_drag_guide_bar = find_user_guide_bar(from_height, to_height);
|
||||
if (_drag_guide_bar >= 0) {
|
||||
return DM_guide_bar;
|
||||
|
|
@ -365,7 +365,7 @@ handle_motion(GtkWidget *widget, int graph_x, int graph_y) {
|
|||
}
|
||||
|
||||
if (_drag_mode == DM_scale) {
|
||||
PN_stdfloat ratio = (PN_stdfloat)graph_x / (PN_stdfloat)get_xsize();
|
||||
double ratio = (double)graph_x / (double)get_xsize();
|
||||
if (ratio > 0.0f) {
|
||||
set_horizontal_scale(_drag_scale_start / ratio);
|
||||
}
|
||||
|
|
@ -506,8 +506,8 @@ draw_guide_label(const PStatGraph::GuideBar &bar) {
|
|||
pango_layout_get_pixel_size(layout, &width, &height);
|
||||
|
||||
if (bar._style != GBS_user) {
|
||||
PN_stdfloat from_height = pixel_to_height(x - width);
|
||||
PN_stdfloat to_height = pixel_to_height(x + width);
|
||||
double from_height = pixel_to_height(x - width);
|
||||
double to_height = pixel_to_height(x + width);
|
||||
if (find_user_guide_bar(from_height, to_height) >= 0) {
|
||||
// Omit the label: there's a user-defined guide bar in the same space.
|
||||
g_object_unref(layout);
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public:
|
|||
|
||||
virtual void set_time_units(int unit_mask);
|
||||
virtual void clicked_label(int collector_index);
|
||||
void set_horizontal_scale(PN_stdfloat time_width);
|
||||
void set_horizontal_scale(double time_width);
|
||||
|
||||
protected:
|
||||
void clear_region();
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ set_time_units(int unit_mask) {
|
|||
// speed for the graph to the indicated value.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void GtkStatsStripChart::
|
||||
set_scroll_speed(PN_stdfloat scroll_speed) {
|
||||
set_scroll_speed(double scroll_speed) {
|
||||
// The speed factor indicates chart widths per minute.
|
||||
if (scroll_speed != 0.0f) {
|
||||
set_horizontal_scale(60.0f / scroll_speed);
|
||||
|
|
@ -235,7 +235,7 @@ clicked_label(int collector_index) {
|
|||
// represents. This may force a redraw.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void GtkStatsStripChart::
|
||||
set_vertical_scale(PN_stdfloat value_height) {
|
||||
set_vertical_scale(double value_height) {
|
||||
PStatStripChart::set_vertical_scale(value_height);
|
||||
|
||||
gtk_widget_queue_draw(_graph_window);
|
||||
|
|
@ -309,7 +309,7 @@ draw_slice(int x, int w, const PStatStripChart::FrameData &fdata) {
|
|||
gdk_draw_rectangle(_pixmap, _pixmap_gc, TRUE, x, 0,
|
||||
w + 1, get_ysize());
|
||||
|
||||
PN_stdfloat overall_time = 0.0;
|
||||
double overall_time = 0.0;
|
||||
int y = get_ysize();
|
||||
|
||||
FrameData::const_iterator fi;
|
||||
|
|
@ -406,8 +406,8 @@ consider_drag_start(int graph_x, int graph_y) {
|
|||
if (graph_y >= 0 && graph_y < get_ysize()) {
|
||||
// See if the mouse is over a user-defined guide bar.
|
||||
int y = graph_y;
|
||||
PN_stdfloat from_height = pixel_to_height(y + 2);
|
||||
PN_stdfloat to_height = pixel_to_height(y - 2);
|
||||
double from_height = pixel_to_height(y + 2);
|
||||
double to_height = pixel_to_height(y - 2);
|
||||
_drag_guide_bar = find_user_guide_bar(from_height, to_height);
|
||||
if (_drag_guide_bar >= 0) {
|
||||
return DM_guide_bar;
|
||||
|
|
@ -541,7 +541,7 @@ handle_motion(GtkWidget *widget, int graph_x, int graph_y) {
|
|||
}
|
||||
|
||||
if (_drag_mode == DM_scale) {
|
||||
PN_stdfloat ratio = 1.0f - ((PN_stdfloat)graph_y / (PN_stdfloat)get_ysize());
|
||||
double ratio = 1.0f - ((double)graph_y / (double)get_ysize());
|
||||
if (ratio > 0.0f) {
|
||||
set_vertical_scale(_drag_scale_start / ratio);
|
||||
}
|
||||
|
|
@ -654,8 +654,8 @@ draw_guide_label(const PStatGraph::GuideBar &bar, int last_y) {
|
|||
pango_layout_get_pixel_size(layout, &width, &height);
|
||||
|
||||
if (bar._style != GBS_user) {
|
||||
PN_stdfloat from_height = pixel_to_height(y + height);
|
||||
PN_stdfloat to_height = pixel_to_height(y - height);
|
||||
double from_height = pixel_to_height(y + height);
|
||||
double to_height = pixel_to_height(y - height);
|
||||
if (find_user_guide_bar(from_height, to_height) >= 0) {
|
||||
// Omit the label: there's a user-defined guide bar in the same space.
|
||||
g_object_unref(layout);
|
||||
|
|
|
|||
|
|
@ -41,9 +41,9 @@ public:
|
|||
virtual void changed_graph_size(int graph_xsize, int graph_ysize);
|
||||
|
||||
virtual void set_time_units(int unit_mask);
|
||||
virtual void set_scroll_speed(PN_stdfloat scroll_speed);
|
||||
virtual void set_scroll_speed(double scroll_speed);
|
||||
virtual void clicked_label(int collector_index);
|
||||
void set_vertical_scale(PN_stdfloat value_height);
|
||||
void set_vertical_scale(double value_height);
|
||||
|
||||
protected:
|
||||
virtual void update_labels();
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ get_label_color(int n) const {
|
|||
// placement of guide bars.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void PStatGraph::
|
||||
set_target_frame_rate(PN_stdfloat frame_rate) {
|
||||
set_target_frame_rate(double frame_rate) {
|
||||
if (_target_frame_rate != frame_rate) {
|
||||
_target_frame_rate = frame_rate;
|
||||
normal_guide_bars();
|
||||
|
|
@ -89,7 +89,7 @@ set_target_frame_rate(PN_stdfloat frame_rate) {
|
|||
// Description: Returns the indicated target frame rate in Hz. See
|
||||
// set_target_frame_rate().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE PN_stdfloat PStatGraph::
|
||||
INLINE double PStatGraph::
|
||||
get_target_frame_rate() const {
|
||||
return _target_frame_rate;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
PStatGraph::GuideBar::
|
||||
GuideBar(PN_stdfloat height, const string &label, PStatGraph::GuideBarStyle style) :
|
||||
GuideBar(double height, const string &label, PStatGraph::GuideBarStyle style) :
|
||||
_height(height),
|
||||
_label(label),
|
||||
_style(style)
|
||||
|
|
@ -124,7 +124,7 @@ get_num_user_guide_bars() const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
PStatGraph::GuideBar PStatGraph::
|
||||
get_user_guide_bar(int n) const {
|
||||
PN_stdfloat height = _monitor->get_server()->get_user_guide_bar_height(n);
|
||||
double height = _monitor->get_server()->get_user_guide_bar_height(n);
|
||||
return make_guide_bar(height, GBS_user);
|
||||
}
|
||||
|
||||
|
|
@ -134,7 +134,7 @@ get_user_guide_bar(int n) const {
|
|||
// Description: Adjusts the height of the nth user-defined guide bar.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void PStatGraph::
|
||||
move_user_guide_bar(int n, PN_stdfloat height) {
|
||||
move_user_guide_bar(int n, double height) {
|
||||
_monitor->get_server()->move_user_guide_bar(n, height);
|
||||
}
|
||||
|
||||
|
|
@ -145,7 +145,7 @@ move_user_guide_bar(int n, PN_stdfloat height) {
|
|||
// number.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int PStatGraph::
|
||||
add_user_guide_bar(PN_stdfloat height) {
|
||||
add_user_guide_bar(double height) {
|
||||
return _monitor->get_server()->add_user_guide_bar(height);
|
||||
}
|
||||
|
||||
|
|
@ -169,7 +169,7 @@ remove_user_guide_bar(int n) {
|
|||
// -1 if no user guide bars fall within the range.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int PStatGraph::
|
||||
find_user_guide_bar(PN_stdfloat from_height, PN_stdfloat to_height) const {
|
||||
find_user_guide_bar(double from_height, double to_height) const {
|
||||
return _monitor->get_server()->find_user_guide_bar(from_height, to_height);
|
||||
}
|
||||
|
||||
|
|
@ -181,7 +181,7 @@ find_user_guide_bar(PN_stdfloat from_height, PN_stdfloat to_height) const {
|
|||
// formatted for its range.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
string PStatGraph::
|
||||
format_number(PN_stdfloat value) {
|
||||
format_number(double value) {
|
||||
char buffer[128];
|
||||
|
||||
if (value < 0.01) {
|
||||
|
|
@ -207,7 +207,7 @@ format_number(PN_stdfloat value) {
|
|||
// as indicated.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
string PStatGraph::
|
||||
format_number(PN_stdfloat value, int guide_bar_units, const string &unit_name) {
|
||||
format_number(double value, int guide_bar_units, const string &unit_name) {
|
||||
string label;
|
||||
|
||||
if ((guide_bar_units & GBU_named) != 0) {
|
||||
|
|
@ -222,7 +222,7 @@ format_number(PN_stdfloat value, int guide_bar_units, const string &unit_name) {
|
|||
} else {
|
||||
// Units are either milliseconds or hz, or both.
|
||||
if ((guide_bar_units & GBU_ms) != 0) {
|
||||
PN_stdfloat ms = value * 1000.0;
|
||||
double ms = value * 1000.0;
|
||||
label += format_number(ms);
|
||||
if ((guide_bar_units & GBU_show_units) != 0) {
|
||||
label += " ms";
|
||||
|
|
@ -230,7 +230,7 @@ format_number(PN_stdfloat value, int guide_bar_units, const string &unit_name) {
|
|||
}
|
||||
|
||||
if ((guide_bar_units & GBU_hz) != 0) {
|
||||
PN_stdfloat hz = 1.0 / value;
|
||||
double hz = 1.0 / value;
|
||||
|
||||
if ((guide_bar_units & GBU_ms) != 0) {
|
||||
label += " (";
|
||||
|
|
@ -254,7 +254,7 @@ format_number(PN_stdfloat value, int guide_bar_units, const string &unit_name) {
|
|||
// Description: Resets the list of guide bars.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void PStatGraph::
|
||||
update_guide_bars(int num_bars, PN_stdfloat scale) {
|
||||
update_guide_bars(int num_bars, double scale) {
|
||||
_guide_bars.clear();
|
||||
|
||||
// We'd like to draw about num_bars bars on the chart. But we also
|
||||
|
|
@ -265,9 +265,9 @@ update_guide_bars(int num_bars, PN_stdfloat scale) {
|
|||
// Choose a suitable harmonic of the target frame rate near the
|
||||
// bottom part of the chart.
|
||||
|
||||
PN_stdfloat bottom = (PN_stdfloat)num_bars / scale;
|
||||
double bottom = (double)num_bars / scale;
|
||||
|
||||
PN_stdfloat harmonic;
|
||||
double harmonic;
|
||||
if (_target_frame_rate < bottom) {
|
||||
// n * tfr
|
||||
harmonic = floor(bottom / _target_frame_rate + 0.5) * _target_frame_rate;
|
||||
|
|
@ -292,14 +292,14 @@ update_guide_bars(int num_bars, PN_stdfloat scale) {
|
|||
// level units.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
PStatGraph::GuideBar PStatGraph::
|
||||
make_guide_bar(PN_stdfloat value, PStatGraph::GuideBarStyle style) const {
|
||||
make_guide_bar(double value, PStatGraph::GuideBarStyle style) const {
|
||||
string label = format_number(value, _guide_bar_units, _unit_name);
|
||||
|
||||
if ((style == GBS_normal) &&
|
||||
(_guide_bar_units & GBU_named) == 0) {
|
||||
// If it's a time unit, check to see if it matches our target
|
||||
// frame rate.
|
||||
PN_stdfloat hz = 1.0 / value;
|
||||
double hz = 1.0 / value;
|
||||
if (IS_THRESHOLD_EQUAL(hz, _target_frame_rate, 0.001)) {
|
||||
style = GBS_target;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,8 +45,8 @@ public:
|
|||
INLINE string get_label_name(int n) const;
|
||||
INLINE LRGBColor get_label_color(int n) const;
|
||||
|
||||
INLINE void set_target_frame_rate(PN_stdfloat frame_rate);
|
||||
INLINE PN_stdfloat get_target_frame_rate() const;
|
||||
INLINE void set_target_frame_rate(double frame_rate);
|
||||
INLINE double get_target_frame_rate() const;
|
||||
|
||||
INLINE int get_xsize() const;
|
||||
INLINE int get_ysize() const;
|
||||
|
|
@ -59,10 +59,10 @@ public:
|
|||
|
||||
class GuideBar {
|
||||
public:
|
||||
GuideBar(PN_stdfloat height, const string &label, GuideBarStyle style);
|
||||
GuideBar(double height, const string &label, GuideBarStyle style);
|
||||
GuideBar(const GuideBar ©);
|
||||
|
||||
PN_stdfloat _height;
|
||||
double _height;
|
||||
string _label;
|
||||
GuideBarStyle _style;
|
||||
};
|
||||
|
|
@ -79,31 +79,31 @@ public:
|
|||
|
||||
int get_num_user_guide_bars() const;
|
||||
GuideBar get_user_guide_bar(int n) const;
|
||||
void move_user_guide_bar(int n, PN_stdfloat height);
|
||||
int add_user_guide_bar(PN_stdfloat height);
|
||||
void move_user_guide_bar(int n, double height);
|
||||
int add_user_guide_bar(double height);
|
||||
void remove_user_guide_bar(int n);
|
||||
int find_user_guide_bar(PN_stdfloat from_height, PN_stdfloat to_height) const;
|
||||
int find_user_guide_bar(double from_height, double to_height) const;
|
||||
|
||||
INLINE void set_guide_bar_units(int unit_mask);
|
||||
INLINE int get_guide_bar_units() const;
|
||||
INLINE void set_guide_bar_unit_name(const string &unit_name);
|
||||
INLINE const string &get_guide_bar_unit_name() const;
|
||||
|
||||
static string format_number(PN_stdfloat value);
|
||||
static string format_number(PN_stdfloat value, int guide_bar_units,
|
||||
static string format_number(double value);
|
||||
static string format_number(double value, int guide_bar_units,
|
||||
const string &unit_name = string());
|
||||
|
||||
protected:
|
||||
virtual void normal_guide_bars()=0;
|
||||
void update_guide_bars(int num_bars, PN_stdfloat scale);
|
||||
GuideBar make_guide_bar(PN_stdfloat value, GuideBarStyle style = GBS_normal) const;
|
||||
void update_guide_bars(int num_bars, double scale);
|
||||
GuideBar make_guide_bar(double value, GuideBarStyle style = GBS_normal) const;
|
||||
|
||||
bool _labels_changed;
|
||||
bool _guide_bars_changed;
|
||||
|
||||
PT(PStatMonitor) _monitor;
|
||||
|
||||
PN_stdfloat _target_frame_rate;
|
||||
double _target_frame_rate;
|
||||
|
||||
int _xsize;
|
||||
int _ysize;
|
||||
|
|
|
|||
|
|
@ -154,9 +154,9 @@ get_collector_color(int collector_index) {
|
|||
|
||||
// We didn't have a color for the collector; make one up.
|
||||
LRGBColor random_color;
|
||||
random_color[0] = (PN_stdfloat)rand() / (PN_stdfloat)RAND_MAX;
|
||||
random_color[1] = (PN_stdfloat)rand() / (PN_stdfloat)RAND_MAX;
|
||||
random_color[2] = (PN_stdfloat)rand() / (PN_stdfloat)RAND_MAX;
|
||||
random_color[0] = (double)rand() / (double)RAND_MAX;
|
||||
random_color[1] = (double)rand() / (double)RAND_MAX;
|
||||
random_color[2] = (double)rand() / (double)RAND_MAX;
|
||||
|
||||
ci = _colors.insert(Colors::value_type(collector_index, random_color)).first;
|
||||
return (*ci).second;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
// horizontal axis represents. This may force a redraw.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void PStatPianoRoll::
|
||||
set_horizontal_scale(PN_stdfloat time_width) {
|
||||
set_horizontal_scale(double time_width) {
|
||||
if (_time_width != time_width) {
|
||||
_time_width = time_width;
|
||||
normal_guide_bars();
|
||||
|
|
@ -33,7 +33,7 @@ set_horizontal_scale(PN_stdfloat time_width) {
|
|||
// Description: Returns the amount of total time the width of the
|
||||
// horizontal axis represents.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE PN_stdfloat PStatPianoRoll::
|
||||
INLINE double PStatPianoRoll::
|
||||
get_horizontal_scale() const {
|
||||
return _time_width;
|
||||
}
|
||||
|
|
@ -44,8 +44,8 @@ get_horizontal_scale() const {
|
|||
// Description: Converts a timestamp to a horizontal pixel offset.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE int PStatPianoRoll::
|
||||
timestamp_to_pixel(PN_stdfloat time) const {
|
||||
return (int)((PN_stdfloat)_xsize * (time - _start_time) / _time_width);
|
||||
timestamp_to_pixel(double time) const {
|
||||
return (int)((double)_xsize * (time - _start_time) / _time_width);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -53,9 +53,9 @@ timestamp_to_pixel(PN_stdfloat time) const {
|
|||
// Access: Public
|
||||
// Description: Converts a horizontal pixel offset to a timestamp.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE PN_stdfloat PStatPianoRoll::
|
||||
INLINE double PStatPianoRoll::
|
||||
pixel_to_timestamp(int x) const {
|
||||
return _time_width * (PN_stdfloat)x / (PN_stdfloat)_xsize + _start_time;
|
||||
return _time_width * (double)x / (double)_xsize + _start_time;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -65,8 +65,8 @@ pixel_to_timestamp(int x) const {
|
|||
// to a horizontal pixel offset.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE int PStatPianoRoll::
|
||||
height_to_pixel(PN_stdfloat value) const {
|
||||
return (int)((PN_stdfloat)_xsize * value / _time_width);
|
||||
height_to_pixel(double value) const {
|
||||
return (int)((double)_xsize * value / _time_width);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -75,7 +75,7 @@ height_to_pixel(PN_stdfloat value) const {
|
|||
// Description: Converts a horizontal pixel offset to a value (a
|
||||
// "height" in the strip chart).
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE PN_stdfloat PStatPianoRoll::
|
||||
INLINE double PStatPianoRoll::
|
||||
pixel_to_height(int x) const {
|
||||
return _time_width * (PN_stdfloat)x / (PN_stdfloat)_xsize;
|
||||
return _time_width * (double)x / (double)_xsize;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ clear() {
|
|||
// second data point turns it off (ends the bar).
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void PStatPianoRoll::BarBuilder::
|
||||
add_data_point(PN_stdfloat time, bool is_start) {
|
||||
add_data_point(double time, bool is_start) {
|
||||
if (is_start) {
|
||||
// This is a "start" data point: start the bar.
|
||||
if (_color_bars.empty() || _color_bars.back()._end >= 0.0) {
|
||||
|
|
@ -84,7 +84,7 @@ add_data_point(PN_stdfloat time, bool is_start) {
|
|||
// by a corresponding end-bar data point.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void PStatPianoRoll::BarBuilder::
|
||||
finish(PN_stdfloat time) {
|
||||
finish(double time) {
|
||||
if (!_color_bars.empty() && _color_bars.back()._end < 0.0) {
|
||||
_color_bars.back()._end = time;
|
||||
}
|
||||
|
|
@ -304,7 +304,7 @@ compute_page(const PStatFrameData &frame_data) {
|
|||
int num_events = frame_data.get_num_events();
|
||||
for (int i = 0; i < num_events; i++) {
|
||||
int collector_index = frame_data.get_time_collector(i);
|
||||
PN_stdfloat time = frame_data.get_time(i);
|
||||
double time = frame_data.get_time(i);
|
||||
bool is_start = frame_data.is_start(i);
|
||||
_page_data[collector_index].add_data_point(time, is_start);
|
||||
}
|
||||
|
|
@ -344,7 +344,7 @@ compute_page(const PStatFrameData &frame_data) {
|
|||
}
|
||||
|
||||
// Finally, make sure all of the bars are closed.
|
||||
PN_stdfloat time = frame_data.get_end();
|
||||
double time = frame_data.get_end();
|
||||
PageData::iterator pi;
|
||||
for (pi = _page_data.begin(); pi != _page_data.end(); ++pi) {
|
||||
(*pi).second.finish(time);
|
||||
|
|
|
|||
|
|
@ -48,13 +48,13 @@ public:
|
|||
|
||||
void update();
|
||||
|
||||
INLINE void set_horizontal_scale(PN_stdfloat time_width);
|
||||
INLINE PN_stdfloat get_horizontal_scale() const;
|
||||
INLINE void set_horizontal_scale(double time_width);
|
||||
INLINE double get_horizontal_scale() const;
|
||||
|
||||
INLINE int timestamp_to_pixel(PN_stdfloat time) const;
|
||||
INLINE PN_stdfloat pixel_to_timestamp(int x) const;
|
||||
INLINE int height_to_pixel(PN_stdfloat value) const;
|
||||
INLINE PN_stdfloat pixel_to_height(int y) const;
|
||||
INLINE int timestamp_to_pixel(double time) const;
|
||||
INLINE double pixel_to_timestamp(int x) const;
|
||||
INLINE int height_to_pixel(double value) const;
|
||||
INLINE double pixel_to_height(int y) const;
|
||||
|
||||
protected:
|
||||
void changed_size(int xsize, int ysize);
|
||||
|
|
@ -75,13 +75,13 @@ protected:
|
|||
int _thread_index;
|
||||
|
||||
private:
|
||||
PN_stdfloat _time_width;
|
||||
PN_stdfloat _start_time;
|
||||
double _time_width;
|
||||
double _start_time;
|
||||
|
||||
class ColorBar {
|
||||
public:
|
||||
PN_stdfloat _start;
|
||||
PN_stdfloat _end;
|
||||
double _start;
|
||||
double _end;
|
||||
};
|
||||
typedef pvector<ColorBar> ColorBars;
|
||||
|
||||
|
|
@ -89,8 +89,8 @@ private:
|
|||
public:
|
||||
BarBuilder();
|
||||
void clear();
|
||||
void add_data_point(PN_stdfloat time, bool is_start);
|
||||
void finish(PN_stdfloat time);
|
||||
void add_data_point(double time, bool is_start);
|
||||
void finish(double time);
|
||||
|
||||
bool _is_new;
|
||||
ColorBars _color_bars;
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@ get_num_user_guide_bars() const {
|
|||
// Access: Public
|
||||
// Description: Returns the height of the nth user-defined guide bar.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
PN_stdfloat PStatServer::
|
||||
double PStatServer::
|
||||
get_user_guide_bar_height(int n) const {
|
||||
nassertr(n >= 0 && n < (int)_user_guide_bars.size(), 0.0f);
|
||||
return _user_guide_bars[n];
|
||||
|
|
@ -231,7 +231,7 @@ get_user_guide_bar_height(int n) const {
|
|||
// Description: Adjusts the height of the nth user-defined guide bar.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void PStatServer::
|
||||
move_user_guide_bar(int n, PN_stdfloat height) {
|
||||
move_user_guide_bar(int n, double height) {
|
||||
nassertv(n >= 0 && n < (int)_user_guide_bars.size());
|
||||
_user_guide_bars[n] = height;
|
||||
user_guide_bars_changed();
|
||||
|
|
@ -244,7 +244,7 @@ move_user_guide_bar(int n, PN_stdfloat height) {
|
|||
// number.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int PStatServer::
|
||||
add_user_guide_bar(PN_stdfloat height) {
|
||||
add_user_guide_bar(double height) {
|
||||
int n = (int)_user_guide_bars.size();
|
||||
_user_guide_bars.push_back(height);
|
||||
user_guide_bars_changed();
|
||||
|
|
@ -274,12 +274,12 @@ remove_user_guide_bar(int n) {
|
|||
// -1 if no user guide bars fall within the range.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int PStatServer::
|
||||
find_user_guide_bar(PN_stdfloat from_height, PN_stdfloat to_height) const {
|
||||
find_user_guide_bar(double from_height, double to_height) const {
|
||||
GuideBars::const_iterator gbi;
|
||||
for (gbi = _user_guide_bars.begin();
|
||||
gbi != _user_guide_bars.end();
|
||||
++gbi) {
|
||||
PN_stdfloat height = (*gbi);
|
||||
double height = (*gbi);
|
||||
if (height >= from_height && height <= to_height) {
|
||||
return (int)(gbi - _user_guide_bars.begin());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,11 +56,11 @@ public:
|
|||
void release_udp_port(int port);
|
||||
|
||||
int get_num_user_guide_bars() const;
|
||||
PN_stdfloat get_user_guide_bar_height(int n) const;
|
||||
void move_user_guide_bar(int n, PN_stdfloat height);
|
||||
int add_user_guide_bar(PN_stdfloat height);
|
||||
double get_user_guide_bar_height(int n) const;
|
||||
void move_user_guide_bar(int n, double height);
|
||||
int add_user_guide_bar(double height);
|
||||
void remove_user_guide_bar(int n);
|
||||
int find_user_guide_bar(PN_stdfloat from_height, PN_stdfloat to_height) const;
|
||||
int find_user_guide_bar(double from_height, double to_height) const;
|
||||
|
||||
virtual bool is_thread_safe();
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ get_collector_index() const {
|
|||
// horizontal axis represents. This may force a redraw.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void PStatStripChart::
|
||||
set_horizontal_scale(PN_stdfloat time_width) {
|
||||
set_horizontal_scale(double time_width) {
|
||||
if (_time_width != time_width) {
|
||||
if (_scroll_mode) {
|
||||
_start_time += _time_width - time_width;
|
||||
|
|
@ -58,7 +58,7 @@ set_horizontal_scale(PN_stdfloat time_width) {
|
|||
// Description: Returns the amount of total time the width of the
|
||||
// horizontal axis represents.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE PN_stdfloat PStatStripChart::
|
||||
INLINE double PStatStripChart::
|
||||
get_horizontal_scale() const {
|
||||
return _time_width;
|
||||
}
|
||||
|
|
@ -70,7 +70,7 @@ get_horizontal_scale() const {
|
|||
// represents. This may force a redraw.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void PStatStripChart::
|
||||
set_vertical_scale(PN_stdfloat value_height) {
|
||||
set_vertical_scale(double value_height) {
|
||||
if (_value_height != value_height) {
|
||||
_value_height = value_height;
|
||||
normal_guide_bars();
|
||||
|
|
@ -84,7 +84,7 @@ set_vertical_scale(PN_stdfloat value_height) {
|
|||
// Description: Returns total value the height of the vertical axis
|
||||
// represents.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE PN_stdfloat PStatStripChart::
|
||||
INLINE double PStatStripChart::
|
||||
get_vertical_scale() const {
|
||||
return _value_height;
|
||||
}
|
||||
|
|
@ -158,8 +158,8 @@ get_average_mode() const {
|
|||
// Description: Converts a timestamp to a horizontal pixel offset.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE int PStatStripChart::
|
||||
timestamp_to_pixel(PN_stdfloat time) const {
|
||||
return (int)((PN_stdfloat)get_xsize() * (time - _start_time) / _time_width);
|
||||
timestamp_to_pixel(double time) const {
|
||||
return (int)((double)get_xsize() * (time - _start_time) / _time_width);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -167,9 +167,9 @@ timestamp_to_pixel(PN_stdfloat time) const {
|
|||
// Access: Public
|
||||
// Description: Converts a horizontal pixel offset to a timestamp.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE PN_stdfloat PStatStripChart::
|
||||
INLINE double PStatStripChart::
|
||||
pixel_to_timestamp(int x) const {
|
||||
return _time_width * (PN_stdfloat)x / (PN_stdfloat)get_xsize() + _start_time;
|
||||
return _time_width * (double)x / (double)get_xsize() + _start_time;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -179,8 +179,8 @@ pixel_to_timestamp(int x) const {
|
|||
// to a vertical pixel offset.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE int PStatStripChart::
|
||||
height_to_pixel(PN_stdfloat value) const {
|
||||
return get_ysize() - (int)((PN_stdfloat)get_ysize() * value / _value_height);
|
||||
height_to_pixel(double value) const {
|
||||
return get_ysize() - (int)((double)get_ysize() * value / _value_height);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -189,9 +189,9 @@ height_to_pixel(PN_stdfloat value) const {
|
|||
// Description: Converts a vertical pixel offset to a value (a
|
||||
// "height" in the strip chart).
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE PN_stdfloat PStatStripChart::
|
||||
INLINE double PStatStripChart::
|
||||
pixel_to_height(int x) const {
|
||||
return _value_height * (PN_stdfloat)(get_ysize() - x) / (PN_stdfloat)get_ysize();
|
||||
return _value_height * (double)(get_ysize() - x) / (double)get_ysize();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ update() {
|
|||
_next_frame = latest;
|
||||
|
||||
// Clean out the old data.
|
||||
PN_stdfloat oldest_time =
|
||||
double oldest_time =
|
||||
thread_data->get_frame(latest).get_start() - _time_width;
|
||||
|
||||
Data::iterator di;
|
||||
|
|
@ -185,16 +185,16 @@ void PStatStripChart::
|
|||
set_auto_vertical_scale() {
|
||||
const PStatThreadData *thread_data = _view.get_thread_data();
|
||||
|
||||
PN_stdfloat max_value = 0.0;
|
||||
double max_value = 0.0;
|
||||
|
||||
int frame_number = -1;
|
||||
for (int x = 0; x <= _xsize; x++) {
|
||||
PN_stdfloat time = pixel_to_timestamp(x);
|
||||
double time = pixel_to_timestamp(x);
|
||||
frame_number =
|
||||
thread_data->get_frame_number_at_time(time, frame_number);
|
||||
|
||||
if (thread_data->has_frame(frame_number)) {
|
||||
PN_stdfloat net_value = get_net_value(frame_number);
|
||||
double net_value = get_net_value(frame_number);
|
||||
max_value = max(max_value, net_value);
|
||||
}
|
||||
}
|
||||
|
|
@ -219,7 +219,7 @@ int PStatStripChart::
|
|||
get_collector_under_pixel(int xpoint, int ypoint) {
|
||||
// First, we need to know what frame it was; to know that, we need
|
||||
// to determine the time corresponding to the x pixel.
|
||||
PN_stdfloat time = pixel_to_timestamp(xpoint);
|
||||
double time = pixel_to_timestamp(xpoint);
|
||||
|
||||
// Now use that time to determine the frame.
|
||||
const PStatThreadData *thread_data = _view.get_thread_data();
|
||||
|
|
@ -227,13 +227,13 @@ get_collector_under_pixel(int xpoint, int ypoint) {
|
|||
// And now we can determine which collector within the frame,
|
||||
// based on the value height.
|
||||
if (_average_mode) {
|
||||
PN_stdfloat start_time = pixel_to_timestamp(xpoint);
|
||||
double start_time = pixel_to_timestamp(xpoint);
|
||||
int then_i = thread_data->get_frame_number_at_time(start_time - pstats_average_time);
|
||||
int now_i = thread_data->get_frame_number_at_time(start_time, then_i);
|
||||
|
||||
FrameData fdata;
|
||||
compute_average_pixel_data(fdata, then_i, now_i, start_time);
|
||||
PN_stdfloat overall_value = 0.0;
|
||||
double overall_value = 0.0;
|
||||
int y = get_ysize();
|
||||
|
||||
FrameData::const_iterator fi;
|
||||
|
|
@ -249,7 +249,7 @@ get_collector_under_pixel(int xpoint, int ypoint) {
|
|||
} else {
|
||||
int frame_number = thread_data->get_frame_number_at_time(time);
|
||||
const FrameData &fdata = get_frame_data(frame_number);
|
||||
PN_stdfloat overall_value = 0.0;
|
||||
double overall_value = 0.0;
|
||||
int y = get_ysize();
|
||||
|
||||
FrameData::const_iterator fi;
|
||||
|
|
@ -323,7 +323,7 @@ is_title_unknown() const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void PStatStripChart::
|
||||
accumulate_frame_data(FrameData &fdata, const FrameData &additional,
|
||||
PN_stdfloat weight) {
|
||||
double weight) {
|
||||
FrameData::iterator ai;
|
||||
FrameData::const_iterator bi;
|
||||
|
||||
|
|
@ -417,7 +417,7 @@ accumulate_frame_data(FrameData &fdata, const FrameData &additional,
|
|||
// in data.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void PStatStripChart::
|
||||
scale_frame_data(FrameData &fdata, PN_stdfloat factor) {
|
||||
scale_frame_data(FrameData &fdata, double factor) {
|
||||
FrameData::iterator fi;
|
||||
for (fi = fdata.begin(); fi != fdata.end(); ++fi) {
|
||||
(*fi)._net_value *= factor;
|
||||
|
|
@ -491,7 +491,7 @@ get_frame_data(int frame_number) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void PStatStripChart::
|
||||
compute_average_pixel_data(PStatStripChart::FrameData &result,
|
||||
int &then_i, int &now_i, PN_stdfloat now) {
|
||||
int &then_i, int &now_i, double now) {
|
||||
result.clear();
|
||||
|
||||
const PStatThreadData *thread_data = _view.get_thread_data();
|
||||
|
|
@ -500,7 +500,7 @@ compute_average_pixel_data(PStatStripChart::FrameData &result,
|
|||
return;
|
||||
}
|
||||
|
||||
PN_stdfloat then = now - pstats_average_time;
|
||||
double then = now - pstats_average_time;
|
||||
|
||||
int latest_frame = thread_data->get_latest_frame_number();
|
||||
while (then_i <= latest_frame &&
|
||||
|
|
@ -521,7 +521,7 @@ compute_average_pixel_data(PStatStripChart::FrameData &result,
|
|||
// does fall within our "then to now" window.
|
||||
accumulate_frame_data(result, get_frame_data(then_i),
|
||||
thread_data->get_frame(then_i).get_end() - then);
|
||||
PN_stdfloat last = thread_data->get_frame(then_i).get_end();
|
||||
double last = thread_data->get_frame(then_i).get_end();
|
||||
|
||||
// Then we get all of each of the middle frames.
|
||||
for (int frame_number = then_i + 1;
|
||||
|
|
@ -546,12 +546,12 @@ compute_average_pixel_data(PStatStripChart::FrameData &result,
|
|||
// Description: Returns the net value of the chart's collector for
|
||||
// the indicated frame number.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
PN_stdfloat PStatStripChart::
|
||||
double PStatStripChart::
|
||||
get_net_value(int frame_number) const {
|
||||
const FrameData &frame =
|
||||
((PStatStripChart *)this)->get_frame_data(frame_number);
|
||||
|
||||
PN_stdfloat net_value = 0.0;
|
||||
double net_value = 0.0;
|
||||
FrameData::const_iterator fi;
|
||||
for (fi = frame.begin(); fi != frame.end(); ++fi) {
|
||||
const ColorData &cd = (*fi);
|
||||
|
|
@ -567,15 +567,15 @@ get_net_value(int frame_number) const {
|
|||
// Description: Computes the average value of the chart's collector
|
||||
// over the past pstats_average_time number of seconds.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
PN_stdfloat PStatStripChart::
|
||||
double PStatStripChart::
|
||||
get_average_net_value() const {
|
||||
const PStatThreadData *thread_data = _view.get_thread_data();
|
||||
int now_i, then_i;
|
||||
if (!thread_data->get_elapsed_frames(then_i, now_i)) {
|
||||
return 0.0f;
|
||||
}
|
||||
PN_stdfloat now = _time_width + _start_time;
|
||||
PN_stdfloat then = now - pstats_average_time;
|
||||
double now = _time_width + _start_time;
|
||||
double then = now - pstats_average_time;
|
||||
|
||||
int num_frames = now_i - then_i + 1;
|
||||
|
||||
|
|
@ -587,9 +587,9 @@ get_average_net_value() const {
|
|||
|
||||
const PStatFrameData &now_frame_data = thread_data->get_frame(now_i);
|
||||
const PStatFrameData &then_frame_data = thread_data->get_frame(then_i);
|
||||
PN_stdfloat now = now_frame_data.get_end();
|
||||
PN_stdfloat elapsed_time = (now - then_frame_data.get_start());
|
||||
return elapsed_time / (PN_stdfloat)num_frames;
|
||||
double now = now_frame_data.get_end();
|
||||
double elapsed_time = (now - then_frame_data.get_start());
|
||||
return elapsed_time / (double)num_frames;
|
||||
|
||||
} else {
|
||||
// On the other hand, if we're showing the time for some
|
||||
|
|
@ -599,14 +599,14 @@ get_average_net_value() const {
|
|||
|
||||
const PStatThreadData *thread_data = _view.get_thread_data();
|
||||
|
||||
PN_stdfloat net_value = 0.0f;
|
||||
PN_stdfloat net_time = 0.0f;
|
||||
double net_value = 0.0f;
|
||||
double net_time = 0.0f;
|
||||
|
||||
// We start with just the portion of frame then_i that actually
|
||||
// does fall within our "then to now" window (usually some portion
|
||||
// of it will).
|
||||
if (thread_data->get_frame(then_i).get_end() > then) {
|
||||
PN_stdfloat this_time = (thread_data->get_frame(then_i).get_end() - then);
|
||||
double this_time = (thread_data->get_frame(then_i).get_end() - then);
|
||||
net_value += get_net_value(then_i) * this_time;
|
||||
net_time += this_time;
|
||||
}
|
||||
|
|
@ -614,7 +614,7 @@ get_average_net_value() const {
|
|||
for (int frame_number = then_i + 1;
|
||||
frame_number <= now_i;
|
||||
frame_number++) {
|
||||
PN_stdfloat this_time = thread_data->get_frame(frame_number).get_net_time();
|
||||
double this_time = thread_data->get_frame(frame_number).get_net_time();
|
||||
net_value += get_net_value(frame_number) * this_time;
|
||||
net_time += this_time;
|
||||
}
|
||||
|
|
@ -645,7 +645,7 @@ changed_size(int xsize, int ysize) {
|
|||
|
||||
} else {
|
||||
// Redraw the stats that were there before.
|
||||
PN_stdfloat old_start_time = _start_time;
|
||||
double old_start_time = _start_time;
|
||||
|
||||
// Back up a bit to draw the stuff to the right of the cursor.
|
||||
_start_time -= _time_width;
|
||||
|
|
@ -892,7 +892,7 @@ draw_frames(int first_frame, int last_frame) {
|
|||
copy_region(slide_pixels, first_pixel, 0);
|
||||
first_pixel -= slide_pixels;
|
||||
last_pixel -= slide_pixels;
|
||||
_start_time += (PN_stdfloat)slide_pixels / (PN_stdfloat)_xsize * _time_width;
|
||||
_start_time += (double)slide_pixels / (double)_xsize * _time_width;
|
||||
draw_pixels(first_pixel, last_pixel);
|
||||
|
||||
} else {
|
||||
|
|
@ -919,7 +919,7 @@ draw_pixels(int first_pixel, int last_pixel) {
|
|||
|
||||
if (_average_mode && !thread_data->is_empty()) {
|
||||
// In average mode, we have to calculate the average value for each pixel.
|
||||
PN_stdfloat start_time = pixel_to_timestamp(first_pixel);
|
||||
double start_time = pixel_to_timestamp(first_pixel);
|
||||
int then_i = thread_data->get_frame_number_at_time(start_time - pstats_average_time);
|
||||
int now_i = thread_data->get_frame_number_at_time(start_time, then_i);
|
||||
for (int x = first_pixel; x <= last_pixel; x++) {
|
||||
|
|
@ -943,7 +943,7 @@ draw_pixels(int first_pixel, int last_pixel) {
|
|||
x++;
|
||||
|
||||
} else {
|
||||
PN_stdfloat time = pixel_to_timestamp(x);
|
||||
double time = pixel_to_timestamp(x);
|
||||
frame_number = thread_data->get_frame_number_at_time(time, frame_number);
|
||||
int w = 1;
|
||||
int stop_pixel = last_pixel;
|
||||
|
|
|
|||
|
|
@ -53,12 +53,12 @@ public:
|
|||
INLINE int get_collector_index() const;
|
||||
void set_collector_index(int collector_index);
|
||||
|
||||
INLINE void set_horizontal_scale(PN_stdfloat time_width);
|
||||
INLINE PN_stdfloat get_horizontal_scale() const;
|
||||
INLINE void set_vertical_scale(PN_stdfloat value_height);
|
||||
INLINE void set_horizontal_scale(double time_width);
|
||||
INLINE double get_horizontal_scale() const;
|
||||
INLINE void set_vertical_scale(double value_height);
|
||||
void set_default_vertical_scale();
|
||||
void set_auto_vertical_scale();
|
||||
INLINE PN_stdfloat get_vertical_scale() const;
|
||||
INLINE double get_vertical_scale() const;
|
||||
|
||||
INLINE void set_scroll_mode(bool scroll_mode);
|
||||
INLINE bool get_scroll_mode() const;
|
||||
|
|
@ -67,10 +67,10 @@ public:
|
|||
INLINE bool get_average_mode() const;
|
||||
|
||||
int get_collector_under_pixel(int xpoint, int ypoint);
|
||||
INLINE int timestamp_to_pixel(PN_stdfloat time) const;
|
||||
INLINE PN_stdfloat pixel_to_timestamp(int x) const;
|
||||
INLINE int height_to_pixel(PN_stdfloat value) const;
|
||||
INLINE PN_stdfloat pixel_to_height(int y) const;
|
||||
INLINE int timestamp_to_pixel(double time) const;
|
||||
INLINE double pixel_to_timestamp(int x) const;
|
||||
INLINE int height_to_pixel(double value) const;
|
||||
INLINE double pixel_to_height(int y) const;
|
||||
|
||||
string get_title_text();
|
||||
bool is_title_unknown() const;
|
||||
|
|
@ -80,20 +80,20 @@ protected:
|
|||
public:
|
||||
unsigned short _collector_index;
|
||||
unsigned short _i;
|
||||
PN_stdfloat _net_value;
|
||||
double _net_value;
|
||||
};
|
||||
typedef pvector<ColorData> FrameData;
|
||||
typedef pmap<int, FrameData> Data;
|
||||
|
||||
static void accumulate_frame_data(FrameData &fdata,
|
||||
const FrameData &additional, PN_stdfloat weight);
|
||||
static void scale_frame_data(FrameData &fdata, PN_stdfloat factor);
|
||||
const FrameData &additional, double weight);
|
||||
static void scale_frame_data(FrameData &fdata, double factor);
|
||||
|
||||
const FrameData &get_frame_data(int frame_number);
|
||||
void compute_average_pixel_data(PStatStripChart::FrameData &result,
|
||||
int &then_i, int &now_i, PN_stdfloat now);
|
||||
PN_stdfloat get_net_value(int frame_number) const;
|
||||
PN_stdfloat get_average_net_value() const;
|
||||
int &then_i, int &now_i, double now);
|
||||
double get_net_value(int frame_number) const;
|
||||
double get_average_net_value() const;
|
||||
|
||||
void changed_size(int xsize, int ysize);
|
||||
void force_redraw();
|
||||
|
|
@ -137,9 +137,9 @@ private:
|
|||
|
||||
int _level_index;
|
||||
|
||||
PN_stdfloat _time_width;
|
||||
PN_stdfloat _start_time;
|
||||
PN_stdfloat _value_height;
|
||||
double _time_width;
|
||||
double _start_time;
|
||||
double _value_height;
|
||||
bool _title_unknown;
|
||||
|
||||
typedef vector_int LabelUsage;
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ get_frame(int frame_number) const {
|
|||
// Description: Returns the timestamp (in seconds elapsed since
|
||||
// connection) of the latest available frame.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
PN_stdfloat PStatThreadData::
|
||||
double PStatThreadData::
|
||||
get_latest_time() const {
|
||||
nassertr(!_frames.empty(), 0.0);
|
||||
return _frames.back()->get_start();
|
||||
|
|
@ -152,7 +152,7 @@ get_latest_time() const {
|
|||
// Description: Returns the timestamp (in seconds elapsed since
|
||||
// connection) of the oldest available frame.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
PN_stdfloat PStatThreadData::
|
||||
double PStatThreadData::
|
||||
get_oldest_time() const {
|
||||
nassertr(!_frames.empty(), 0.0);
|
||||
return _frames.front()->get_start();
|
||||
|
|
@ -165,7 +165,7 @@ get_oldest_time() const {
|
|||
// latest frame not later than the indicated time.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
const PStatFrameData &PStatThreadData::
|
||||
get_frame_at_time(PN_stdfloat time) const {
|
||||
get_frame_at_time(double time) const {
|
||||
return get_frame(get_frame_number_at_time(time));
|
||||
}
|
||||
|
||||
|
|
@ -180,7 +180,7 @@ get_frame_at_time(PN_stdfloat time) const {
|
|||
// which may speed the search for the frame.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int PStatThreadData::
|
||||
get_frame_number_at_time(PN_stdfloat time, int hint) const {
|
||||
get_frame_number_at_time(double time, int hint) const {
|
||||
hint -= _first_frame_number;
|
||||
if (hint >= 0 && hint < (int)_frames.size()) {
|
||||
if (_frames[hint] != (PStatFrameData *)NULL &&
|
||||
|
|
@ -253,7 +253,7 @@ get_elapsed_frames(int &then_i, int &now_i) const {
|
|||
// pstats_average_time seconds, by counting up the
|
||||
// number of frames elapsed in that time interval.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
PN_stdfloat PStatThreadData::
|
||||
double PStatThreadData::
|
||||
get_frame_rate() const {
|
||||
int then_i, now_i;
|
||||
if (!get_elapsed_frames(then_i, now_i)) {
|
||||
|
|
@ -261,9 +261,9 @@ get_frame_rate() const {
|
|||
}
|
||||
|
||||
int num_frames = now_i - then_i + 1;
|
||||
PN_stdfloat now = _frames[now_i - _first_frame_number]->get_end();
|
||||
PN_stdfloat elapsed_time = (now - _frames[then_i - _first_frame_number]->get_start());
|
||||
return (PN_stdfloat)num_frames / elapsed_time;
|
||||
double now = _frames[now_i - _first_frame_number]->get_end();
|
||||
double elapsed_time = (now - _frames[then_i - _first_frame_number]->get_start());
|
||||
return (double)num_frames / elapsed_time;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -276,7 +276,7 @@ get_frame_rate() const {
|
|||
// frame that may be queried is.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void PStatThreadData::
|
||||
set_history(PN_stdfloat time) {
|
||||
set_history(double time) {
|
||||
_history = time;
|
||||
}
|
||||
|
||||
|
|
@ -288,7 +288,7 @@ set_history(PN_stdfloat time) {
|
|||
// new frame is added. This affects how old the oldest
|
||||
// frame that may be queried is.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
PN_stdfloat PStatThreadData::
|
||||
double PStatThreadData::
|
||||
get_history() const {
|
||||
return _history;
|
||||
}
|
||||
|
|
@ -309,11 +309,11 @@ void PStatThreadData::
|
|||
record_new_frame(int frame_number, PStatFrameData *frame_data) {
|
||||
nassertv(frame_data != (PStatFrameData *)NULL);
|
||||
nassertv(!frame_data->is_empty());
|
||||
PN_stdfloat time = frame_data->get_start();
|
||||
double time = frame_data->get_start();
|
||||
|
||||
// First, remove all the old frames that fall outside of our
|
||||
// history window.
|
||||
PN_stdfloat oldest_allowable_time = time - _history;
|
||||
double oldest_allowable_time = time - _history;
|
||||
while (!_frames.empty() &&
|
||||
(_frames.front() == (PStatFrameData *)NULL ||
|
||||
_frames.front()->is_empty() ||
|
||||
|
|
@ -376,8 +376,8 @@ compute_elapsed_frames() {
|
|||
} else {
|
||||
nassertv(_frames[_now_i] != (PStatFrameData *)NULL);
|
||||
|
||||
PN_stdfloat now = _frames[_now_i]->get_end();
|
||||
PN_stdfloat then = now - pstats_average_time;
|
||||
double now = _frames[_now_i]->get_end();
|
||||
double then = now - pstats_average_time;
|
||||
|
||||
int old_i = _now_i;
|
||||
_then_i = _now_i;
|
||||
|
|
|
|||
|
|
@ -49,19 +49,19 @@ public:
|
|||
bool has_frame(int frame_number) const;
|
||||
const PStatFrameData &get_frame(int frame_number) const;
|
||||
|
||||
PN_stdfloat get_latest_time() const;
|
||||
PN_stdfloat get_oldest_time() const;
|
||||
const PStatFrameData &get_frame_at_time(PN_stdfloat time) const;
|
||||
int get_frame_number_at_time(PN_stdfloat time, int hint = -1) const;
|
||||
double get_latest_time() const;
|
||||
double get_oldest_time() const;
|
||||
const PStatFrameData &get_frame_at_time(double time) const;
|
||||
int get_frame_number_at_time(double time, int hint = -1) const;
|
||||
|
||||
const PStatFrameData &get_latest_frame() const;
|
||||
|
||||
bool get_elapsed_frames(int &then_i, int &now_i) const;
|
||||
PN_stdfloat get_frame_rate() const;
|
||||
double get_frame_rate() const;
|
||||
|
||||
|
||||
void set_history(PN_stdfloat time);
|
||||
PN_stdfloat get_history() const;
|
||||
void set_history(double time);
|
||||
double get_history() const;
|
||||
|
||||
void record_new_frame(int frame_number, PStatFrameData *frame_data);
|
||||
|
||||
|
|
@ -72,7 +72,7 @@ private:
|
|||
typedef pdeque<PStatFrameData *> Frames;
|
||||
Frames _frames;
|
||||
int _first_frame_number;
|
||||
PN_stdfloat _history;
|
||||
double _history;
|
||||
|
||||
bool _computed_elapsed_frames;
|
||||
bool _got_elapsed_frames;
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ set_to_frame(int frame_number) {
|
|||
// set_to_frame.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void PStatView::
|
||||
set_to_time(PN_stdfloat time) {
|
||||
set_to_time(double time) {
|
||||
set_to_frame(_thread_data->get_frame_at_time(time));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ public:
|
|||
_pushed = false;
|
||||
_net_time = 0.0;
|
||||
}
|
||||
void data_point(PN_stdfloat time, bool is_start, Started &started) {
|
||||
void data_point(double time, bool is_start, Started &started) {
|
||||
_touched = true;
|
||||
|
||||
// We only consider events that change the start/stop state.
|
||||
|
|
@ -80,7 +80,7 @@ public:
|
|||
}
|
||||
}
|
||||
}
|
||||
void push(PN_stdfloat time) {
|
||||
void push(double time) {
|
||||
if (!_pushed) {
|
||||
_pushed = true;
|
||||
if (_is_started) {
|
||||
|
|
@ -88,7 +88,7 @@ public:
|
|||
}
|
||||
}
|
||||
}
|
||||
void pop(PN_stdfloat time) {
|
||||
void pop(double time) {
|
||||
if (_pushed) {
|
||||
_pushed = false;
|
||||
if (_is_started) {
|
||||
|
|
@ -97,14 +97,14 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void push_all(PN_stdfloat time, Started &started) {
|
||||
void push_all(double time, Started &started) {
|
||||
Started::iterator si;
|
||||
for (si = started.begin(); si != started.end(); ++si) {
|
||||
(*si)->push(time);
|
||||
}
|
||||
}
|
||||
|
||||
void pop_one(PN_stdfloat time, Started &started) {
|
||||
void pop_one(double time, Started &started) {
|
||||
Started::reverse_iterator si;
|
||||
for (si = started.rbegin(); si != started.rend(); ++si) {
|
||||
if ((*si)->_pushed) {
|
||||
|
|
@ -117,7 +117,7 @@ public:
|
|||
bool _touched;
|
||||
bool _is_started;
|
||||
bool _pushed;
|
||||
PN_stdfloat _net_time;
|
||||
double _net_time;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -246,9 +246,9 @@ all_collectors_known() const {
|
|||
// is the sum of all of the individual levels'
|
||||
// get_net_value() value.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
PN_stdfloat PStatView::
|
||||
double PStatView::
|
||||
get_net_value() const {
|
||||
PN_stdfloat net = 0.0;
|
||||
double net = 0.0;
|
||||
Levels::const_iterator li;
|
||||
for (li = _levels.begin(); li != _levels.end(); ++li) {
|
||||
net += (*li).second->_value_alone;
|
||||
|
|
@ -437,14 +437,14 @@ update_level_data(const PStatFrameData &frame_data) {
|
|||
|
||||
|
||||
// This tracks the set of level values we got.
|
||||
typedef pmap<int, PN_stdfloat> GotValues;
|
||||
typedef pmap<int, double> GotValues;
|
||||
GotValues net_values;
|
||||
|
||||
int i;
|
||||
int num_levels = frame_data.get_num_levels();
|
||||
for (i = 0; i < num_levels; i++) {
|
||||
int collector_index = frame_data.get_level_collector(i);
|
||||
PN_stdfloat value = frame_data.get_level(i);
|
||||
double value = frame_data.get_level(i);
|
||||
|
||||
if (!_client_data->has_collector(collector_index)) {
|
||||
_all_collectors_known = false;
|
||||
|
|
@ -465,7 +465,7 @@ update_level_data(const PStatFrameData &frame_data) {
|
|||
GotValues::iterator gi;
|
||||
for (gi = net_values.begin(); gi != net_values.end(); ++gi) {
|
||||
int collector_index = (*gi).first;
|
||||
PN_stdfloat value = (*gi).second;
|
||||
double value = (*gi).second;
|
||||
|
||||
// Walk up to the top, but stop when we find a parent with actual
|
||||
// data.
|
||||
|
|
|
|||
|
|
@ -45,10 +45,10 @@ public:
|
|||
|
||||
void set_to_frame(const PStatFrameData &frame_data);
|
||||
INLINE void set_to_frame(int frame_number);
|
||||
INLINE void set_to_time(PN_stdfloat time);
|
||||
INLINE void set_to_time(double time);
|
||||
|
||||
bool all_collectors_known() const;
|
||||
PN_stdfloat get_net_value() const;
|
||||
double get_net_value() const;
|
||||
|
||||
const PStatViewLevel *get_top_level();
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ get_collector() const {
|
|||
// for this Collector, not including any values
|
||||
// accounted for by its child Collectors.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE PN_stdfloat PStatViewLevel::
|
||||
INLINE double PStatViewLevel::
|
||||
get_value_alone() const {
|
||||
return _value_alone;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,9 +27,9 @@
|
|||
// represented by this Collector, including all values
|
||||
// in its child Collectors.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
PN_stdfloat PStatViewLevel::
|
||||
double PStatViewLevel::
|
||||
get_net_value() const {
|
||||
PN_stdfloat net = _value_alone;
|
||||
double net = _value_alone;
|
||||
|
||||
Children::const_iterator ci;
|
||||
for (ci = _children.begin(); ci != _children.end(); ++ci) {
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ class PStatClientData;
|
|||
class PStatViewLevel {
|
||||
public:
|
||||
INLINE int get_collector() const;
|
||||
INLINE PN_stdfloat get_value_alone() const;
|
||||
PN_stdfloat get_net_value() const;
|
||||
INLINE double get_value_alone() const;
|
||||
double get_net_value() const;
|
||||
|
||||
void sort_children(const PStatClientData *client_data);
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ public:
|
|||
|
||||
private:
|
||||
int _collector;
|
||||
PN_stdfloat _value_alone;
|
||||
double _value_alone;
|
||||
PStatViewLevel *_parent;
|
||||
|
||||
typedef pvector<PStatViewLevel *> Children;
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ set_time_units(int unit_mask) {
|
|||
// speed for the graph to the indicated value.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void WinStatsGraph::
|
||||
set_scroll_speed(PN_stdfloat scroll_speed) {
|
||||
set_scroll_speed(double scroll_speed) {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ public:
|
|||
virtual void changed_graph_size(int graph_xsize, int graph_ysize);
|
||||
|
||||
virtual void set_time_units(int unit_mask);
|
||||
virtual void set_scroll_speed(PN_stdfloat scroll_speed);
|
||||
virtual void set_scroll_speed(double scroll_speed);
|
||||
void set_pause(bool pause);
|
||||
|
||||
void user_guide_bars_changed();
|
||||
|
|
@ -109,7 +109,7 @@ protected:
|
|||
DragMode _drag_mode;
|
||||
DragMode _potential_drag_mode;
|
||||
int _drag_start_x, _drag_start_y;
|
||||
PN_stdfloat _drag_scale_start;
|
||||
double _drag_scale_start;
|
||||
int _drag_guide_bar;
|
||||
|
||||
bool _pause;
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ WinStatsLabel(WinStatsMonitor *monitor, WinStatsGraph *graph,
|
|||
_bg_brush = CreateSolidBrush(RGB(r, g, b));
|
||||
|
||||
// Should our foreground be black or white?
|
||||
PN_stdfloat bright =
|
||||
double bright =
|
||||
rgb[0] * 0.299 +
|
||||
rgb[1] * 0.587 +
|
||||
rgb[2] * 0.114;
|
||||
|
|
|
|||
|
|
@ -243,7 +243,7 @@ idle() {
|
|||
|
||||
// Update the frame rate label from the main thread (thread 0).
|
||||
const PStatThreadData *thread_data = get_client_data()->get_thread_data(0);
|
||||
PN_stdfloat frame_rate = thread_data->get_frame_rate();
|
||||
double frame_rate = thread_data->get_frame_rate();
|
||||
if (frame_rate != 0.0f) {
|
||||
char buffer[128];
|
||||
sprintf(buffer, "%0.1f ms / %0.1f Hz", 1000.0f / frame_rate, frame_rate);
|
||||
|
|
@ -406,7 +406,7 @@ set_time_units(int unit_mask) {
|
|||
// speeds for all graphs to the indicated value.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void WinStatsMonitor::
|
||||
set_scroll_speed(PN_stdfloat scroll_speed) {
|
||||
set_scroll_speed(double scroll_speed) {
|
||||
_scroll_speed = scroll_speed;
|
||||
|
||||
// First, change all of the open graphs appropriately.
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ public:
|
|||
int get_menu_id(const MenuDef &menu_def);
|
||||
|
||||
void set_time_units(int unit_mask);
|
||||
void set_scroll_speed(PN_stdfloat scroll_speed);
|
||||
void set_scroll_speed(double scroll_speed);
|
||||
void set_pause(bool pause);
|
||||
|
||||
private:
|
||||
|
|
@ -106,7 +106,7 @@ private:
|
|||
HMENU _speed_menu;
|
||||
string _window_title;
|
||||
int _time_units;
|
||||
PN_stdfloat _scroll_speed;
|
||||
double _scroll_speed;
|
||||
bool _pause;
|
||||
|
||||
static bool _window_class_registered;
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ clicked_label(int collector_index) {
|
|||
// horizontal axis represents. This may force a redraw.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void WinStatsPianoRoll::
|
||||
set_horizontal_scale(PN_stdfloat time_width) {
|
||||
set_horizontal_scale(double time_width) {
|
||||
PStatPianoRoll::set_horizontal_scale(time_width);
|
||||
|
||||
RECT rect;
|
||||
|
|
@ -287,7 +287,7 @@ graph_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
|
|||
|
||||
if (_drag_mode == DM_scale) {
|
||||
PN_int16 x = LOWORD(lparam);
|
||||
PN_stdfloat ratio = (PN_stdfloat)x / (PN_stdfloat)get_xsize();
|
||||
double ratio = (double)x / (double)get_xsize();
|
||||
if (ratio > 0.0f) {
|
||||
set_horizontal_scale(_drag_scale_start / ratio);
|
||||
}
|
||||
|
|
@ -412,8 +412,8 @@ consider_drag_start(int mouse_x, int mouse_y, int width, int height) {
|
|||
if (mouse_x >= _graph_left && mouse_x < _graph_left + get_xsize()) {
|
||||
// See if the mouse is over a user-defined guide bar.
|
||||
int x = mouse_x - _graph_left;
|
||||
PN_stdfloat from_height = pixel_to_height(x - 2);
|
||||
PN_stdfloat to_height = pixel_to_height(x + 2);
|
||||
double from_height = pixel_to_height(x - 2);
|
||||
double to_height = pixel_to_height(x + 2);
|
||||
_drag_guide_bar = find_user_guide_bar(from_height, to_height);
|
||||
if (_drag_guide_bar >= 0) {
|
||||
return DM_guide_bar;
|
||||
|
|
@ -527,8 +527,8 @@ draw_guide_label(HDC hdc, int y, const PStatGraph::GuideBar &bar) {
|
|||
GetTextExtentPoint32(hdc, label.data(), label.length(), &size);
|
||||
|
||||
if (bar._style != GBS_user) {
|
||||
PN_stdfloat from_height = pixel_to_height(x - size.cx);
|
||||
PN_stdfloat to_height = pixel_to_height(x + size.cx);
|
||||
double from_height = pixel_to_height(x - size.cx);
|
||||
double to_height = pixel_to_height(x + size.cx);
|
||||
if (find_user_guide_bar(from_height, to_height) >= 0) {
|
||||
// Omit the label: there's a user-defined guide bar in the same space.
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public:
|
|||
|
||||
virtual void set_time_units(int unit_mask);
|
||||
virtual void clicked_label(int collector_index);
|
||||
void set_horizontal_scale(PN_stdfloat time_width);
|
||||
void set_horizontal_scale(double time_width);
|
||||
|
||||
protected:
|
||||
void clear_region();
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ set_time_units(int unit_mask) {
|
|||
// speed for the graph to the indicated value.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void WinStatsStripChart::
|
||||
set_scroll_speed(PN_stdfloat scroll_speed) {
|
||||
set_scroll_speed(double scroll_speed) {
|
||||
// The speed factor indicates chart widths per minute.
|
||||
if (scroll_speed != 0.0f) {
|
||||
set_horizontal_scale(60.0f / scroll_speed);
|
||||
|
|
@ -226,7 +226,7 @@ clicked_label(int collector_index) {
|
|||
// represents. This may force a redraw.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void WinStatsStripChart::
|
||||
set_vertical_scale(PN_stdfloat value_height) {
|
||||
set_vertical_scale(double value_height) {
|
||||
PStatStripChart::set_vertical_scale(value_height);
|
||||
|
||||
RECT rect;
|
||||
|
|
@ -301,7 +301,7 @@ draw_slice(int x, int w, const PStatStripChart::FrameData &fdata) {
|
|||
RECT rect = { x, 0, x + w, get_ysize() };
|
||||
FillRect(_bitmap_dc, &rect, (HBRUSH)GetStockObject(WHITE_BRUSH));
|
||||
|
||||
PN_stdfloat overall_time = 0.0;
|
||||
double overall_time = 0.0;
|
||||
int y = get_ysize();
|
||||
|
||||
FrameData::const_iterator fi;
|
||||
|
|
@ -456,7 +456,7 @@ graph_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
|
|||
|
||||
if (_drag_mode == DM_scale) {
|
||||
PN_int16 y = HIWORD(lparam);
|
||||
PN_stdfloat ratio = 1.0f - ((PN_stdfloat)y / (PN_stdfloat)get_ysize());
|
||||
double ratio = 1.0f - ((double)y / (double)get_ysize());
|
||||
if (ratio > 0.0f) {
|
||||
set_vertical_scale(_drag_scale_start / ratio);
|
||||
}
|
||||
|
|
@ -601,8 +601,8 @@ consider_drag_start(int mouse_x, int mouse_y, int width, int height) {
|
|||
if (mouse_y >= _graph_top && mouse_y < _graph_top + get_ysize()) {
|
||||
// See if the mouse is over a user-defined guide bar.
|
||||
int y = mouse_y - _graph_top;
|
||||
PN_stdfloat from_height = pixel_to_height(y + 2);
|
||||
PN_stdfloat to_height = pixel_to_height(y - 2);
|
||||
double from_height = pixel_to_height(y + 2);
|
||||
double to_height = pixel_to_height(y - 2);
|
||||
_drag_guide_bar = find_user_guide_bar(from_height, to_height);
|
||||
if (_drag_guide_bar >= 0) {
|
||||
return DM_guide_bar;
|
||||
|
|
@ -725,8 +725,8 @@ draw_guide_label(HDC hdc, int x, const PStatGraph::GuideBar &bar, int last_y) {
|
|||
GetTextExtentPoint32(hdc, label.data(), label.length(), &size);
|
||||
|
||||
if (bar._style != GBS_user) {
|
||||
PN_stdfloat from_height = pixel_to_height(y + size.cy);
|
||||
PN_stdfloat to_height = pixel_to_height(y - size.cy);
|
||||
double from_height = pixel_to_height(y + size.cy);
|
||||
double to_height = pixel_to_height(y - size.cy);
|
||||
if (find_user_guide_bar(from_height, to_height) >= 0) {
|
||||
// Omit the label: there's a user-defined guide bar in the same space.
|
||||
return last_y;
|
||||
|
|
|
|||
|
|
@ -41,9 +41,9 @@ public:
|
|||
virtual void changed_graph_size(int graph_xsize, int graph_ysize);
|
||||
|
||||
virtual void set_time_units(int unit_mask);
|
||||
virtual void set_scroll_speed(PN_stdfloat scroll_speed);
|
||||
virtual void set_scroll_speed(double scroll_speed);
|
||||
virtual void clicked_label(int collector_index);
|
||||
void set_vertical_scale(PN_stdfloat value_height);
|
||||
void set_vertical_scale(double value_height);
|
||||
|
||||
protected:
|
||||
virtual void update_labels();
|
||||
|
|
|
|||
Loading…
Reference in New Issue