draw main brush preview first if the queue is long
This commit is contained in:
@@ -443,8 +443,8 @@ kEventResult NodePanelBrushPreset::handle_event(Event* e)
|
|||||||
|
|
||||||
void NodePanelBrushPreset::handle_click(Node* target)
|
void NodePanelBrushPreset::handle_click(Node* target)
|
||||||
{
|
{
|
||||||
if (target == m_current)
|
//if (target == m_current)
|
||||||
return;
|
// return;
|
||||||
if (m_current)
|
if (m_current)
|
||||||
m_current->m_selected = false;
|
m_current->m_selected = false;
|
||||||
m_current = (NodeBrushPresetItem*)target;
|
m_current = (NodeBrushPresetItem*)target;
|
||||||
|
|||||||
@@ -428,6 +428,8 @@ void NodePanelStroke::init_controls()
|
|||||||
|
|
||||||
|
|
||||||
m_preview = find<NodeStrokePreview>("canvas");
|
m_preview = find<NodeStrokePreview>("canvas");
|
||||||
|
m_preview->m_draw_first = true;
|
||||||
|
|
||||||
m_blend_mode = find<NodeComboBox>("blend-mode");
|
m_blend_mode = find<NodeComboBox>("blend-mode");
|
||||||
m_blend_mode->on_select = [this](Node*, int index) {
|
m_blend_mode->on_select = [this](Node*, int index) {
|
||||||
Canvas::I->m_current_brush->m_blend_mode = index;
|
Canvas::I->m_current_brush->m_blend_mode = index;
|
||||||
|
|||||||
@@ -509,7 +509,7 @@ void NodeStrokePreview::draw_stroke()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
s_queue.mutex.unlock();
|
s_queue.mutex.unlock();
|
||||||
s_queue.PostUnique(this);
|
s_queue.PostUnique(this, m_draw_first);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeStrokePreview::draw()
|
void NodeStrokePreview::draw()
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ public:
|
|||||||
static void terminate_renderer();
|
static void terminate_renderer();
|
||||||
std::shared_ptr<Brush> m_brush;
|
std::shared_ptr<Brush> m_brush;
|
||||||
std::shared_ptr<Brush> m_dual_brush;
|
std::shared_ptr<Brush> m_dual_brush;
|
||||||
|
bool m_draw_first = false;
|
||||||
Stroke m_stroke;
|
Stroke m_stroke;
|
||||||
Stroke m_dual_stroke;
|
Stroke m_dual_stroke;
|
||||||
std::vector<glm::vec2> m_bez_points;
|
std::vector<glm::vec2> m_bez_points;
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ public:
|
|||||||
q.push_back(pkt);
|
q.push_back(pkt);
|
||||||
get_cv.notify_one();
|
get_cv.notify_one();
|
||||||
}
|
}
|
||||||
void PostUnique(T pkt)
|
void PostUnique(T pkt, bool top)
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> lock(mutex);
|
std::unique_lock<std::mutex> lock(mutex);
|
||||||
if (Max > 0)
|
if (Max > 0)
|
||||||
@@ -182,7 +182,7 @@ public:
|
|||||||
if (q.size() >= Max) return;
|
if (q.size() >= Max) return;
|
||||||
}
|
}
|
||||||
if (std::find(q.begin(), q.end(), pkt) == q.end());
|
if (std::find(q.begin(), q.end(), pkt) == q.end());
|
||||||
q.push_back(pkt);
|
top ? q.push_front(pkt) : q.push_back(pkt);
|
||||||
get_cv.notify_one();
|
get_cv.notify_one();
|
||||||
}
|
}
|
||||||
T Get()
|
T Get()
|
||||||
|
|||||||
Reference in New Issue
Block a user