浏览代码

Fix depth sanity test in PixelFormat

tags/v1.10.90
Pierre Ossman 4 年前
父节点
当前提交
f1b9b868ec
共有 2 个文件被更改,包括 5 次插入1 次删除
  1. 1
    1
      common/rfb/PixelFormat.cxx
  2. 4
    0
      tests/unit/pixelformat.cxx

+ 1
- 1
common/rfb/PixelFormat.cxx 查看文件

@@ -679,7 +679,7 @@ bool PixelFormat::isSane(void)
return false;

totalBits = bits(redMax) + bits(greenMax) + bits(blueMax);
if (totalBits > bpp)
if (totalBits > depth)
return false;

if (((redMax << redShift) & (greenMax << greenShift)) != 0)

+ 4
- 0
tests/unit/pixelformat.cxx 查看文件

@@ -104,6 +104,10 @@ int main(int argc, char** argv)
doTest(true, 32, 24, false, true, 127, 511, 127, 0, 4, 20);
doTest(true, 32, 24, false, true, 127, 127, 511, 0, 4, 8);

/* Insufficient depth */

doTest(true, 32, 16, false, true, 255, 255, 255, 0, 8, 16);

/* Overlapping channels */

doTest(true, 32, 24, false, true, 255, 255, 255, 0, 7, 16);

正在加载...
取消
保存