Skip to content

Upgrade agg to SVN version #3777

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Nov 11, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dropping a namespace? perhaps we should push up some patches to them?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case, it's just the dropping of a redundant namespace specifier, since this code is in a namespace agg block. It's not actually changing the namespace in which rendering_buffer lives. Generally, agg doesn't using the namespace prefix everywhere in its internal code, which is typical C++ practice.

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.
Loading