diff options
author | 浅倉麗子 | 2020-04-09 11:47:05 -0400 |
---|---|---|
committer | 浅倉麗子 | 2020-04-09 11:47:05 -0400 |
commit | 4bcf127b8b6fb2c64c384efd763066b0259deb8a (patch) | |
tree | 82ce7f2a1a923fc1ea77c8069b56475ef3577c72 | |
parent | Centre framebuffer when cropping (diff) | |
download | sharpscale-4bcf127b8b6fb2c64c384efd763066b0259deb8a.tar.gz |
Add lines to verify cropping in scaling testv1.1.1
-rw-r--r-- | scaling-test/CMakeLists.txt | 2 | ||||
-rw-r--r-- | scaling-test/main.c | 21 |
2 files changed, 22 insertions, 1 deletions
diff --git a/scaling-test/CMakeLists.txt b/scaling-test/CMakeLists.txt index 8f9ef91..944c6be 100644 --- a/scaling-test/CMakeLists.txt +++ b/scaling-test/CMakeLists.txt @@ -19,7 +19,7 @@ set(VPK "${PROJECT_NAME}.vpk") set(TITLE_NAME "Scaling test") set(TITLE_ID "AKRK00004") -set(TITLE_VER "01.01") +set(TITLE_VER "01.02") add_executable("${ELF}" main.c diff --git a/scaling-test/main.c b/scaling-test/main.c index 1be42d9..9b9a807 100644 --- a/scaling-test/main.c +++ b/scaling-test/main.c @@ -26,6 +26,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. #define WHITE 0xFFFFFFFF #define BLACK 0x00000000 +#define RED 0xFF0000FF +#define BLUE 0xFFFF0000 #define FB_WIDTH 960 #define FB_HEIGHT 544 @@ -65,6 +67,25 @@ static void render(int *fb_base, int width, int pitch, int height) { fb_base[j * pitch + i] = (j % 2 == 0) ? WHITE : BLACK; } } + + int crop = 0; + + if (width == 480 && height == 272) { + crop = 1; + } else if (width == 640 && height == 368) { + crop = 4; + } else if (width == 960 && height == 544) { + crop = 2; + } + + if (crop > 0) { + for (int i = 0; i < width; i++) { + fb_base[(crop - 1) * pitch + i] = RED; + fb_base[(crop - 0) * pitch + i] = BLUE; + fb_base[(height - crop - 1) * pitch + i] = BLUE; + fb_base[(height - crop - 0) * pitch + i] = RED; + } + } } int main() { |