Skip to content

Commit e634347

Browse files
authored
fix mlss bug (#36)
1 parent 416e309 commit e634347

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

sources/iwrenderinstance.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,11 @@ TPixel64 getMlssPixelVal(TRaster64P srcRas, TRaster64P mlssRefRas,
139139
float right = getFloatFromUShort(mlssVal.g);
140140
// 上ピクセルとのミックス
141141
if (left > 0.5 || right > 0.5) {
142-
if (rv <= lerp(left, right, ru)) return getPixelVal(srcRas, uvIndex);
143-
sampleOffset += QPoint(0, 1);
142+
if (rv > lerp(left, right, ru)) sampleOffset += QPoint(0, 1);
144143
}
145144
// 下ピクセルとのミックス
146145
else {
147-
if (rv >= lerp(left, right, ru)) return getPixelVal(srcRas, uvIndex);
148-
sampleOffset += QPoint(0, -1);
146+
if (rv < lerp(left, right, ru)) sampleOffset += QPoint(0, -1);
149147
}
150148
}
151149
// 左右方向のサンプル(上下の切片)
@@ -154,13 +152,11 @@ TPixel64 getMlssPixelVal(TRaster64P srcRas, TRaster64P mlssRefRas,
154152
float top = getFloatFromUShort(mlssVal.m);
155153
// 右ピクセルとのミックス
156154
if (bottom > 0.5 || top > 0.5) {
157-
if (ru <= lerp(bottom, top, rv)) return getPixelVal(srcRas, uvIndex);
158-
sampleOffset += QPoint(1, 0);
155+
if (ru > lerp(bottom, top, rv)) sampleOffset += QPoint(1, 0);
159156
}
160157
// 左ピクセルとのミックス
161158
else {
162-
if (ru >= lerp(bottom, top, rv)) return getPixelVal(srcRas, uvIndex);
163-
sampleOffset += QPoint(-1, 0);
159+
if (ru < lerp(bottom, top, rv)) sampleOffset += QPoint(-1, 0);
164160
}
165161
}
166162

0 commit comments

Comments
 (0)