[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r12312: Remove the obviously silly a
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r12312: Remove the obviously silly arguments from Renderer::begin_display and |
Date: |
Mon, 19 Jul 2010 12:04:55 +0200 |
User-agent: |
Bazaar (2.0.3) |
------------------------------------------------------------
revno: 12312 [merge]
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Mon 2010-07-19 12:04:55 +0200
message:
Remove the obviously silly arguments from Renderer::begin_display and
do some cleanups that follow on from it.
modified:
gui/gui.cpp
gui/pythonmod/gnash-view.cpp
libcore/Bitmap.cpp
libcore/BitmapMovie.h
libcore/Movie.h
libcore/SWFMovie.h
libcore/SWFRect.cpp
libcore/movie_root.cpp
libcore/movie_root.h
libcore/parser/BitmapMovieDefinition.h
libcore/parser/SWFMovieDefinition.h
libcore/parser/movie_definition.h
libcore/parser/sprite_definition.h
librender/ProxyRenderer.h
librender/Renderer.h
librender/Renderer_agg.cpp
librender/Renderer_cairo.cpp
librender/Renderer_cairo.h
librender/Renderer_ogl.cpp
testsuite/DummyMovieDefinition.h
testsuite/MovieTester.cpp
=== modified file 'gui/gui.cpp'
--- a/gui/gui.cpp 2010-07-12 07:48:07 +0000
+++ b/gui/gui.cpp 2010-07-19 08:08:00 +0000
@@ -424,9 +424,8 @@
if ( VM::isInitialized() )
{
- if ( _stage && _started )
- {
- _stage->set_display_viewport(0, 0, width, height);
+ if (_stage && _started) {
+ _stage->setDimensions(width, height);
}
}
=== modified file 'gui/pythonmod/gnash-view.cpp'
--- a/gui/pythonmod/gnash-view.cpp 2010-07-14 18:28:49 +0000
+++ b/gui/pythonmod/gnash-view.cpp 2010-07-19 08:08:00 +0000
@@ -259,7 +259,7 @@
gtk_widget_size_allocate (GTK_BIN(widget)->child, allocation);
if( view->stage.get() != NULL) {
- view->stage->set_display_viewport(0, 0, allocation->width,
allocation->height);
+ view->stage->setDimensions(allocation->width, allocation->height);
boost::shared_ptr<gnash::Renderer> renderer =
gnash_canvas_get_renderer(view->canvas);
float xscale = allocation->width /
view->movie_definition->get_width_pixels();
=== modified file 'libcore/Bitmap.cpp'
--- a/libcore/Bitmap.cpp 2010-06-18 12:26:04 +0000
+++ b/libcore/Bitmap.cpp 2010-07-19 08:08:00 +0000
@@ -48,8 +48,8 @@
_def(def),
_bitmapData(0),
_bitmapInfo(0),
- _width(twipsToPixels(def->get_frame_size().width())),
- _height(twipsToPixels(def->get_frame_size().height()))
+ _width(def->get_width_pixels()),
+ _height(def->get_height_pixels())
{
_shape.setBounds(def->get_frame_size());
}
=== modified file 'libcore/BitmapMovie.h'
--- a/libcore/BitmapMovie.h 2010-03-11 01:47:08 +0000
+++ b/libcore/BitmapMovie.h 2010-07-19 08:08:00 +0000
@@ -57,11 +57,11 @@
return _def->get_frame_rate();
}
- virtual float widthPixels() const {
+ virtual size_t widthPixels() const {
return _def->get_width_pixels();
}
- virtual float heightPixels() const {
+ virtual size_t heightPixels() const {
return _def->get_height_pixels();
}
=== modified file 'libcore/Movie.h'
--- a/libcore/Movie.h 2010-06-11 10:02:03 +0000
+++ b/libcore/Movie.h 2010-07-19 08:08:00 +0000
@@ -61,9 +61,9 @@
virtual float frameRate() const = 0;
- virtual float widthPixels() const = 0;
+ virtual size_t widthPixels() const = 0;
- virtual float heightPixels() const = 0;
+ virtual size_t heightPixels() const = 0;
virtual bool ensureFrameLoaded(size_t /*frameNo*/) const {
return true;
=== modified file 'libcore/SWFMovie.h'
--- a/libcore/SWFMovie.h 2010-06-11 10:07:21 +0000
+++ b/libcore/SWFMovie.h 2010-07-19 08:08:00 +0000
@@ -65,11 +65,11 @@
return _def->get_frame_rate();
}
- virtual float widthPixels() const {
+ virtual size_t widthPixels() const {
return _def->get_width_pixels();
}
- virtual float heightPixels() const {
+ virtual size_t heightPixels() const {
return _def->get_height_pixels();
}
=== modified file 'libcore/SWFRect.cpp'
--- a/libcore/SWFRect.cpp 2010-03-12 23:37:40 +0000
+++ b/libcore/SWFRect.cpp 2010-07-19 08:08:00 +0000
@@ -30,7 +30,8 @@
const boost::int32_t SWFRect::rectNull;
const boost::int32_t SWFRect::rectMax;
-void SWFRect::read(SWFStream& in)
+void
+SWFRect::read(SWFStream& in)
{
in.align();
in.ensureBits(5);
@@ -46,7 +47,7 @@
if (_xMax < _xMin || _yMax < _yMin)
{
// We set invalid rectangles to NULL, but we might instead
- // want to actually swap the values IFF the proprietary player
+ // want to actually swap the values if the proprietary player
// does so. TODO: check it out.
IF_VERBOSE_MALFORMED_SWF(
log_swferror("Invalid rectangle: "
=== modified file 'libcore/movie_root.cpp'
--- a/libcore/movie_root.cpp 2010-07-14 07:48:35 +0000
+++ b/libcore/movie_root.cpp 2010-07-19 08:08:00 +0000
@@ -134,10 +134,8 @@
_vm(VM::init(def.get_version(), *this, clock)),
_interfaceHandler(0),
_fsCommandHandler(0),
- m_viewport_x0(0),
- m_viewport_y0(0),
- m_viewport_width(1),
- m_viewport_height(1),
+ _stageWidth(1),
+ _stageHeight(1),
m_background_color(255, 255, 255, 255),
m_background_color_set(false),
_mouseX(0),
@@ -231,16 +229,14 @@
{
_rootMovie = movie;
- m_viewport_x0 = 0;
- m_viewport_y0 = 0;
const movie_definition* md = movie->definition();
float fps = md->get_frame_rate();
_movieAdvancementDelay = static_cast<int>(1000/fps);
_lastMovieAdvancement = _vm.getTime();
- m_viewport_width = static_cast<int>(md->get_width_pixels());
- m_viewport_height = static_cast<int>(md->get_height_pixels());
+ _stageWidth = static_cast<int>(md->get_width_pixels());
+ _stageHeight = static_cast<int>(md->get_height_pixels());
// assert(movie->get_depth() == 0); ?
movie->set_depth(DisplayObject::staticDepthOffset);
@@ -342,14 +338,13 @@
// ^^^ not confirmed in this date, I think other levels
// are dropped too! (strk)
- m_viewport_width = static_cast<int>(movie->widthPixels());
- m_viewport_height = static_cast<int>(movie->heightPixels());
+ _stageWidth = movie->widthPixels();
+ _stageHeight = movie->heightPixels();
// notify stage replacement
- if ( _interfaceHandler )
- {
+ if (_interfaceHandler) {
std::stringstream ss;
- ss << m_viewport_width << "x" << m_viewport_height;
+ ss << _stageWidth << "x" << _stageHeight;
_interfaceHandler->call("Stage.resize", ss.str());
}
}
@@ -557,14 +552,12 @@
}
void
-movie_root::set_display_viewport(int x0, int y0, int w, int h)
+movie_root::setDimensions(size_t w, size_t h)
{
assert(testInvariant());
- m_viewport_x0 = x0;
- m_viewport_y0 = y0;
- m_viewport_width = w;
- m_viewport_height = h;
+ _stageWidth = w;
+ _stageHeight = h;
if (_scaleMode == SCALEMODE_NOSCALE) {
as_object* stage = getBuiltinObject(*this, NSV::CLASS_STAGE);
@@ -986,8 +979,7 @@
renderer->begin_display(
m_background_color,
- m_viewport_x0, m_viewport_y0,
- m_viewport_width, m_viewport_height,
+ _stageWidth, _stageHeight,
frame_size.get_x_min(), frame_size.get_x_max(),
frame_size.get_y_min(), frame_size.get_y_max());
@@ -1173,28 +1165,28 @@
/// Get actionscript width of stage, in pixels. The width
/// returned depends on the scale mode.
-unsigned int
+size_t
movie_root::getStageWidth() const
{
if (_scaleMode == SCALEMODE_NOSCALE) {
- return m_viewport_width;
+ return _stageWidth;
}
// If scaling is allowed, always return the original movie size.
- return static_cast<unsigned int>(_rootMovie->widthPixels());
+ return static_cast<size_t>(_rootMovie->widthPixels());
}
/// Get actionscript height of stage, in pixels. The height
/// returned depends on the scale mode.
-unsigned int
+size_t
movie_root::getStageHeight() const
{
if (_scaleMode == SCALEMODE_NOSCALE) {
- return m_viewport_height;
+ return _stageHeight;
}
// If scaling is allowed, always return the original movie size.
- return static_cast<unsigned int>(_rootMovie->heightPixels());
+ return static_cast<size_t>(_rootMovie->heightPixels());
}
/// Takes a short int bitfield: the four bits correspond
@@ -1290,11 +1282,11 @@
const movie_definition* md = _rootMovie->definition();
log_debug("Going to or from scaleMode=noScale. Viewport:%dx%d "
- "Def:%dx%d", m_viewport_width, m_viewport_height,
+ "Def:%dx%d", _stageWidth, _stageHeight,
md->get_width_pixels(), md->get_height_pixels());
- if ( m_viewport_width != md->get_width_pixels()
- || m_viewport_height != md->get_height_pixels() )
+ if ( _stageWidth != md->get_width_pixels()
+ || _stageHeight != md->get_height_pixels() )
{
notifyResize = true;
}
@@ -2224,7 +2216,7 @@
/// Stage: rendered dimensions.
os.str("");
- os << m_viewport_width << "x" << m_viewport_height;
+ os << _stageWidth << "x" << _stageHeight;
localIter = tr.append_child(it, StringPair("Rendered dimensions",
os.str()));
#if 0
=== modified file 'libcore/movie_root.h'
--- a/libcore/movie_root.h 2010-07-14 07:48:35 +0000
+++ b/libcore/movie_root.h 2010-07-19 08:08:00 +0000
@@ -263,18 +263,20 @@
/// after loading into it.
void dropLevel(int depth);
- /// Change display viewport coordinates
- //
- /// This currently also change the display scale
- /// but we should instead only do it if rescaling
- /// is allowed.
- void set_display_viewport(int x0, int y0, int w, int h);
+ /// Change stage size
+ //
+ /// This may be smaller than the size of the root movie. It determines
+ /// how much of the movie is visible.
+ //
+ /// @param w The width of the stage
+ /// @param h The height of the stage.
+ void setDimensions(size_t w, size_t h);
/// Notional width of the stage, actual value depending on scaleMode
- unsigned getStageWidth() const;
+ size_t getStageWidth() const;
/// Notional height of the stage, actual value depending on scaleMode
- unsigned getStageHeight() const;
+ size_t getStageHeight() const;
/// Inform the Stage that the mouse has moved.
//
@@ -1069,10 +1071,9 @@
/// Process all actions in the queue
void processActionQueue();
- int m_viewport_x0, m_viewport_y0;
-
/// Width and height of viewport, in pixels
- int m_viewport_width, m_viewport_height;
+ size_t _stageWidth;
+ size_t _stageHeight;
rgba m_background_color;
bool m_background_color_set;
=== modified file 'libcore/parser/BitmapMovieDefinition.h'
--- a/libcore/parser/BitmapMovieDefinition.h 2010-06-03 17:32:50 +0000
+++ b/libcore/parser/BitmapMovieDefinition.h 2010-07-19 08:08:00 +0000
@@ -65,11 +65,11 @@
return _version;
}
- virtual float get_width_pixels() const {
+ virtual size_t get_width_pixels() const {
return std::ceil(twipsToPixels(_framesize.width()));
}
- virtual float get_height_pixels() const {
+ virtual size_t get_height_pixels() const {
return std::ceil(twipsToPixels(_framesize.height()));
}
=== modified file 'libcore/parser/SWFMovieDefinition.h'
--- a/libcore/parser/SWFMovieDefinition.h 2010-06-11 14:03:55 +0000
+++ b/libcore/parser/SWFMovieDefinition.h 2010-07-19 08:08:00 +0000
@@ -186,11 +186,11 @@
return m_frame_size;
}
- float get_width_pixels() const {
+ size_t get_width_pixels() const {
return std::ceil(twipsToPixels(m_frame_size.width()));
}
- float get_height_pixels() const {
+ size_t get_height_pixels() const {
return std::ceil(twipsToPixels(m_frame_size.height()));
}
=== modified file 'libcore/parser/movie_definition.h'
--- a/libcore/parser/movie_definition.h 2010-06-12 08:32:05 +0000
+++ b/libcore/parser/movie_definition.h 2010-07-19 08:08:00 +0000
@@ -104,8 +104,17 @@
typedef std::vector<boost::intrusive_ptr<SWF::ControlTag> > PlayList;
virtual int get_version() const = 0;
- virtual float get_width_pixels() const = 0;
- virtual float get_height_pixels() const = 0;
+
+ /// Frame width in pixels.
+ //
+ /// The frame size is in twips and may be rounded up.
+ virtual size_t get_width_pixels() const = 0;
+
+ /// Frame height in pixels.
+ //
+ /// The frame size is in twips and may be rounded up.
+ virtual size_t get_height_pixels() const = 0;
+
virtual size_t get_frame_count() const = 0;
virtual float get_frame_rate() const = 0;
=== modified file 'libcore/parser/sprite_definition.h'
--- a/libcore/parser/sprite_definition.h 2010-06-11 14:03:55 +0000
+++ b/libcore/parser/sprite_definition.h 2010-07-19 08:08:00 +0000
@@ -94,13 +94,13 @@
}
// overload from movie_definition
- virtual float get_width_pixels() const { return 1; }
-
- // overload from movie_definition
- virtual float get_height_pixels() const { return 1; }
-
- // overload from movie_definition
- virtual size_t get_frame_count() const { return m_frame_count; }
+ virtual size_t get_width_pixels() const { return 1; }
+
+ // overload from movie_definition
+ virtual size_t get_height_pixels() const { return 1; }
+
+ // overload from movie_definition
+ virtual size_t get_frame_count() const { return m_frame_count; }
/// \brief
/// Return total bytes of the movie from which this sprite
=== modified file 'librender/ProxyRenderer.h'
--- a/librender/ProxyRenderer.h 2010-03-11 01:47:08 +0000
+++ b/librender/ProxyRenderer.h 2010-07-19 07:43:01 +0000
@@ -67,7 +67,6 @@
/// See Renderer::begin_display (in backend/Renderer.h)
void begin_display(
const rgba& background_color,
- int viewport_x0, int viewport_y0,
int viewport_width, int viewport_height,
float x0, float x1, float y0, float y1);
=== modified file 'librender/Renderer.h'
--- a/librender/Renderer.h 2010-07-18 07:46:05 +0000
+++ b/librender/Renderer.h 2010-07-19 07:43:01 +0000
@@ -362,8 +362,8 @@
/// coordinates of the movie that correspond to the viewport
/// bounds.
///
- virtual void begin_display(const rgba& background_color, int viewport_x0,
- int viewport_y0, int viewport_width, int viewport_height,
+ virtual void begin_display(const rgba& background_color,
+ int viewport_width, int viewport_height,
float x0, float x1, float y0, float y1) = 0;
virtual void end_display() = 0;
=== modified file 'librender/Renderer_agg.cpp'
--- a/librender/Renderer_agg.cpp 2010-04-04 22:55:35 +0000
+++ b/librender/Renderer_agg.cpp 2010-07-19 07:48:54 +0000
@@ -462,12 +462,13 @@
public:
/// Render the pixels using this renderer
- typedef typename agg::renderer_base<PixelFormat> Renderer;
- typedef agg::rasterizer_scanline_aa<> Rasterizer;
+ typedef typename agg::renderer_base<PixelFormat> Renderer;
+ typedef agg::rasterizer_scanline_aa<> Rasterizer;
EmptyVideoRenderer(const ClipBounds& clipbounds)
- : _clipbounds(clipbounds)
- {}
+ :
+ _clipbounds(clipbounds)
+ {}
void render(agg::path_storage& path, Renderer& rbase,
const AlphaMasks& masks)
@@ -852,7 +853,6 @@
void begin_display(
const gnash::rgba& bg,
- int /*viewport_x0*/, int /*viewport_y0*/,
int /*viewport_width*/, int /*viewport_height*/,
float /*x0*/, float /*x1*/, float /*y0*/, float /*y1*/)
{
=== modified file 'librender/Renderer_cairo.cpp'
--- a/librender/Renderer_cairo.cpp 2010-03-31 16:27:41 +0000
+++ b/librender/Renderer_cairo.cpp 2010-07-19 07:43:01 +0000
@@ -548,7 +548,6 @@
void
Renderer_cairo::begin_display(const rgba& bg_color,
- int /*viewport_x0*/, int /*viewport_y0*/,
int /*viewport_width*/, int /*viewport_height*/,
float /*x0*/, float /*x1*/, float /*y0*/, float /*y1*/)
{
=== modified file 'librender/Renderer_cairo.h'
--- a/librender/Renderer_cairo.h 2010-03-11 01:47:08 +0000
+++ b/librender/Renderer_cairo.h 2010-07-19 07:43:01 +0000
@@ -51,7 +51,6 @@
void set_invalidated_regions(const InvalidatedRanges& ranges);
void begin_display(const rgba& bg_color,
- int viewport_x0, int viewport_y0,
int viewport_width, int viewport_height,
float x0, float x1, float y0, float y1);
=== modified file 'librender/Renderer_ogl.cpp'
--- a/librender/Renderer_ogl.cpp 2010-04-04 22:55:35 +0000
+++ b/librender/Renderer_ogl.cpp 2010-07-19 07:43:01 +0000
@@ -859,11 +859,10 @@
public:
virtual void begin_display(
const rgba& bg_color,
- int viewport_x0, int viewport_y0,
int viewport_width, int viewport_height,
float x0, float x1, float y0, float y1)
{
- glViewport(viewport_x0, viewport_y0, viewport_width, viewport_height);
+ glViewport(0, 0, viewport_width, viewport_height);
glLoadIdentity();
gluOrtho2D(x0, x1, y0, y1);
=== modified file 'testsuite/DummyMovieDefinition.h'
--- a/testsuite/DummyMovieDefinition.h 2010-03-11 01:47:08 +0000
+++ b/testsuite/DummyMovieDefinition.h 2010-07-19 09:09:35 +0000
@@ -104,11 +104,11 @@
return _version;
}
- virtual float get_width_pixels() const {
+ virtual size_t get_width_pixels() const {
return _framesize.width()/20;
}
- virtual float get_height_pixels() const {
+ virtual size_t get_height_pixels() const {
return _framesize.height()/20;
}
=== modified file 'testsuite/MovieTester.cpp'
--- a/testsuite/MovieTester.cpp 2010-07-14 13:43:06 +0000
+++ b/testsuite/MovieTester.cpp 2010-07-19 08:08:00 +0000
@@ -287,7 +287,7 @@
void
MovieTester::resizeStage(int x, int y)
{
- _movie_root->set_display_viewport(0, 0, x, y);
+ _movie_root->setDimensions(x, y);
if (_movie_root->getStageScaleMode() != movie_root::SCALEMODE_NOSCALE) {
// TODO: fix to deal with all scale modes
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r12312: Remove the obviously silly arguments from Renderer::begin_display and,
Benjamin Wolsey <=