MCPcopy Create free account
hub / github.com/KLayout/klayout / perform_task

Method perform_task

src/laybasic/laybasic/layRedrawThreadWorker.cc:183–634  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181}
182
183void
184RedrawThreadWorker::perform_task (tl::Task *task)
185{
186 RedrawThreadTask *redraw_thread_task = dynamic_cast <RedrawThreadTask *> (task);
187 if (! redraw_thread_task) {
188 return;
189 }
190
191 m_cell_cache.clear ();
192 m_mi_cache.clear ();
193 m_mi_text_cache.clear ();
194
195 m_from_level = m_from_level_default;
196 m_to_level = m_to_level_default;
197
198 int task_id = redraw_thread_task->id ();
199
200 if (task_id >= 0) {
201
202 // draw a layer
203
204 // HINT: the order in which the planes are delivered (the index stored in the first member of the pair below)
205 // must correspond with the order by which the ViewOp's are created inside LayoutView::set_view_ops
206 m_buffers.clear ();
207 for (unsigned int i = 0; i < (unsigned int) planes_per_layer / 3; ++i) {
208
209 // context level planes
210 unsigned int i1 = task_id * (planes_per_layer / 3) + special_planes_before + i;
211 mp_canvas->initialize_plane (m_planes[i], i1);
212 m_buffers.push_back (std::make_pair (i1, m_planes [i]));
213
214 // child level planes (if used)
215 unsigned int i2 = (task_id + m_nlayers) * (planes_per_layer / 3) + special_planes_before + i;
216 mp_canvas->initialize_plane (m_planes [i + planes_per_layer / 3], i2);
217 m_buffers.push_back (std::make_pair (i2, m_planes [i + planes_per_layer / 3]));
218
219 // current level planes
220 unsigned int i3 = (task_id + m_nlayers * 2) * (planes_per_layer / 3) + special_planes_before + i;
221 mp_canvas->initialize_plane (m_planes [i + 2 * (planes_per_layer / 3)], i3);
222 m_buffers.push_back (std::make_pair (i3, m_planes [i + 2 * (planes_per_layer / 3)]));
223
224 }
225
226 // detect whether the text planes are empty. If not, the whole text plane must be redrawn to account for clipped texts
227 bool text_planes_empty = true;
228 for (unsigned int i = 0; i < (unsigned int) planes_per_layer && text_planes_empty; i += (unsigned int) planes_per_layer / 3) {
229 lay::Bitmap *text = dynamic_cast<lay::Bitmap *> (m_planes[i + 2]);
230 if (text && ! text->empty ()) {
231 text_planes_empty = false;
232 }
233 }
234
235 std::vector<db::Box> text_redraw_regions = m_redraw_region;
236 if (! text_planes_empty) {
237 // if there are non-empty text planes, redraw the whole area for texts
238 text_redraw_regions.clear ();
239 text_redraw_regions.push_back(db::Box(0, 0, mp_canvas->canvas_width (), mp_canvas->canvas_height ()));
240 for (unsigned int i = 0; i < (unsigned int) planes_per_layer; i += (unsigned int) planes_per_layer / 3) {

Callers

nothing calls this directly

Calls 15

verbosityFunction · 0.85
initialize_planeMethod · 0.80
canvas_widthMethod · 0.80
canvas_heightMethod · 0.80
managerMethod · 0.80
get_propertiesMethod · 0.80
set_xfillMethod · 0.80
default_text_sizeMethod · 0.80
apply_text_trans_modeMethod · 0.80
guiding_shape_layerMethod · 0.80
error_layerMethod · 0.80
create_drawing_planeMethod · 0.80

Tested by

no test coverage detected