From 3a0814fdae1984e5853ea54b31f63dff442d74c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Thu, 10 Jul 2008 08:11:04 +0000 Subject: [PATCH] patch by Andrej Spielmann (GSOC): * Prepared the AGG base_renderer code with two more functions needed to handle subpixel scanline coverage values. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26356 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/libs/agg/agg_renderer_base.h | 39 ++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/headers/libs/agg/agg_renderer_base.h b/headers/libs/agg/agg_renderer_base.h index 21f4487e32..b42168b05c 100644 --- a/headers/libs/agg/agg_renderer_base.h +++ b/headers/libs/agg/agg_renderer_base.h @@ -205,6 +205,22 @@ namespace agg m_ren->blend_hline(x1, y, x2 - x1 + 1, c, cover); } + + //-------------------------------------------------------------------- + void blend_hline_subpix(int x1, int y, int x2, + const color_type& c, cover_type cover) + { + if(x1 > x2) { int t = x2; x2 = x1; x1 = t; } + if(y > ymax()) return; + if(y < ymin()) return; + if(x1 > xmax()) return; + if(x2 < xmin()) return; + + if(x1 < xmin()) x1 = xmin(); + if(x2 > xmax()) x2 = xmax(); + + m_ren->blend_hline_subpix(x1, y, x2 - x1 + 1, c, cover); + } //-------------------------------------------------------------------- void blend_vline(int x, int y1, int y2, @@ -280,6 +296,29 @@ namespace agg } m_ren->blend_solid_hspan(x, y, len, c, covers); } + + //-------------------------------------------------------------------- + void blend_solid_hspan_subpix(int x, int y, int len, + const color_type& c, + const cover_type* covers) + { + if(y > ymax()) return; + if(y < ymin()) return; + + if(x < xmin()) + { + len -= 3 * (xmin() - x); + if(len <= 0) return; + covers += 3*(xmin() - x); + x = xmin(); + } + if(x + len / 3 > xmax()) + { + len = 3 * (xmax() - x + 1); + if(len <= 0) return; + } + m_ren->blend_solid_hspan_subpix(x, y, len, c, covers); + } //-------------------------------------------------------------------- void blend_solid_vspan(int x, int y, int len,