]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android/external-libkmsxx.git/blobdiff - kms++util/src/testpat.cpp
card: fix compile warning
[android/external-libkmsxx.git] / kms++util / src / testpat.cpp
index 6cb5d857b97f30f919cec85fa224bd76495e0f36..faacda3a437f8c377b16a8c427e5ad2a864678c3 100644 (file)
@@ -28,6 +28,9 @@ static RGB get_test_pattern_pixel(IMappedFramebuffer& fb, unsigned x, unsigned y
        // white margin lines
        if (x == xm1 || x == xm2 || y == ym1 || y == ym2)
                return RGB(255, 255, 255);
+       // white box in top left corner
+       else if (x < xm1 && y < ym1)
+               return RGB(255, 255, 255);
        // white box outlines to corners
        else if ((x == 0 || x == w - 1) && (y < ym1 || y > ym2))
                return RGB(255, 255, 255);
@@ -52,7 +55,7 @@ static RGB get_test_pattern_pixel(IMappedFramebuffer& fb, unsigned x, unsigned y
                if (x == y || w - x == h - y)
                        return RGB(255, 255, 255);
                // diagonal line
-               else if (w - x == y || x == h - y)
+               else if (w - x - 1 == y || x == h - y - 1)
                        return RGB(255, 255, 255);
                else {
                        int t = (x - xm1 - 1) * 8 / (xm2 - xm1 - 1);
@@ -94,7 +97,7 @@ static RGB get_test_pattern_pixel(IMappedFramebuffer& fb, unsigned x, unsigned y
        }
 }
 
-static void draw_test_pattern_part(IMappedFramebuffer& fb, unsigned start_y, unsigned end_y)
+static void draw_test_pattern_part(IMappedFramebuffer& fb, unsigned start_y, unsigned end_y, YUVType yuvt)
 {
        unsigned x, y;
        unsigned w = fb.width();
@@ -124,7 +127,7 @@ static void draw_test_pattern_part(IMappedFramebuffer& fb, unsigned start_y, uns
                        for (x = 0; x < w; x += 2) {
                                RGB pixel1 = get_test_pattern_pixel(fb, x, y);
                                RGB pixel2 = get_test_pattern_pixel(fb, x + 1, y);
-                               draw_yuv422_macropixel(fb, x, y, pixel1.yuv(), pixel2.yuv());
+                               draw_yuv422_macropixel(fb, x, y, pixel1.yuv(yuvt), pixel2.yuv(yuvt));
                        }
                }
                break;
@@ -138,8 +141,8 @@ static void draw_test_pattern_part(IMappedFramebuffer& fb, unsigned start_y, uns
                                RGB pixel01 = get_test_pattern_pixel(fb, x, y + 1);
                                RGB pixel11 = get_test_pattern_pixel(fb, x + 1, y + 1);
                                draw_yuv420_macropixel(fb, x, y,
-                                                      pixel00.yuv(), pixel10.yuv(),
-                                                      pixel01.yuv(), pixel11.yuv());
+                                                      pixel00.yuv(yuvt), pixel10.yuv(yuvt),
+                                                      pixel01.yuv(yuvt), pixel11.yuv(yuvt));
                        }
                }
                break;
@@ -148,10 +151,10 @@ static void draw_test_pattern_part(IMappedFramebuffer& fb, unsigned start_y, uns
        }
 }
 
-static void draw_test_pattern_impl(IMappedFramebuffer& fb)
+static void draw_test_pattern_impl(IMappedFramebuffer& fb, YUVType yuvt)
 {
        if (fb.height() < 20) {
-               draw_test_pattern_part(fb, 0, fb.height());
+               draw_test_pattern_part(fb, 0, fb.height(), yuvt);
                return;
        }
 
@@ -171,21 +174,21 @@ static void draw_test_pattern_impl(IMappedFramebuffer& fb)
                if (n == num_threads - 1)
                        end = fb.height();
 
-               workers.push_back(thread([&fb, start, end]() { draw_test_pattern_part(fb, start, end); }));
+               workers.push_back(thread([&fb, start, end, yuvt]() { draw_test_pattern_part(fb, start, end, yuvt); }));
        }
 
        for (thread& t : workers)
                t.join();
 }
 
-void draw_test_pattern(IMappedFramebuffer &fb)
+void draw_test_pattern(IMappedFramebuffer &fb, YUVType yuvt)
 {
 #ifdef DRAW_PERF_PRINT
        Stopwatch sw;
        sw.start();
 #endif
 
-       draw_test_pattern_impl(fb);
+       draw_test_pattern_impl(fb, yuvt);
 
 #ifdef DRAW_PERF_PRINT
        double us = sw.elapsed_us();