MIST (Media Integration Standard Toolkit)
Revision | 07d97e02cd857cf638d1ffdbc10485a8ba3c8c62 (tree) |
---|---|
Time | 2008-10-15 20:58:33 |
Author | Daisuke Deguchi <ddeguchi@nago...> |
Commiter | Daisuke Deguchi |
[1158]の画像トリミング時に入力と同じ画像サイズを指定すると画像が空になるバグ修正をマージ.
@@ -203,6 +203,7 @@ public: | ||
203 | 203 | } |
204 | 204 | else if( num_ == num ) |
205 | 205 | { |
206 | + out = *this; | |
206 | 207 | return( true ); |
207 | 208 | } |
208 | 209 |
@@ -242,17 +243,29 @@ public: | ||
242 | 243 | } |
243 | 244 | else |
244 | 245 | { |
245 | - array o( num ); | |
246 | - | |
247 | - if( this->trim( o, index, num ) ) | |
246 | + difference_type num_ = size( ); | |
247 | + if( num_ <= static_cast< difference_type >( index ) || num_ < static_cast< difference_type >( index + num ) ) | |
248 | + { | |
249 | + return( false ); | |
250 | + } | |
251 | + else if( num_ == num ) | |
248 | 252 | { |
249 | - swap( o ); | |
250 | - | |
251 | 253 | return( true ); |
252 | 254 | } |
253 | 255 | else |
254 | 256 | { |
255 | - return( false ); | |
257 | + array o( num ); | |
258 | + | |
259 | + if( this->trim( o, index, num ) ) | |
260 | + { | |
261 | + swap( o ); | |
262 | + | |
263 | + return( true ); | |
264 | + } | |
265 | + else | |
266 | + { | |
267 | + return( false ); | |
268 | + } | |
256 | 269 | } |
257 | 270 | } |
258 | 271 | } |
@@ -1098,6 +1111,7 @@ public: | ||
1098 | 1111 | } |
1099 | 1112 | else if( w_ == w && h_ == h ) |
1100 | 1113 | { |
1114 | + out = *this; | |
1101 | 1115 | return( true ); |
1102 | 1116 | } |
1103 | 1117 |
@@ -1150,17 +1164,35 @@ public: | ||
1150 | 1164 | } |
1151 | 1165 | else |
1152 | 1166 | { |
1153 | - array2 o; | |
1167 | + difference_type w_ = this->width( ); | |
1168 | + difference_type h_ = this->width( ); | |
1154 | 1169 | |
1155 | - if( this->trim( o, x, y, w, h ) ) | |
1170 | + if( w_ <= static_cast< difference_type >( x ) || w_ < static_cast< difference_type >( x + w ) ) | |
1171 | + { | |
1172 | + return( false ); | |
1173 | + } | |
1174 | + else if( h_ <= static_cast< difference_type >( y ) || h_ < static_cast< difference_type >( y + h ) ) | |
1175 | + { | |
1176 | + return( false ); | |
1177 | + } | |
1178 | + else if( w_ == w && h_ == h ) | |
1156 | 1179 | { |
1157 | - swap( o ); | |
1158 | - | |
1159 | 1180 | return( true ); |
1160 | 1181 | } |
1161 | 1182 | else |
1162 | 1183 | { |
1163 | - return( false ); | |
1184 | + array2 o; | |
1185 | + | |
1186 | + if( this->trim( o, x, y, w, h ) ) | |
1187 | + { | |
1188 | + swap( o ); | |
1189 | + | |
1190 | + return( true ); | |
1191 | + } | |
1192 | + else | |
1193 | + { | |
1194 | + return( false ); | |
1195 | + } | |
1164 | 1196 | } |
1165 | 1197 | } |
1166 | 1198 | } |
@@ -1705,6 +1737,7 @@ public: | ||
1705 | 1737 | } |
1706 | 1738 | else if( w_ == w && h_ == h && d_ == d ) |
1707 | 1739 | { |
1740 | + out = *this; | |
1708 | 1741 | return( true ); |
1709 | 1742 | } |
1710 | 1743 |
@@ -1771,17 +1804,39 @@ public: | ||
1771 | 1804 | } |
1772 | 1805 | else |
1773 | 1806 | { |
1774 | - array3 o; | |
1775 | - | |
1776 | - if( this->trim( o, x, y, z, w, h, d ) ) | |
1807 | + difference_type w_ = this->width( ); | |
1808 | + difference_type h_ = this->width( ); | |
1809 | + difference_type d_ = this->depth( ); | |
1810 | + if( w_ <= static_cast< difference_type >( x ) || w_ < static_cast< difference_type >( x + w ) ) | |
1811 | + { | |
1812 | + return( false ); | |
1813 | + } | |
1814 | + else if( h_ <= static_cast< difference_type >( y ) || h_ < static_cast< difference_type >( y + h ) ) | |
1815 | + { | |
1816 | + return( false ); | |
1817 | + } | |
1818 | + else if( d_ <= static_cast< difference_type >( z ) || d_ < static_cast< difference_type >( z + d ) ) | |
1819 | + { | |
1820 | + return( false ); | |
1821 | + } | |
1822 | + else if( w_ == w && h_ == h && d_ == d ) | |
1777 | 1823 | { |
1778 | - swap( o ); | |
1779 | - | |
1780 | 1824 | return( true ); |
1781 | 1825 | } |
1782 | 1826 | else |
1783 | 1827 | { |
1784 | - return( false ); | |
1828 | + array3 o; | |
1829 | + | |
1830 | + if( this->trim( o, x, y, z, w, h, d ) ) | |
1831 | + { | |
1832 | + swap( o ); | |
1833 | + | |
1834 | + return( true ); | |
1835 | + } | |
1836 | + else | |
1837 | + { | |
1838 | + return( false ); | |
1839 | + } | |
1785 | 1840 | } |
1786 | 1841 | } |
1787 | 1842 | } |