parent
f65cc5f0d5
commit
54e85db21d
2 changed files with 16 additions and 7 deletions
|
@ -56,16 +56,22 @@ TAffine TAffine::operator*=(const TAffine &b) { return *this = *this * b; }
|
|||
//--------------------------------------------------------------------------------------------------
|
||||
TAffine TAffine::inv() const {
|
||||
if (a12 == 0.0 && a21 == 0.0) {
|
||||
assert(a11 != 0.0);
|
||||
assert(a22 != 0.0);
|
||||
double inv_a11 = 1.0 / a11;
|
||||
double inv_a22 = 1.0 / a22;
|
||||
double inv_a11 =
|
||||
(a11 == 0.0 ? std::numeric_limits<double>::max() / (1 << 16)
|
||||
: 1.0 / a11);
|
||||
double inv_a22 =
|
||||
(a22 == 0.0 ? std::numeric_limits<double>::max() / (1 << 16)
|
||||
: 1.0 / a22);
|
||||
return TAffine(inv_a11, 0, -a13 * inv_a11, 0, inv_a22, -a23 * inv_a22);
|
||||
} else if (a11 == 0.0 && a22 == 0.0) {
|
||||
assert(a12 != 0.0);
|
||||
assert(a21 != 0.0);
|
||||
double inv_a21 = 1.0 / a21;
|
||||
double inv_a12 = 1.0 / a12;
|
||||
double inv_a21 =
|
||||
(a21 == 0.0 ? std::numeric_limits<double>::max() / (1 << 16)
|
||||
: 1.0 / a21);
|
||||
double inv_a12 =
|
||||
(a12 == 0.0 ? std::numeric_limits<double>::max() / (1 << 16)
|
||||
: 1.0 / a12);
|
||||
return TAffine(0, inv_a21, -a23 * inv_a21, inv_a12, 0, -a13 * inv_a12);
|
||||
} else {
|
||||
double d = 1. / det();
|
||||
|
|
|
@ -425,7 +425,10 @@ void Painter::doFlushRasterImages(const TRasterP &rin, int bg,
|
|||
int lx = (m_imageSize.lx == 0 ? _rin->getLx() : m_imageSize.lx);
|
||||
int ly = (m_imageSize.ly == 0 ? _rin->getLy() : m_imageSize.ly);
|
||||
|
||||
TRect rect = convert(aff * TRectD(0, 0, lx - 1, ly - 1));
|
||||
TRect rect = convert(aff * TRectD(0, 0, lx - 1, ly - 1));
|
||||
// Image size is a 0 point. Do nothing
|
||||
if (rect.x0 == rect.x1 && rect.y0 == rect.y1) return;
|
||||
|
||||
TRaster32P raux = ras->extract(rect);
|
||||
raux->fill(bg == 0x40000 ? TPixel::Black : TPixel::White);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue