mirror of https://github.com/KLayout/klayout.git
Fixed issue #1247. Problem was missing cache clean on assignment of stipple pattern and line styles
This commit is contained in:
parent
5952974095
commit
12e34f9282
|
|
@ -462,6 +462,8 @@ static const char *dither_strings [] = {
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
// DitherPatternInfo implementation
|
// DitherPatternInfo implementation
|
||||||
|
|
||||||
|
static tl::Mutex s_mutex;
|
||||||
|
|
||||||
DitherPatternInfo::DitherPatternInfo ()
|
DitherPatternInfo::DitherPatternInfo ()
|
||||||
: m_width (1), m_height (1), m_order_index (0)
|
: m_width (1), m_height (1), m_order_index (0)
|
||||||
{
|
{
|
||||||
|
|
@ -482,23 +484,31 @@ DitherPatternInfo &
|
||||||
DitherPatternInfo::operator= (const DitherPatternInfo &d)
|
DitherPatternInfo::operator= (const DitherPatternInfo &d)
|
||||||
{
|
{
|
||||||
if (&d != this) {
|
if (&d != this) {
|
||||||
|
tl::MutexLocker locker (& s_mutex);
|
||||||
m_order_index = d.m_order_index;
|
assign_no_lock (d);
|
||||||
m_name = d.m_name;
|
|
||||||
m_width = d.m_width;
|
|
||||||
m_pattern_stride = d.m_pattern_stride;
|
|
||||||
m_height = d.m_height;
|
|
||||||
|
|
||||||
for (size_t i = 0; i < sizeof (m_pattern) / sizeof (m_pattern [0]); ++i) {
|
|
||||||
m_pattern [i] = &m_buffer [0] + (d.m_pattern [i] - d.m_buffer);
|
|
||||||
}
|
|
||||||
memcpy (m_buffer, d.m_buffer, sizeof (m_buffer));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
void
|
||||||
|
DitherPatternInfo::assign_no_lock (const DitherPatternInfo &d)
|
||||||
|
{
|
||||||
|
m_scaled_pattern.reset ();
|
||||||
|
|
||||||
|
m_order_index = d.m_order_index;
|
||||||
|
m_name = d.m_name;
|
||||||
|
m_width = d.m_width;
|
||||||
|
m_pattern_stride = d.m_pattern_stride;
|
||||||
|
m_height = d.m_height;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < sizeof (m_pattern) / sizeof (m_pattern [0]); ++i) {
|
||||||
|
m_pattern [i] = &m_buffer [0] + (d.m_pattern [i] - d.m_buffer);
|
||||||
|
}
|
||||||
|
memcpy (m_buffer, d.m_buffer, sizeof (m_buffer));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
DitherPatternInfo::same_bitmap (const DitherPatternInfo &d) const
|
DitherPatternInfo::same_bitmap (const DitherPatternInfo &d) const
|
||||||
{
|
{
|
||||||
if (m_width != d.m_width || m_height != d.m_height) {
|
if (m_width != d.m_width || m_height != d.m_height) {
|
||||||
|
|
@ -597,15 +607,11 @@ DitherPatternInfo::get_bitmap (int width, int height, int frame_width) const
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static tl::Mutex s_mutex;
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DitherPatternInfo::set_pattern (const uint32_t *pt, unsigned int w, unsigned int h)
|
DitherPatternInfo::set_pattern (const uint32_t *pt, unsigned int w, unsigned int h)
|
||||||
{
|
{
|
||||||
{
|
tl::MutexLocker locker (& s_mutex);
|
||||||
tl::MutexLocker locker (& s_mutex);
|
m_scaled_pattern.reset (0);
|
||||||
m_scaled_pattern.reset (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
set_pattern_impl (pt, w, h);
|
set_pattern_impl (pt, w, h);
|
||||||
}
|
}
|
||||||
|
|
@ -669,10 +675,8 @@ DitherPatternInfo::set_pattern_impl (const uint32_t *pt, unsigned int w, unsigne
|
||||||
void
|
void
|
||||||
DitherPatternInfo::set_pattern (const uint64_t *pt, unsigned int w, unsigned int h)
|
DitherPatternInfo::set_pattern (const uint64_t *pt, unsigned int w, unsigned int h)
|
||||||
{
|
{
|
||||||
{
|
tl::MutexLocker locker (& s_mutex);
|
||||||
tl::MutexLocker locker (& s_mutex);
|
m_scaled_pattern.reset (0);
|
||||||
m_scaled_pattern.reset (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
set_pattern_impl (pt, w, h);
|
set_pattern_impl (pt, w, h);
|
||||||
}
|
}
|
||||||
|
|
@ -752,7 +756,7 @@ DitherPatternInfo::scaled (unsigned int n) const
|
||||||
}
|
}
|
||||||
|
|
||||||
DitherPatternInfo &sp = (*m_scaled_pattern) [n];
|
DitherPatternInfo &sp = (*m_scaled_pattern) [n];
|
||||||
sp = *this;
|
sp.assign_no_lock (*this);
|
||||||
sp.scale_pattern (n);
|
sp.scale_pattern (n);
|
||||||
return sp;
|
return sp;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -243,6 +243,7 @@ private:
|
||||||
|
|
||||||
void set_pattern_impl (const uint32_t *pattern, unsigned int w, unsigned int h);
|
void set_pattern_impl (const uint32_t *pattern, unsigned int w, unsigned int h);
|
||||||
void set_pattern_impl (const uint64_t *pattern, unsigned int w, unsigned int h);
|
void set_pattern_impl (const uint64_t *pattern, unsigned int w, unsigned int h);
|
||||||
|
void assign_no_lock (const DitherPatternInfo &other);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,8 @@ static const char *style_strings [] = {
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
// LineStyleInfo implementation
|
// LineStyleInfo implementation
|
||||||
|
|
||||||
|
static tl::Mutex s_mutex;
|
||||||
|
|
||||||
LineStyleInfo::LineStyleInfo ()
|
LineStyleInfo::LineStyleInfo ()
|
||||||
: m_width (0), m_order_index (0)
|
: m_width (0), m_order_index (0)
|
||||||
{
|
{
|
||||||
|
|
@ -92,19 +94,26 @@ LineStyleInfo &
|
||||||
LineStyleInfo::operator= (const LineStyleInfo &d)
|
LineStyleInfo::operator= (const LineStyleInfo &d)
|
||||||
{
|
{
|
||||||
if (&d != this) {
|
if (&d != this) {
|
||||||
|
tl::MutexLocker locker (& s_mutex);
|
||||||
m_order_index = d.m_order_index;
|
assign_no_lock (d);
|
||||||
m_name = d.m_name;
|
|
||||||
m_width = d.m_width;
|
|
||||||
m_pattern_stride = d.m_pattern_stride;
|
|
||||||
|
|
||||||
memcpy (m_pattern, d.m_pattern, sizeof (m_pattern));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
void
|
||||||
|
LineStyleInfo::assign_no_lock (const LineStyleInfo &d)
|
||||||
|
{
|
||||||
|
m_scaled_pattern.reset (0);
|
||||||
|
|
||||||
|
m_order_index = d.m_order_index;
|
||||||
|
m_name = d.m_name;
|
||||||
|
m_width = d.m_width;
|
||||||
|
m_pattern_stride = d.m_pattern_stride;
|
||||||
|
|
||||||
|
memcpy (m_pattern, d.m_pattern, sizeof (m_pattern));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
LineStyleInfo::same_bits (const LineStyleInfo &d) const
|
LineStyleInfo::same_bits (const LineStyleInfo &d) const
|
||||||
{
|
{
|
||||||
if (m_width != d.m_width) {
|
if (m_width != d.m_width) {
|
||||||
|
|
@ -201,15 +210,11 @@ LineStyleInfo::get_bitmap (int width, int height) const
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static tl::Mutex s_mutex;
|
|
||||||
|
|
||||||
void
|
void
|
||||||
LineStyleInfo::set_pattern (uint32_t pt, unsigned int w)
|
LineStyleInfo::set_pattern (uint32_t pt, unsigned int w)
|
||||||
{
|
{
|
||||||
{
|
tl::MutexLocker locker (& s_mutex);
|
||||||
tl::MutexLocker locker (& s_mutex);
|
m_scaled_pattern.reset (0);
|
||||||
m_scaled_pattern.reset (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
memset (m_pattern, 0, sizeof (m_pattern));
|
memset (m_pattern, 0, sizeof (m_pattern));
|
||||||
|
|
||||||
|
|
@ -271,7 +276,7 @@ LineStyleInfo::scaled (unsigned int n) const
|
||||||
}
|
}
|
||||||
|
|
||||||
LineStyleInfo &sp = (*m_scaled_pattern) [n];
|
LineStyleInfo &sp = (*m_scaled_pattern) [n];
|
||||||
sp = *this;
|
sp.assign_no_lock (*this);
|
||||||
sp.scale_pattern (n);
|
sp.scale_pattern (n);
|
||||||
return sp;
|
return sp;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -216,6 +216,8 @@ private:
|
||||||
unsigned int m_order_index;
|
unsigned int m_order_index;
|
||||||
std::string m_name;
|
std::string m_name;
|
||||||
mutable std::unique_ptr<std::map<unsigned int, LineStyleInfo> > m_scaled_pattern;
|
mutable std::unique_ptr<std::map<unsigned int, LineStyleInfo> > m_scaled_pattern;
|
||||||
|
|
||||||
|
void assign_no_lock (const LineStyleInfo &other);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue