Re: [PATCH] d3drm/tests: Add tests for IDirect3DRM*::LoadTexture (try 5).
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Am 2015-12-27 um 10:23 schrieb Aaryaman Vasishta:
+ if (info_header.biWidth % 4 != 0) + expected = (info_header.biWidth & ~0x03) + 4; + else + expected = info_header.biWidth; This is more complicated than it needs to be:
expected = (info_header.biWidth + 3) & ~3 should work as well.
+ k++; + /* Take into account padded bytes after every row for odd widths */ + if ((w % 2 == 1) && (j == w - 1)) + k = (k & ~0x03) + 4; Wouldn't this also apply for e.g. a width of 10 that is a multiple of 2, but not a multiple of 4?
The canonical way is to advance bytes_per_line bytes every line, e.g. buffer1[i * bytes_per_line + j] Or do k += bytes_per_line in the outer loop and then just do buffer1[k + j] to avoid re-doing the multiplication every time. I'd expect the compiler to optimize it anyway though. Other than that the patch looks good :-) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJWhnqDAAoJEN0/YqbEcdMwiLYP/1eERxdjpnqfm2CX3dPF4wmx 3BQjdvH8LLxlS9HNG9PcGXs6gnyhPtsXL3DTSJtsl6UnHn7Ws9EWrjNFrnLEkoDB K7JwHNCPBvuOGb4YHDo4+9NeIXn3Kg6r3yorPGEu0NvWO98FcbhTJWbfhPq4y0uD WvQSCUcqufusFRUFUlOAks5zUXEmEVimxtMgaAYMqul3rsD22pT9CIOPd7Pxp+tc 6AzROoxTA0OoyMpH33APRKCLSwXET6KsMsrV7V83DblE5T9GrIz1ufRYQ155yUpe 3sBG9cGtPJ9KgjEdwp2Gy4hSFOSNVZJauNG3NhYf55cpngnYGU2W7Om9hkGQ6lOF IkjlBDWdKTX6WpC3Yiitw8DfNtRy7S1syEfhkqscYEiDRKYKILHB/njrbdj8q3so SRGAO/g8WSltCfUzlPHU3Jjmb/QjHl6JUV7JkqmJkrmqtd5mrOqPO+YFlDVCwtKl 79DWf5gbF7MbDBQQ82pBy30dy7+a4W9/cmls8x6EeZVr9zBvojfnxbR9xgy7tAVp EWaSUvUJWIoTTxMh4KEbVrH2LxJcEKGocHdXL22h5pMvpk02oCoj8nx1hUtHqMTW mvfYJDGV/DKiaYoSxUjuLqiB1wtNzg4BQcDNCzojRWQD4xS/yHC22rV9/4jG/+b4 F11LmyZfBxp83t+SpGjk =BnPO -----END PGP SIGNATURE-----
On Fri, Jan 1, 2016 at 6:39 PM, Stefan Dösinger <stefandoesinger(a)gmail.com> wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
Am 2015-12-27 um 10:23 schrieb Aaryaman Vasishta:
+ if (info_header.biWidth % 4 != 0) + expected = (info_header.biWidth & ~0x03) + 4; + else + expected = info_header.biWidth; This is more complicated than it needs to be:
expected = (info_header.biWidth + 3) & ~3
should work as well.
Much better solution :) I've sent try 6 with the changes. Cheers, Aaryaman
participants (2)
-
Aaryaman Vasishta -
Stefan Dösinger