projects
/
synfig.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix 1694393: save 'pref.*' keys first, so the window manager hint preference is loade...
[synfig.git]
/
synfig-core
/
trunk
/
src
/
synfig
/
surface.cpp
diff --git
a/synfig-core/trunk/src/synfig/surface.cpp
b/synfig-core/trunk/src/synfig/surface.cpp
index
eb55068
..
6eef588
100644
(file)
--- a/
synfig-core/trunk/src/synfig/surface.cpp
+++ b/
synfig-core/trunk/src/synfig/surface.cpp
@@
-1,8
+1,10
@@
-/* ========================================================================
-** Synfig
-** Template File
-** $Id: surface.cpp,v 1.1.1.1 2005/01/04 01:23:14 darco Exp $
+/* === S Y N F I G ========================================================= */
+/*! \file surface.cpp
+** \brief Template File
**
**
+** $Id$
+**
+** \legal
** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
**
** This package is free software; you can redistribute it and/or
** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
**
** This package is free software; you can redistribute it and/or
@@
-14,6
+16,7
@@
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** General Public License for more details.
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** General Public License for more details.
+** \endlegal
**
** === N O T E S ===========================================================
**
**
** === N O T E S ===========================================================
**
@@
-59,9
+62,9
@@
public:
virtual ~target2surface();
virtual bool set_rend_desc(synfig::RendDesc *newdesc);
virtual ~target2surface();
virtual bool set_rend_desc(synfig::RendDesc *newdesc);
-
+
virtual bool start_frame(synfig::ProgressCallback *cb);
virtual bool start_frame(synfig::ProgressCallback *cb);
-
+
virtual void end_frame();
virtual Color * start_scanline(int scanline);
virtual void end_frame();
virtual Color * start_scanline(int scanline);
@@
-85,23
+88,23
@@
target2surface::set_rend_desc(synfig::RendDesc *newdesc)
desc=*newdesc;
return synfig::Target_Scanline::set_rend_desc(newdesc);
}
desc=*newdesc;
return synfig::Target_Scanline::set_rend_desc(newdesc);
}
-
+
bool
bool
-target2surface::start_frame(synfig::ProgressCallback *cb)
-{
+target2surface::start_frame(synfig::ProgressCallback *cb)
+{
if(surface->get_w() != desc.get_w() || surface->get_h() != desc.get_h())
{
surface->set_wh(desc.get_w(),desc.get_h());
}
if(surface->get_w() != desc.get_w() || surface->get_h() != desc.get_h())
{
surface->set_wh(desc.get_w(),desc.get_h());
}
- return true;
+ return true;
}
}
-
+
void
target2surface::end_frame()
{
return;
}
void
target2surface::end_frame()
{
return;
}
-
+
Color *
target2surface::start_scanline(int scanline)
{
Color *
target2surface::start_scanline(int scanline)
{
@@
-148,26
+151,26
@@
synfig::Surface::blit_to(alpha_pen& pen, int x, int y, int w, int h)
if(x<0)
{
w+=x; //decrease
if(x<0)
{
w+=x; //decrease
- x=0;
+ x=0;
}
}
-
+
if(y<0)
{
h+=y; //decrease
if(y<0)
{
h+=y; //decrease
- y=0;
+ y=0;
}
}
-
+
//clip width against dest width
w = min((long)w,(long)(pen.end_x()-pen.x()));
h = min((long)h,(long)(pen.end_y()-pen.y()));
//clip width against dest width
w = min((long)w,(long)(pen.end_x()-pen.x()));
h = min((long)h,(long)(pen.end_y()-pen.y()));
-
+
//clip width against src width
w = min(w,get_w()-x);
h = min(h,get_h()-y);
if(w<=0 || h<=0)
return;
//clip width against src width
w = min(w,get_w()-x);
h = min(h,get_h()-y);
if(w<=0 || h<=0)
return;
-
+
for(int i=0;i<h;i++)
{
char* src(static_cast<char*>(static_cast<void*>(operator[](y)+x))+i*get_w()*sizeof(Color));
for(int i=0;i<h;i++)
{
char* src(static_cast<char*>(static_cast<void*>(operator[](y)+x))+i*get_w()*sizeof(Color));
@@
-176,8
+179,8
@@
synfig::Surface::blit_to(alpha_pen& pen, int x, int y, int w, int h)
}
return;
}
}
return;
}
-
-#ifdef HAS_VIMAGE
+
+#ifdef HAS_VIMAGE
if( pen.get_blend_method()==Color::BLEND_COMPOSITE && fabs(alpha-1.0f)<epsilon )
{
if(x>=get_w() || y>=get_w())
if( pen.get_blend_method()==Color::BLEND_COMPOSITE && fabs(alpha-1.0f)<epsilon )
{
if(x>=get_w() || y>=get_w())
@@
-188,23
+191,23
@@
synfig::Surface::blit_to(alpha_pen& pen, int x, int y, int w, int h)
{
//u-=x; //increase
w+=x; //decrease
{
//u-=x; //increase
w+=x; //decrease
- x=0;
+ x=0;
}
}
-
+
if(y<0)
{
//v-=y; //increase
h+=y; //decrease
if(y<0)
{
//v-=y; //increase
h+=y; //decrease
- y=0;
+ y=0;
}
}
-
+
//clip width against dest width
w = min(w,pen.end_x()-pen.x());
h = min(h,pen.end_y()-pen.y());
//clip width against dest width
w = min(w,pen.end_x()-pen.x());
h = min(h,pen.end_y()-pen.y());
-
+
//clip width against src width
//clip width against src width
- w = min(w,get_w()-x);
- h = min(h,get_h()-y);
+ w = min(w,get_w()-x);
+ h = min(h,get_h()-y);
if(w<=0 || h<=0)
return;
if(w<=0 || h<=0)
return;
@@
-213,7
+216,7
@@
synfig::Surface::blit_to(alpha_pen& pen, int x, int y, int w, int h)
vImage_Buffer top,bottom;
vImage_Buffer& dest(bottom);
vImage_Buffer top,bottom;
vImage_Buffer& dest(bottom);
-
+
top.data=static_cast<void*>(operator[](y)+x);
top.height=h;
top.width=w;
top.data=static_cast<void*>(operator[](y)+x);
top.height=h;
top.width=w;
@@
-225,12
+228,12
@@
synfig::Surface::blit_to(alpha_pen& pen, int x, int y, int w, int h)
bottom.width=w;
//bottom.rowBytes=pen.get_width()*sizeof(Color); //! \fixme this should get the pitch!!
bottom.rowBytes=pen.get_pitch(); //! \fixme this should get the pitch!!
bottom.width=w;
//bottom.rowBytes=pen.get_width()*sizeof(Color); //! \fixme this should get the pitch!!
bottom.rowBytes=pen.get_pitch(); //! \fixme this should get the pitch!!
-
+
vImage_Error ret;
ret=vImageAlphaBlend_ARGBFFFF(&top,&bottom,&dest,kvImageNoFlags);
vImage_Error ret;
ret=vImageAlphaBlend_ARGBFFFF(&top,&bottom,&dest,kvImageNoFlags);
-
+
assert(ret!=kvImageNoError);
assert(ret!=kvImageNoError);
-
+
return;
}
#endif
return;
}
#endif