mirror of
https://github.com/DreamSourceLab/DSView.git
synced 2026-07-28 04:45:30 +00:00
Merge branch 'master' of https://github.com/dreamsourcelab/DSView into dev-2.0
This commit is contained in:
@@ -36,7 +36,7 @@ std::mutex RowData::_global_visitor_mutex;
|
||||
|
||||
RowData::RowData() :
|
||||
_max_annotation(0),
|
||||
_min_annotation(UINT64_MAX)
|
||||
_min_annotation(0)
|
||||
{
|
||||
_item_count = 0;
|
||||
}
|
||||
@@ -56,6 +56,7 @@ void RowData::clear()
|
||||
}
|
||||
_annotations.clear();
|
||||
_item_count = 0;
|
||||
_min_annotation = 0;
|
||||
}
|
||||
|
||||
uint64_t RowData::get_max_sample()
|
||||
@@ -74,7 +75,7 @@ uint64_t RowData::get_max_annotation()
|
||||
|
||||
uint64_t RowData::get_min_annotation()
|
||||
{
|
||||
if (_min_annotation == UINT64_MAX)
|
||||
if (_min_annotation == 0)
|
||||
return 10;
|
||||
else
|
||||
return _min_annotation;
|
||||
@@ -119,8 +120,14 @@ bool RowData::push_annotation(Annotation *a)
|
||||
_item_count = _annotations.size();
|
||||
_max_annotation = max(_max_annotation, a->end_sample() - a->start_sample());
|
||||
|
||||
if (a->end_sample() != a->start_sample())
|
||||
_min_annotation = min(_min_annotation, a->end_sample() - a->start_sample());
|
||||
if (a->end_sample() != a->start_sample()){
|
||||
if (_min_annotation == 0){
|
||||
_min_annotation = a->end_sample() - a->start_sample();
|
||||
}
|
||||
else{
|
||||
_min_annotation = min(_min_annotation, a->end_sample() - a->start_sample());
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
|
||||
@@ -32,9 +32,7 @@
|
||||
#include <QDialogButtonBox>
|
||||
#include <QScrollArea>
|
||||
#include <QApplication>
|
||||
|
||||
#include "decodetrace.h"
|
||||
|
||||
#include "../sigsession.h"
|
||||
#include "../data/decoderstack.h"
|
||||
#include "../data/decode/decoder.h"
|
||||
@@ -53,6 +51,7 @@
|
||||
#include "../dialogs/decoderoptionsdlg.h"
|
||||
#include "../ui/langresource.h"
|
||||
#include "../config/appconfig.h"
|
||||
#include "../log.h"
|
||||
|
||||
using namespace boost;
|
||||
using namespace std;
|
||||
@@ -281,22 +280,27 @@ void DecodeTrace::paint_mid(QPainter &p, int left, int right, QColor fore, QColo
|
||||
const double max_annWidth = max_annotation / samples_per_pixel;
|
||||
|
||||
if ((max_annWidth > 100) ||
|
||||
(max_annWidth > 10 && min_annWidth > 1) ||
|
||||
(max_annWidth > 10 && (min_annWidth > 1 || samples_per_pixel < 50)) ||
|
||||
(max_annWidth == 0 && samples_per_pixel < 10)) {
|
||||
std::vector<Annotation*> annotations;
|
||||
_decoder_stack->get_annotation_subset(annotations, row,
|
||||
start_sample, end_sample);
|
||||
|
||||
if (!annotations.empty()) {
|
||||
for(Annotation *a : annotations)
|
||||
double last_x = -1;
|
||||
|
||||
for(Annotation *a : annotations){
|
||||
draw_annotation(*a, p, get_text_colour(),
|
||||
annotation_height, left, right,
|
||||
samples_per_pixel, pixels_offset, y,
|
||||
0, min_annWidth, fore, back);
|
||||
0, min_annWidth, fore, back, last_x);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
draw_nodetail(p, annotation_height, left, right, y, 0, fore, back);
|
||||
}
|
||||
|
||||
y += annotation_height;
|
||||
_cur_row_headings.push_back(row.title());
|
||||
}
|
||||
@@ -324,7 +328,7 @@ void DecodeTrace::paint_fore(QPainter &p, int left, int right, QColor fore, QCol
|
||||
void DecodeTrace::draw_annotation(const pv::data::decode::Annotation &a,
|
||||
QPainter &p, QColor text_color, int h, int left, int right,
|
||||
double samples_per_pixel, double pixels_offset, int y,
|
||||
size_t base_colour, double min_annWidth, QColor fore, QColor back)
|
||||
size_t base_colour, double min_annWidth, QColor fore, QColor back, double &last_x)
|
||||
{
|
||||
const double start = max(a.start_sample() / samples_per_pixel -
|
||||
pixels_offset, (double)left);
|
||||
@@ -335,8 +339,15 @@ void DecodeTrace::draw_annotation(const pv::data::decode::Annotation &a,
|
||||
const QColor &fill = Colours[colour];
|
||||
const QColor &outline = OutlineColours[colour];
|
||||
|
||||
if (start > right + DrawPadding || end < left - DrawPadding)
|
||||
if (start > right + DrawPadding || end < left - DrawPadding){
|
||||
return;
|
||||
}
|
||||
|
||||
if (end - last_x <= 0.5 && end - start < 1){
|
||||
return;
|
||||
}
|
||||
|
||||
last_x = end;
|
||||
|
||||
if (_decoder_stack->get_mark_index() == (int64_t)(a.start_sample()+ a.end_sample())/2) {
|
||||
p.setPen(View::Blue);
|
||||
|
||||
@@ -149,7 +149,8 @@ private:
|
||||
void draw_annotation(const pv::data::decode::Annotation &a, QPainter &p,
|
||||
QColor text_colour, int text_height, int left, int right,
|
||||
double samples_per_pixel, double pixels_offset, int y,
|
||||
size_t base_colour, double min_annWidth, QColor fore, QColor back);
|
||||
size_t base_colour, double min_annWidth, QColor fore, QColor back, double &last_x);
|
||||
|
||||
void draw_nodetail(QPainter &p,
|
||||
int text_height, int left, int right, int y,
|
||||
size_t base_colour, QColor fore, QColor back);
|
||||
|
||||
Reference in New Issue
Block a user