Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed a few things:

1) pixfmt_alpha_blend_gray::pix_width is now in bytes, not value_types
2) fixed a bug in pixfmt_xxx::blend_from_color() method that I introduced 
   with my ARS blender patch
3) fixed bug in pixfmt_xxx::blend_from_xxx() methods where xsrc was ignored
4) fixed bug in pixfmt_xxx::blend_from_xxx() methods where possibility that 
   SrcPixelFormatRenderer::pix_step might > 1 was ignored
5) class image_accessor_clip was broken for rgb48 and rgba64 color types


git-svn-id: http://agg.svn.sourceforge.net/svnroot/agg@50 ab9de31f-a152-4fe9-8809-95f286f9ca89
  • Loading branch information...
commit 8b225ccc5db1a700b924948d39de1600ff9bad05 1 parent e0fd87f
jhorigan authored
View
2  agg-2.4/include/agg_image_accessors.h
@@ -96,7 +96,7 @@ namespace agg
private:
const pixfmt_type* m_pixf;
- int8u m_bk_buf[4];
+ int8u m_bk_buf[8];
int m_x, m_x0, m_y;
const int8u* m_pix_ptr;
};
View
20 agg-2.4/include/agg_pixfmt_gray.h
@@ -142,7 +142,7 @@ namespace agg
base_shift = color_type::base_shift,
base_scale = color_type::base_scale,
base_mask = color_type::base_mask,
- pix_width = sizeof(value_type),
+ pix_width = sizeof(value_type) * Step,
pix_step = Step,
pix_offset = Offset,
};
@@ -617,18 +617,21 @@ namespace agg
int8u cover)
{
typedef typename SrcPixelFormatRenderer::value_type src_value_type;
+ typedef typename SrcPixelFormatRenderer::color_type src_color_type;
const src_value_type* psrc = (src_value_type*)from.row_ptr(ysrc);
if(psrc)
{
+ psrc += xsrc * SrcPixelFormatRenderer::pix_step + SrcPixelFormatRenderer::pix_offset;
value_type* pdst =
- (value_type*)m_rbuf->row_ptr(xdst, ydst, len) + xdst;
+ (value_type*)m_rbuf->row_ptr(xdst, ydst, len) + xdst * Step + Offset;
do
{
copy_or_blend_pix(pdst,
color,
- color_type::int_mult_cover(*psrc, cover));
- ++psrc;
- ++pdst;
+ src_color_type::int_mult_cover(*psrc, cover) >>
+ (src_color_type::base_shift - 8));
+ psrc += SrcPixelFormatRenderer::pix_step;
+ pdst += Step;
}
while(--len);
}
@@ -647,13 +650,14 @@ namespace agg
const src_value_type* psrc = (src_value_type*)from.row_ptr(ysrc);
if(psrc)
{
+ psrc += xsrc * SrcPixelFormatRenderer::pix_step + SrcPixelFormatRenderer::pix_offset;
value_type* pdst =
- (value_type*)m_rbuf->row_ptr(xdst, ydst, len) + xdst;
+ (value_type*)m_rbuf->row_ptr(xdst, ydst, len) + xdst * Step + Offset;
do
{
copy_or_blend_pix(pdst, color_lut[*psrc], cover);
- ++psrc;
- ++pdst;
+ psrc += SrcPixelFormatRenderer::pix_step;
+ pdst += Step;
}
while(--len);
}
View
12 agg-2.4/include/agg_pixfmt_rgb.h
@@ -760,17 +760,20 @@ namespace agg
int8u cover)
{
typedef typename SrcPixelFormatRenderer::value_type src_value_type;
+ typedef typename SrcPixelFormatRenderer::color_type src_color_type;
const src_value_type* psrc = (src_value_type*)from.row_ptr(ysrc);
if(psrc)
{
+ psrc += xsrc * SrcPixelFormatRenderer::pix_step + SrcPixelFormatRenderer::pix_offset;
value_type* pdst =
(value_type*)m_rbuf->row_ptr(xdst, ydst, len) + xdst * Step;
do
{
copy_or_blend_pix(pdst,
color,
- color_type::int_mult_cover(*psrc, cover));
- ++psrc;
+ src_color_type::int_mult_cover(*psrc, cover) >>
+ (src_color_type::base_shift - 8));
+ psrc += SrcPixelFormatRenderer::pix_step;
pdst += Step;
}
while(--len);
@@ -790,6 +793,7 @@ namespace agg
const src_value_type* psrc = (src_value_type*)from.row_ptr(ysrc);
if(psrc)
{
+ psrc += xsrc * SrcPixelFormatRenderer::pix_step + SrcPixelFormatRenderer::pix_offset;
value_type* pdst =
(value_type*)m_rbuf->row_ptr(xdst, ydst, len) + xdst * Step;
@@ -800,7 +804,7 @@ namespace agg
const color_type& color = color_lut[*psrc];
m_blender.blend_pix(pdst,
color.r, color.g, color.b, color.a);
- ++psrc;
+ psrc += SrcPixelFormatRenderer::pix_step;
pdst += Step;
}
while(--len);
@@ -810,7 +814,7 @@ namespace agg
do
{
copy_or_blend_pix(pdst, color_lut[*psrc], cover);
- ++psrc;
+ psrc += SrcPixelFormatRenderer::pix_step;
pdst += Step;
}
while(--len);
View
7 agg-2.4/include/agg_pixfmt_rgb_packed.h
@@ -1144,9 +1144,11 @@ namespace agg
int8u cover)
{
typedef typename SrcPixelFormatRenderer::value_type src_value_type;
+ typedef typename SrcPixelFormatRenderer::color_type src_color_type;
const src_value_type* psrc = (src_value_type*)from.row_ptr(ysrc);
if(psrc)
{
+ psrc += xsrc * SrcPixelFormatRenderer::pix_step + SrcPixelFormatRenderer::pix_offset;
pixel_type* pdst =
(pixel_type*)m_rbuf->row_ptr(xdst, ydst, len) + xdst;
@@ -1155,7 +1157,7 @@ namespace agg
m_blender.blend_pix(pdst,
color.r, color.g, color.b, color.a,
cover);
- ++psrc;
+ psrc += SrcPixelFormatRenderer::pix_step;
++pdst;
}
while(--len);
@@ -1175,6 +1177,7 @@ namespace agg
const src_value_type* psrc = (src_value_type*)from.row_ptr(ysrc);
if(psrc)
{
+ psrc += xsrc * SrcPixelFormatRenderer::pix_step + SrcPixelFormatRenderer::pix_offset;
pixel_type* pdst =
(pixel_type*)m_rbuf->row_ptr(xdst, ydst, len) + xdst;
@@ -1184,7 +1187,7 @@ namespace agg
m_blender.blend_pix(pdst,
color.r, color.g, color.b, color.a,
cover);
- ++psrc;
+ psrc += SrcPixelFormatRenderer::pix_step;
++pdst;
}
while(--len);
View
19 agg-2.4/include/agg_pixfmt_rgba.h
@@ -2368,9 +2368,11 @@ namespace agg
int8u cover)
{
typedef typename SrcPixelFormatRenderer::value_type src_value_type;
+ typedef typename SrcPixelFormatRenderer::color_type src_color_type;
const src_value_type* psrc = (src_value_type*)from.row_ptr(ysrc);
if(psrc)
{
+ psrc += xsrc * SrcPixelFormatRenderer::pix_step + SrcPixelFormatRenderer::pix_offset;
value_type* pdst =
(value_type*)m_rbuf->row_ptr(xdst, ydst, len) + (xdst << 2);
do
@@ -2378,7 +2380,7 @@ namespace agg
cob_type::copy_or_blend_pix(pdst,
color.r, color.g, color.b, color.a,
color_type::int_mult_cover(*psrc, cover));
- ++psrc;
+ psrc += SrcPixelFormatRenderer::pix_step;
pdst += 4;
}
while(--len);
@@ -2398,6 +2400,7 @@ namespace agg
const src_value_type* psrc = (src_value_type*)from.row_ptr(ysrc);
if(psrc)
{
+ psrc += xsrc * SrcPixelFormatRenderer::pix_step + SrcPixelFormatRenderer::pix_offset;
value_type* pdst =
(value_type*)m_rbuf->row_ptr(xdst, ydst, len) + (xdst << 2);
@@ -2408,7 +2411,7 @@ namespace agg
const color_type& color = color_lut[*psrc];
cob_type::copy_or_blend_pix(pdst,
color.r, color.g, color.b, color.a);
- ++psrc;
+ psrc += SrcPixelFormatRenderer::pix_step;
pdst += 4;
}
while(--len);
@@ -2421,7 +2424,7 @@ namespace agg
cob_type::copy_or_blend_pix(pdst,
color.r, color.g, color.b, color.a,
cover);
- ++psrc;
+ psrc += SrcPixelFormatRenderer::pix_step;
pdst += 4;
}
while(--len);
@@ -2820,9 +2823,11 @@ namespace agg
int8u cover)
{
typedef typename SrcPixelFormatRenderer::value_type src_value_type;
+ typedef typename SrcPixelFormatRenderer::color_type src_color_type;
const src_value_type* psrc = (src_value_type*)from.row_ptr(ysrc);
if(psrc)
{
+ psrc += xsrc * SrcPixelFormatRenderer::pix_step + SrcPixelFormatRenderer::pix_offset;
value_type* pdst =
(value_type*)m_rbuf->row_ptr(xdst, ydst, len) + (xdst << 2);
do
@@ -2830,8 +2835,9 @@ namespace agg
blender_type::blend_pix(m_comp_op,
pdst,
color.r, color.g, color.b, color.a,
- (*psrc * cover + base_mask) >> base_shift);
- ++psrc;
+ src_color_type::int_mult_cover(*psrc, cover) >>
+ (src_color_type::base_shift - 8));
+ psrc += SrcPixelFormatRenderer::pix_step;
pdst += 4;
}
while(--len);
@@ -2851,6 +2857,7 @@ namespace agg
const src_value_type* psrc = (src_value_type*)from.row_ptr(ysrc);
if(psrc)
{
+ psrc += xsrc * SrcPixelFormatRenderer::pix_step + SrcPixelFormatRenderer::pix_offset;
value_type* pdst =
(value_type*)m_rbuf->row_ptr(xdst, ydst, len) + (xdst << 2);
do
@@ -2860,7 +2867,7 @@ namespace agg
pdst,
color.r, color.g, color.b, color.a,
cover);
- ++psrc;
+ psrc += SrcPixelFormatRenderer::pix_step;
pdst += 4;
}
while(--len);
Please sign in to comment.
Something went wrong with that request. Please try again.