[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog backend/render_handler_cairo.cp... [gnash
From: |
Bastiaan Jacques |
Subject: |
[Gnash-commit] gnash ChangeLog backend/render_handler_cairo.cp... [gnash_0_8_3_branch] |
Date: |
Fri, 23 May 2008 11:23:14 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Branch: gnash_0_8_3_branch
Changes by: Bastiaan Jacques <bjacques> 08/05/23 11:23:13
Modified files:
. : ChangeLog
backend : render_handler_cairo.cpp
server/asobj : NetStreamFfmpeg.cpp
Log message:
Snap all coordinates to half a pixel. This fixes rendering of hair
lines (and two testsuite failures.)
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&only_with_tag=gnash_0_8_3_branch&r1=1.6573.2.36&r2=1.6573.2.37
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/render_handler_cairo.cpp?cvsroot=gnash&only_with_tag=gnash_0_8_3_branch&r1=1.41.2.1&r2=1.41.2.2
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStreamFfmpeg.cpp?cvsroot=gnash&only_with_tag=gnash_0_8_3_branch&r1=1.116.2.5&r2=1.116.2.6
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6573.2.36
retrieving revision 1.6573.2.37
diff -u -b -r1.6573.2.36 -r1.6573.2.37
--- ChangeLog 23 May 2008 08:36:12 -0000 1.6573.2.36
+++ ChangeLog 23 May 2008 11:23:09 -0000 1.6573.2.37
@@ -1,3 +1,9 @@
+2008-05-23 Bastiaan Jacques <address@hidden>
+
+ * backend/render_handler_cairo.cpp: Snap all coordinates to half a
+ pixel. This fixes rendering of hair lines (and two testsuite
+ failures.)
+
2008-05-22 Bastiaan Jacques <address@hidden>
* backend/render_handler_cairo.cpp: Unlike AGG, the Cairo renderer
Index: backend/render_handler_cairo.cpp
===================================================================
RCS file: /sources/gnash/gnash/backend/render_handler_cairo.cpp,v
retrieving revision 1.41.2.1
retrieving revision 1.41.2.2
diff -u -b -r1.41.2.1 -r1.41.2.2
--- backend/render_handler_cairo.cpp 23 May 2008 08:36:13 -0000 1.41.2.1
+++ backend/render_handler_cairo.cpp 23 May 2008 11:23:12 -0000 1.41.2.2
@@ -342,6 +342,17 @@
cairo_device_to_user(cr, &x, &y);
}
+ static void
+ snap_to_half_pixel(cairo_t* cr, double& x, double& y)
+ {
+ cairo_user_to_device(cr, &x, &y);
+
+ x = std::floor(x + 0.5) + 0.5;
+ y = std::floor(y + 0.5) + 0.5;
+
+ cairo_device_to_user(cr, &x, &y);
+ }
+
virtual void begin_display(
const rgba& bg_color,
int viewport_x0, int viewport_y0,
@@ -479,19 +490,23 @@
_masks.pop_back();
}
- void add_path(cairo_t* cr, const path& cur_path)
+ void add_path(cairo_t* cr, const path& cur_path, bool round_to_half = false)
{
- cairo_move_to(cr, cur_path.ap.x, cur_path.ap.y);
+ double x = cur_path.ap.x;
+ double y = cur_path.ap.y;
- int prev_x = cur_path.ap.x,
- prev_y = cur_path.ap.y;
+ snap_to_half_pixel(cr, x, y);
+ cairo_move_to(cr, x, y);
for (std::vector<edge>::const_iterator it = cur_path.m_edges.begin(),
end = cur_path.m_edges.end(); it != end; ++it) {
const edge& cur_edge = *it;
if (cur_edge.is_straight()) {
- cairo_line_to(cr, cur_edge.ap.x, cur_edge.ap.y);
+ x = cur_edge.ap.x;
+ y = cur_edge.ap.y;
+ snap_to_half_pixel(cr, x, y);
+ cairo_line_to(cr, x, y);
} else {
// Cairo expects a cubic Bezier curve, while Flash gives us a
@@ -500,24 +515,22 @@
const float two_thirds = 2.0/3.0;
const float one_third = 1 - two_thirds;
- float x1 = prev_x + two_thirds * (cur_edge.cp.x - prev_x);
- float y1 = prev_y + two_thirds * (cur_edge.cp.y - prev_y);
+ double x1 = x + two_thirds * (cur_edge.cp.x - x);
+ double y1 = y + two_thirds * (cur_edge.cp.y - y);
- float x2 = cur_edge.cp.x + one_third * (cur_edge.ap.x - cur_edge.cp.x);
- float y2 = cur_edge.cp.y + one_third * (cur_edge.ap.y - cur_edge.cp.y);
+ double x2 = cur_edge.cp.x + one_third * (cur_edge.ap.x -
cur_edge.cp.x);
+ double y2 = cur_edge.cp.y + one_third * (cur_edge.ap.y -
cur_edge.cp.y);
- const int& x3 = cur_edge.ap.x;
- const int& y3 = cur_edge.ap.y;
+ x = cur_edge.ap.x;
+ y = cur_edge.ap.y;
+ snap_to_half_pixel(cr, x1, y1);
+ snap_to_half_pixel(cr, x2, y2);
+ snap_to_half_pixel(cr, x, y);
- cairo_curve_to(cr, x1, y1, x2, y2, x3, y3);
+ cairo_curve_to(cr, x1, y1, x2, y2, x, y);
}
-
- prev_x = cur_edge.ap.x;
- prev_y = cur_edge.ap.y;
-
}
-
}
@@ -546,8 +559,10 @@
float width = style.getThickness();
if ( width == 0.0 ) {
- // TODO: test this!
- cairo_set_line_width(_cr, 20.0); // expected: 1 pixel
+ double hwidth = 1.0;
+
+ cairo_device_to_user_distance(_cr, &hwidth, &hwidth);
+ cairo_set_line_width(_cr, hwidth);
} else {
// TODO: this is correct for !style.scaleThicknessVertically()
// and !style.scaleThicknessHorizontally().
Index: server/asobj/NetStreamFfmpeg.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStreamFfmpeg.cpp,v
retrieving revision 1.116.2.5
retrieving revision 1.116.2.6
diff -u -b -r1.116.2.5 -r1.116.2.6
--- server/asobj/NetStreamFfmpeg.cpp 21 May 2008 11:35:49 -0000
1.116.2.5
+++ server/asobj/NetStreamFfmpeg.cpp 23 May 2008 11:23:13 -0000
1.116.2.6
@@ -187,10 +187,7 @@
int
NetStreamFfmpeg::readPacket(void* opaque, boost::uint8_t* buf, int buf_size)
{
-
-
NetStreamFfmpeg* ns = static_cast<NetStreamFfmpeg*>(opaque);
- boost::mutex::scoped_lock lock(ns->_netcon_mutex);
std::auto_ptr<tu_file>& nc = ns->_downloader;
size_t ret = nc->read_bytes(static_cast<void*>(buf), buf_size);
@@ -204,10 +201,8 @@
NetStreamFfmpeg::seekMedia(void *opaque, offset_t offset, int whence)
{
NetStreamFfmpeg* ns = static_cast<NetStreamFfmpeg*>(opaque);
- boost::mutex::scoped_lock lock(ns->_netcon_mutex);
std::auto_ptr<tu_file>& nc = ns->_downloader;
-
// Offset is absolute new position in the file
if (whence == SEEK_SET)
{
@@ -729,13 +724,14 @@
// If queues are full then don't bother filling it
if ( ns->m_qvideo.size() < 20 || ns->m_qaudio.size() <
20 )
{
-
+#if 0
// If we have problems with decoding - break
if (!ns->decodeFLVFrame() &&
ns->decodingStatus() != DEC_BUFFERING && ns->m_qvideo.size() == 0 &&
ns->m_qaudio.size() == 0)
{
// TODO: do we really want to break
here !?
break;
}
+#endif
}
else
{
@@ -884,6 +880,9 @@
bool stereo = m_ACodecCtx->channels > 1 ? true : false;
int samples = stereo ? frame_size >> 2 : frame_size >> 1;
+ if (samples <= 0) {
+ return false;
+ }
if (_resampler.init(m_ACodecCtx))
{
@@ -1155,8 +1154,11 @@
}
AVPacket packet;
-
- int rc = av_read_frame(m_FormatCtx, &packet);
+ int rc;
+ {
+ boost::mutex::scoped_lock lock(_netcon_mutex);
+ rc = av_read_frame(m_FormatCtx, &packet);
+ }
if (rc >= 0)
{
@@ -1214,6 +1216,7 @@
timebase = static_cast<double>(videostream->time_base.num /
videostream->time_base.den);
newpos = static_cast<long>(pos / timebase);
+ boost::mutex::scoped_lock lock(_netcon_mutex);
if (av_seek_frame(m_FormatCtx, m_video_index, newpos, 0) < 0)
{
log_error(_("%s: seeking failed"), __FUNCTION__);
@@ -1253,6 +1256,7 @@
double newtime = 0;
while (newtime == 0)
{
+ boost::mutex::scoped_lock lock(_netcon_mutex);
if (av_read_frame(m_FormatCtx, &Packet) < 0)
{
av_seek_frame(m_FormatCtx, -1, 0,
AVSEEK_FLAG_BACKWARD);
@@ -1264,8 +1268,10 @@
}
av_free_packet( &Packet );
-
+ {
+ boost::mutex::scoped_lock lock(_netcon_mutex);
av_seek_frame(m_FormatCtx, m_video_index, newpos, 0);
+ }
boost::uint32_t newtime_ms =
static_cast<boost::int32_t>(newtime / 1000.0);
m_start_clock += m_last_audio_timestamp - newtime_ms;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog backend/render_handler_cairo.cp... [gnash_0_8_3_branch],
Bastiaan Jacques <=