From 213521927fd8b4f08e91da9742e1cb5cd363717e Mon Sep 17 00:00:00 2001 From: vcaesar Date: Sat, 18 Aug 2018 09:25:23 -0400 Subject: [PATCH] update get_pixel_color remove duplicate code --- screen/goScreen.h | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/screen/goScreen.h b/screen/goScreen.h index 1774d4f..70b3ba6 100644 --- a/screen/goScreen.h +++ b/screen/goScreen.h @@ -62,29 +62,9 @@ MMRGBHex get_px_color(size_t x, size_t y){ } char* get_pixel_color(size_t x, size_t y){ - MMBitmapRef bitmap; - MMRGBHex color; - - if (!pointVisibleOnMainDisplay(MMPointMake(x, y))){ - // return 1; - return "screen's dimensions."; - } - - bitmap = copyMMBitmapFromDisplayInRect(MMRectMake(x, y, 1, 1)); - // bitmap = MMRectMake(x, y, 1, 1); - - color = MMRGBHexAtPoint(bitmap, 0, 0); - - char hex[7]; - padHex(color, hex); - destroyMMBitmap(bitmap); - - // printf("%s\n", hex); - // return 0; - - char* s = (char*)calloc(100, sizeof(char*)); - if(s)strcpy(s, hex); + MMRGBHex color = get_px_color(x, y); + char* s = pad_hex(color); return s; }