summaryrefslogtreecommitdiff
path: root/apps/plugins/lib
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/lib')
-rw-r--r--apps/plugins/lib/grey.h1
-rw-r--r--apps/plugins/lib/grey_draw.c19
2 files changed, 20 insertions, 0 deletions
diff --git a/apps/plugins/lib/grey.h b/apps/plugins/lib/grey.h
index 8f8de9d..8c9d40a 100644
--- a/apps/plugins/lib/grey.h
+++ b/apps/plugins/lib/grey.h
@@ -106,6 +106,7 @@ void grey_ub_gray_bitmap_part(const unsigned char *src, int src_x, int src_y,
int stride, int x, int y, int width, int height);
void grey_ub_gray_bitmap(const unsigned char *src, int x, int y, int width,
int height);
+extern const struct custom_format format_grey;
/* Text */
void grey_putsxyofs(int x, int y, int ofs, const unsigned char *str);
diff --git a/apps/plugins/lib/grey_draw.c b/apps/plugins/lib/grey_draw.c
index e9812b6..51d340d 100644
--- a/apps/plugins/lib/grey_draw.c
+++ b/apps/plugins/lib/grey_draw.c
@@ -669,3 +669,22 @@ void grey_ub_gray_bitmap(const unsigned char *src, int x, int y, int width,
{
grey_ub_gray_bitmap_part(src, 0, 0, width, x, y, width, height);
}
+
+static void output_row_grey(uint32_t row, void * row_in, struct scaler_context *ctx)
+{
+ int col;
+ uint32_t *qp = (uint32_t*)row_in;
+ uint8_t *dest = (uint8_t*)ctx->bm->data + ctx->bm->width * row;
+ for (col = 0; col < ctx->bm->width; col++)
+ *dest++ = ((*qp++) + ctx->round) * (uint64_t)ctx->divisor >> 32;
+}
+
+static unsigned int get_size_grey(struct bitmap *bm)
+{
+ return bm->width * bm->height;
+}
+
+const struct custom_format format_grey = {
+ .output_row = output_row_grey,
+ .get_size = get_size_grey
+};