[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/DynamicShape.cpp server/...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog server/DynamicShape.cpp server/... |
Date: |
Mon, 23 Apr 2007 20:05:21 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 07/04/23 20:05:21
Modified files:
. : ChangeLog
server : DynamicShape.cpp DynamicShape.h
sprite_instance.cpp sprite_instance.h
server/parser : shape_character_def.cpp
testsuite/misc-ming.all: DrawingApiTest.as
DrawingApiTestRunner.cpp
Log message:
* server/DynamicShape.{h,cpp} (lineStyle): add a line style even
if it is for specifying a thickness of 0 (hairline);
add a resetLineStyle() function for dropping any style.
* server/sprite_instance.{cpp,h}: add resetLineStyle() for
drawing api.
* server/parser/shape_character_def.cpp (point_test_local):
Use a tolerance of a single twip distance when detecting
collision of hairlined strokes.
* testsuite/misc-ming.all/DrawingApiTest.as: add more comments,
and
an hairlined line.
* testsuite/misc-ming.all/DrawingApiTestRunner.cpp: more tests.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2974&r2=1.2975
http://cvs.savannah.gnu.org/viewcvs/gnash/server/DynamicShape.cpp?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/server/DynamicShape.h?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.251&r2=1.252
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.h?cvsroot=gnash&r1=1.101&r2=1.102
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/shape_character_def.cpp?cvsroot=gnash&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/DrawingApiTest.as?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/DrawingApiTestRunner.cpp?cvsroot=gnash&r1=1.7&r2=1.8
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2974
retrieving revision 1.2975
diff -u -b -r1.2974 -r1.2975
--- ChangeLog 23 Apr 2007 19:19:30 -0000 1.2974
+++ ChangeLog 23 Apr 2007 20:05:19 -0000 1.2975
@@ -1,5 +1,19 @@
2007-04-23 Sandro Santilli <address@hidden>
+ * server/DynamicShape.{h,cpp} (lineStyle): add a line style even
+ if it is for specifying a thickness of 0 (hairline);
+ add a resetLineStyle() function for dropping any style.
+ * server/sprite_instance.{cpp,h}: add resetLineStyle() for
+ drawing api.
+ * server/parser/shape_character_def.cpp (point_test_local):
+ Use a tolerance of a single twip distance when detecting
+ collision of hairlined strokes.
+ * testsuite/misc-ming.all/DrawingApiTest.as: add more comments, and
+ an hairlined line.
+ * testsuite/misc-ming.all/DrawingApiTestRunner.cpp: more tests.
+
+2007-04-23 Sandro Santilli <address@hidden>
+
* server/shape.{cpp,h}: add path::withinSquareDistance.
* server/types.cpp (point::distance): return 0 for 0 squaredDistance
(not 1).
Index: server/DynamicShape.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/DynamicShape.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- server/DynamicShape.cpp 23 Apr 2007 13:45:18 -0000 1.5
+++ server/DynamicShape.cpp 23 Apr 2007 20:05:20 -0000 1.6
@@ -16,7 +16,7 @@
-/* $Id: DynamicShape.cpp,v 1.5 2007/04/23 13:45:18 strk Exp $ */
+/* $Id: DynamicShape.cpp,v 1.6 2007/04/23 20:05:20 strk Exp $ */
#include "DynamicShape.h"
@@ -114,13 +114,15 @@
void
DynamicShape::lineStyle(uint16_t thickness, const rgba& color)
{
- if ( thickness ) {
line_style style(thickness, color);
_currline = add_line_style(style);
- } else {
- _currline = 0;
- }
+ startNewPath();
+}
+void
+DynamicShape::resetLineStyle()
+{
+ _currline = 0;
startNewPath();
}
Index: server/DynamicShape.h
===================================================================
RCS file: /sources/gnash/gnash/server/DynamicShape.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- server/DynamicShape.h 19 Feb 2007 21:40:32 -0000 1.2
+++ server/DynamicShape.h 23 Apr 2007 20:05:20 -0000 1.3
@@ -15,7 +15,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-/* $Id: DynamicShape.h,v 1.2 2007/02/19 21:40:32 strk Exp $ */
+/* $Id: DynamicShape.h,v 1.3 2007/04/23 20:05:20 strk Exp $ */
#ifndef GNASH_DYNAMIC_SHAPE_H
#define GNASH_DYNAMIC_SHAPE_H
@@ -57,9 +57,12 @@
/// Close an existing filled path, if any.
void endFill();
- /// Set current line style
+ /// Set current line style and start a new path.
void lineStyle(uint16_t thickness, const rgba& color);
+ /// Reset line style to no style and start a new path.
+ void resetLineStyle();
+
/// \brief
/// Add a fill style, possibly reusing an existing
/// one if existent.
Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.251
retrieving revision 1.252
diff -u -b -r1.251 -r1.252
--- server/sprite_instance.cpp 21 Apr 2007 21:07:40 -0000 1.251
+++ server/sprite_instance.cpp 23 Apr 2007 20:05:20 -0000 1.252
@@ -922,8 +922,12 @@
uint8_t a = 255;
- if ( fn.nargs > 0 )
+ if ( ! fn.nargs )
{
+ sprite->resetLineStyle();
+ return as_value();
+ }
+
thickness =
uint16_t(PIXELS_TO_TWIPS(uint16_t(fclamp(fn.arg(0).to_number(), 0, 255))));
if ( fn.nargs > 1 )
@@ -941,8 +945,6 @@
}
}
- }
-
rgba color(r, g, b, a);
//log_msg("Color: %s", color.toString().c_str());
Index: server/sprite_instance.h
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.h,v
retrieving revision 1.101
retrieving revision 1.102
diff -u -b -r1.101 -r1.102
--- server/sprite_instance.h 21 Apr 2007 21:07:40 -0000 1.101
+++ server/sprite_instance.h 23 Apr 2007 20:05:20 -0000 1.102
@@ -17,7 +17,7 @@
//
//
-/* $Id: sprite_instance.h,v 1.101 2007/04/21 21:07:40 strk Exp $ */
+/* $Id: sprite_instance.h,v 1.102 2007/04/23 20:05:20 strk Exp $ */
// Stateful live Sprite instance
@@ -695,6 +695,11 @@
_drawable->lineStyle(thickness, color);
}
+ void resetLineStyle()
+ {
+ _drawable->resetLineStyle();
+ }
+
void beginFill(const rgba& color)
{
_drawable->beginFill(color);
Index: server/parser/shape_character_def.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/parser/shape_character_def.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- server/parser/shape_character_def.cpp 23 Apr 2007 19:19:30 -0000
1.17
+++ server/parser/shape_character_def.cpp 23 Apr 2007 20:05:20 -0000
1.18
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: shape_character_def.cpp,v 1.17 2007/04/23 19:19:30 strk Exp $ */
+/* $Id: shape_character_def.cpp,v 1.18 2007/04/23 20:05:20 strk Exp $ */
// Based on the public domain shape.cpp of Thatcher Ulrich <address@hidden>
2003
@@ -622,9 +622,19 @@
assert(m_line_styles.size() >= pth.m_line);
line_style& ls = m_line_styles[pth.m_line-1];
int thickness = ls.get_width();
- //cout << "Thickness of line is " << thickness << endl;
+ float sqdist;
+ if ( thickness == 0 )
+ {
+ // hairline has always a tolerance of a single twip
+ sqdist = 1;
+ }
+ else
+ {
float dist = thickness/2;
- if ( pth.withinSquareDistance(pt, dist*dist) ) return true;
+ sqdist = dist*dist;
+ }
+ //cout << "Thickness of line is " << thickness << " squared is
" << sqdist << endl;
+ if ( pth.withinSquareDistance(pt, sqdist) ) return true;
}
if (pth.point_test(x, y)) return true;
Index: testsuite/misc-ming.all/DrawingApiTest.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/DrawingApiTest.as,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- testsuite/misc-ming.all/DrawingApiTest.as 23 Apr 2007 19:27:07 -0000
1.4
+++ testsuite/misc-ming.all/DrawingApiTest.as 23 Apr 2007 20:05:20 -0000
1.5
@@ -17,28 +17,41 @@
{
clear();
+#if 1
// The thick red line
lineStyle(20, 0xFF0000, 100);
moveTo(100, 100);
lineTo(200, 200);
+#endif
// The hairlined horizontal black line
lineStyle(0, 0x000000, 100);
moveTo(220, 180);
lineTo(280, 180);
+#if 1
+ // The violet line
moveTo(100, 200);
lineStyle(5, 0xFF00FF, 50);
lineTo(200, 250);
+
+ // The yellow line
lineStyle(10, 0xFFFF00, 100);
lineTo(400, 200);
+
+ // The green curve
lineStyle(8, 0x00FF00, 100);
curveTo(400, 120, 300, 100);
+
+ // Transparent line
lineStyle();
lineTo(80, 100);
+
+ // The black thick vertical line
lineStyle(20);
lineTo(80, 150);
+ // The ugly blue-fill red-stroke thingy
moveTo(80, 180);
lineStyle(2, 0xFF0000);
beginFill(0x0000FF, 100);
@@ -78,6 +91,7 @@
lineTo(240, 100);
lineTo(260, 100);
endFill();
+#endif
}
// Make the MovieClip "active" (grabbing mouse events)
Index: testsuite/misc-ming.all/DrawingApiTestRunner.cpp
===================================================================
RCS file:
/sources/gnash/gnash/testsuite/misc-ming.all/DrawingApiTestRunner.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- testsuite/misc-ming.all/DrawingApiTestRunner.cpp 23 Apr 2007 19:27:07
-0000 1.7
+++ testsuite/misc-ming.all/DrawingApiTestRunner.cpp 23 Apr 2007 20:05:20
-0000 1.8
@@ -94,6 +94,16 @@
check(tester.isMouseOverMouseEntity());
xcheck_pixel(250, 180, 1, black, 2);
+ // Over the transparent line (244,100)
+ tester.movePointerTo(244, 100);
+ xcheck(!tester.isMouseOverMouseEntity());
+ xcheck_pixel(244, 100, 2, white, 2);
+
+ // Over the violet line (146,225)
+ tester.movePointerTo(146, 225);
+ check(tester.isMouseOverMouseEntity());
+ xcheck_pixel(146, 225, 1, violet, 2);
+
// Inside the yellow line
tester.movePointerTo(270, 232);
check(tester.isMouseOverMouseEntity());
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog server/DynamicShape.cpp server/...,
Sandro Santilli <=