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

Method prepare

src/laybasic/laybasic/layRedrawThreadCanvas.cc:244–321  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

242}
243
244void
245BitmapRedrawThreadCanvas::prepare (unsigned int nlayers, unsigned int width, unsigned int height, double resolution, double font_resolution, const db::Vector *shift_vector, const std::vector<int> *planes, const lay::Drawings *drawings)
246{
247 RedrawThreadCanvas::prepare (nlayers, width, height, resolution, font_resolution, shift_vector, planes, drawings);
248
249 lock ();
250
251 if (shift_vector) {
252
253 tl_assert (width == m_width);
254 tl_assert (height == m_height);
255 tl_assert (nlayers == mp_plane_buffers.size ());
256
257 for (size_t i = 0; i < mp_plane_buffers.size (); ++i) {
258 lay::Bitmap *from = mp_plane_buffers [i];
259 lay::Bitmap *to = mp_plane_buffers [i] = new lay::Bitmap (width, height, resolution, font_resolution);
260 shift_bitmap (from, to, shift_vector->x (), shift_vector->y ());
261 delete from;
262 }
263
264 size_t di = 0;
265 for (lay::Drawings::const_iterator d = drawings->begin (); d != drawings->end (); ++d, ++di) {
266 for (unsigned int i = 0; i < d->num_planes (); ++i) {
267 lay::Bitmap *from = mp_drawing_plane_buffers[di][i];
268 lay::Bitmap *to = mp_drawing_plane_buffers[di][i] = new lay::Bitmap (width, height, resolution, font_resolution);
269 shift_bitmap (from, to, shift_vector->x (), shift_vector->y ());
270 delete from;
271 }
272 }
273
274 } else if (planes) {
275
276 tl_assert (width == m_width);
277 tl_assert (height == m_height);
278
279 for (std::vector<int>::const_iterator l = planes->begin (); l != planes->end (); ++l) {
280
281 if (*l < 0) {
282
283 // clear the custom drawing planes
284 unsigned int di = 0;
285 for (lay::Drawings::const_iterator d = drawings->begin (); d != drawings->end (); ++d, ++di) {
286 for (unsigned int i = 0; i < d->num_planes (); ++i) {
287 if (mp_drawing_plane_buffers.size () > di && mp_drawing_plane_buffers[di].size () > i) {
288 mp_drawing_plane_buffers[di][i]->clear ();
289 }
290 }
291 }
292
293 } else if (size_t (*l) < mp_plane_buffers.size ()) {
294 mp_plane_buffers[*l]->clear ();
295 }
296
297 }
298
299 } else {
300
301 m_width = width;

Callers 1

do_startMethod · 0.45

Calls 11

lockFunction · 0.85
shift_bitmapFunction · 0.85
unlockFunction · 0.85
yMethod · 0.80
sizeMethod · 0.45
xMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
clearMethod · 0.45
push_backMethod · 0.45
backMethod · 0.45

Tested by

no test coverage detected