Skip to content

Commit

Permalink
Merge pull request matplotlib#3777 from mdboom/upgrade-agg
Browse files Browse the repository at this point in the history
MNT : Upgrade agg to SVN version
  • Loading branch information
tacaswell committed Nov 11, 2014
2 parents 2d3b0aa + cf80280 commit e2061f7
Show file tree
Hide file tree
Showing 203 changed files with 9,868 additions and 6,092 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Anti-Grain Geometry - Version 2.4
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
//
Expand All @@ -30,15 +30,15 @@ namespace agg
{
static unsigned calculate(const int8u* p) { return *p; }
};


//=====================================================rgb_to_gray_mask_u8
template<unsigned R, unsigned G, unsigned B>
struct rgb_to_gray_mask_u8
{
static unsigned calculate(const int8u* p)
{
return (p[R]*77 + p[G]*150 + p[B]*29) >> 8;
static unsigned calculate(const int8u* p)
{
return (p[R]*77 + p[G]*150 + p[B]*29) >> 8;
}
};

Expand All @@ -50,7 +50,7 @@ namespace agg
typedef int8u cover_type;
typedef alpha_mask_u8<Step, Offset, MaskF> self_type;
enum cover_scale_e
{
{
cover_shift = 8,
cover_none = 0,
cover_full = 255
Expand All @@ -64,12 +64,12 @@ namespace agg
MaskF& mask_function() { return m_mask_function; }
const MaskF& mask_function() const { return m_mask_function; }


//--------------------------------------------------------------------
cover_type pixel(int x, int y) const
{
if(x >= 0 && y >= 0 &&
x < (int)m_rbuf->width() &&
if(x >= 0 && y >= 0 &&
x < (int)m_rbuf->width() &&
y < (int)m_rbuf->height())
{
return (cover_type)m_mask_function.calculate(
Expand All @@ -81,13 +81,13 @@ namespace agg
//--------------------------------------------------------------------
cover_type combine_pixel(int x, int y, cover_type val) const
{
if(x >= 0 && y >= 0 &&
x < (int)m_rbuf->width() &&
if(x >= 0 && y >= 0 &&
x < (int)m_rbuf->width() &&
y < (int)m_rbuf->height())
{
return (cover_type)((cover_full + val *
return (cover_type)((cover_full + val *
m_mask_function.calculate(
m_rbuf->row_ptr(y) + x * Step + Offset)) >>
m_rbuf->row_ptr(y) + x * Step + Offset)) >>
cover_shift);
}
return 0;
Expand All @@ -112,7 +112,7 @@ namespace agg
if(x < 0)
{
count += x;
if(count <= 0)
if(count <= 0)
{
memset(dst, 0, num_pix * sizeof(cover_type));
return;
Expand All @@ -126,7 +126,7 @@ namespace agg
{
int rest = x + count - xmax - 1;
count -= rest;
if(count <= 0)
if(count <= 0)
{
memset(dst, 0, num_pix * sizeof(cover_type));
return;
Expand Down Expand Up @@ -162,7 +162,7 @@ namespace agg
if(x < 0)
{
count += x;
if(count <= 0)
if(count <= 0)
{
memset(dst, 0, num_pix * sizeof(cover_type));
return;
Expand All @@ -176,7 +176,7 @@ namespace agg
{
int rest = x + count - xmax - 1;
count -= rest;
if(count <= 0)
if(count <= 0)
{
memset(dst, 0, num_pix * sizeof(cover_type));
return;
Expand All @@ -187,8 +187,8 @@ namespace agg
const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset;
do
{
*covers = (cover_type)((cover_full + (*covers) *
m_mask_function.calculate(mask)) >>
*covers = (cover_type)((cover_full + (*covers) *
m_mask_function.calculate(mask)) >>
cover_shift);
++covers;
mask += Step;
Expand All @@ -214,7 +214,7 @@ namespace agg
if(y < 0)
{
count += y;
if(count <= 0)
if(count <= 0)
{
memset(dst, 0, num_pix * sizeof(cover_type));
return;
Expand All @@ -228,7 +228,7 @@ namespace agg
{
int rest = y + count - ymax - 1;
count -= rest;
if(count <= 0)
if(count <= 0)
{
memset(dst, 0, num_pix * sizeof(cover_type));
return;
Expand Down Expand Up @@ -263,7 +263,7 @@ namespace agg
if(y < 0)
{
count += y;
if(count <= 0)
if(count <= 0)
{
memset(dst, 0, num_pix * sizeof(cover_type));
return;
Expand All @@ -277,7 +277,7 @@ namespace agg
{
int rest = y + count - ymax - 1;
count -= rest;
if(count <= 0)
if(count <= 0)
{
memset(dst, 0, num_pix * sizeof(cover_type));
return;
Expand All @@ -288,8 +288,8 @@ namespace agg
const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset;
do
{
*covers = (cover_type)((cover_full + (*covers) *
m_mask_function.calculate(mask)) >>
*covers = (cover_type)((cover_full + (*covers) *
m_mask_function.calculate(mask)) >>
cover_shift);
++covers;
mask += m_rbuf->stride();
Expand All @@ -302,10 +302,10 @@ namespace agg
alpha_mask_u8(const self_type&);
const self_type& operator = (const self_type&);

agg::rendering_buffer* m_rbuf;
rendering_buffer* m_rbuf;
MaskF m_mask_function;
};


typedef alpha_mask_u8<1, 0> alpha_mask_gray8; //----alpha_mask_gray8

Expand Down Expand Up @@ -354,7 +354,7 @@ namespace agg
typedef int8u cover_type;
typedef amask_no_clip_u8<Step, Offset, MaskF> self_type;
enum cover_scale_e
{
{
cover_shift = 8,
cover_none = 0,
cover_full = 255
Expand All @@ -376,13 +376,13 @@ namespace agg
m_rbuf->row_ptr(y) + x * Step + Offset);
}


//--------------------------------------------------------------------
cover_type combine_pixel(int x, int y, cover_type val) const
{
return (cover_type)((cover_full + val *
return (cover_type)((cover_full + val *
m_mask_function.calculate(
m_rbuf->row_ptr(y) + x * Step + Offset)) >>
m_rbuf->row_ptr(y) + x * Step + Offset)) >>
cover_shift);
}

Expand All @@ -407,8 +407,8 @@ namespace agg
const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset;
do
{
*dst = (cover_type)((cover_full + (*dst) *
m_mask_function.calculate(mask)) >>
*dst = (cover_type)((cover_full + (*dst) *
m_mask_function.calculate(mask)) >>
cover_shift);
++dst;
mask += Step;
Expand Down Expand Up @@ -436,8 +436,8 @@ namespace agg
const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset;
do
{
*dst = (cover_type)((cover_full + (*dst) *
m_mask_function.calculate(mask)) >>
*dst = (cover_type)((cover_full + (*dst) *
m_mask_function.calculate(mask)) >>
cover_shift);
++dst;
mask += m_rbuf->stride();
Expand All @@ -449,10 +449,10 @@ namespace agg
amask_no_clip_u8(const self_type&);
const self_type& operator = (const self_type&);

agg::rendering_buffer* m_rbuf;
rendering_buffer* m_rbuf;
MaskF m_mask_function;
};


typedef amask_no_clip_u8<1, 0> amask_no_clip_gray8; //----amask_no_clip_gray8

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit e2061f7

Please sign in to comment.