old mode 100755new mode 100644.. | .. |
---|
359 | 359 | return Math.abs(ar1.toDouble() - ar2.toDouble()) < ASPECT_RATIO_TOLERANCE; |
---|
360 | 360 | } |
---|
361 | 361 | |
---|
| 362 | + public static boolean is16BitAligned(Size size) { |
---|
| 363 | + int width = size.getWidth(); |
---|
| 364 | + int height = size.getHeight(); |
---|
| 365 | + if (((width & 15) == 0) && ((height & 15) == 0)) { |
---|
| 366 | + return true; |
---|
| 367 | + } else { |
---|
| 368 | + return false; |
---|
| 369 | + } |
---|
| 370 | + } |
---|
| 371 | + |
---|
362 | 372 | /** |
---|
363 | 373 | * Selects the maximal resolution for the given desired aspect ratio from all available |
---|
364 | 374 | * resolutions. If no resolution exists for the desired aspect ratio, return a resolution |
---|
.. | .. |
---|
392 | 402 | for (Size size : sizes) { |
---|
393 | 403 | Rational aspectRatio = getAspectRatio(size); |
---|
394 | 404 | // Skip if the aspect ratio is not desired. |
---|
395 | | - if (!hasSameAspectRatio(aspectRatio, desiredAspectRatio)) { |
---|
| 405 | + if (!hasSameAspectRatio(aspectRatio, desiredAspectRatio) || |
---|
| 406 | + !is16BitAligned(size)) { |
---|
396 | 407 | continue; |
---|
397 | 408 | } |
---|
| 409 | + |
---|
398 | 410 | int pixelNum = size.getWidth() * size.getHeight(); |
---|
399 | 411 | if (pixelNum > maxPixelNumWithAspect) { |
---|
400 | 412 | maxPixelNumWithAspect = pixelNum; |
---|