[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/parser/bitmap_character_...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog server/parser/bitmap_character_... |
Date: |
Tue, 26 Sep 2006 08:40:23 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 06/09/26 08:40:23
Modified files:
. : ChangeLog
server/parser : bitmap_character_def.cpp bitmap_character_def.h
server/swf : tag_loaders.cpp
Log message:
* server/parser/bitmap_character_def.cpp,
server/parser/bitmap_character_def.h: changed interface
to construct bitmap_info at construction time, and to
take image::rgb(a) by std::auto_ptr (fixes memory leaks).
* server/swf/tag_loaders.cpp: updated calls to
bitmap_character_def.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.923&r2=1.924
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/bitmap_character_def.cpp?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/bitmap_character_def.h?cvsroot=gnash&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/tag_loaders.cpp?cvsroot=gnash&r1=1.49&r2=1.50
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.923
retrieving revision 1.924
diff -u -b -r1.923 -r1.924
--- ChangeLog 26 Sep 2006 08:15:51 -0000 1.923
+++ ChangeLog 26 Sep 2006 08:40:23 -0000 1.924
@@ -1,5 +1,10 @@
2006-09-26 Sandro Santilli <address@hidden>
+ * server/parser/bitmap_character_def.cpp,
+ server/parser/bitmap_character_def.h: changed interface
+ to construct bitmap_info at construction time, and to
+ take image::rgb(a) by std::auto_ptr (fixes memory leaks).
+ * server/swf/tag_loaders.cpp: updated calls to bitmap_character_def.
* server/parser/movie_def_impl.h: doxygen comments update.
* server/Makefile.am, server/bitmap_character_instance.cpp,
server/bitmap_character_instance.h,
Index: server/parser/bitmap_character_def.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/parser/bitmap_character_def.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- server/parser/bitmap_character_def.cpp 26 Sep 2006 08:15:51 -0000
1.2
+++ server/parser/bitmap_character_def.cpp 26 Sep 2006 08:40:23 -0000
1.3
@@ -54,38 +54,23 @@
#include <vector>
#include <string>
#include <cassert>
+#include <memory> // for auto_ptr
using namespace std;
namespace gnash {
-gnash::bitmap_info*
-bitmap_character_def::get_bitmap_info()
+bitmap_character_def::bitmap_character_def(std::auto_ptr<image::rgb> image)
+ :
+ _bitmap_info ( gnash::render::create_bitmap_info_rgb(image.get()) )
{
- if ( ! _bitmap_info.get_ptr() )
- {
- // Create our bitmap info, from our image.
- if ( _image.type == 0 )
- {
- _bitmap_info =
gnash::render::create_bitmap_info_rgb(_image.rgb);
- }
- else
- {
- _bitmap_info =
gnash::render::create_bitmap_info_rgba(_image.rgba);
- }
- }
- assert(_bitmap_info.get_ptr());
- return _bitmap_info.get_ptr();
}
-#if 0
-character*
-bitmap_character_def::create_character_instance(character* parent, int id)
+bitmap_character_def::bitmap_character_def(std::auto_ptr<image::rgba> image)
+ :
+ _bitmap_info ( gnash::render::create_bitmap_info_rgba(image.get()) )
{
- bitmap_character_instance* instance = new bitmap_character_instance(
- this, parent, -1);
- return instance;
}
-#endif
+
} // namespace gnash
Index: server/parser/bitmap_character_def.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/bitmap_character_def.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- server/parser/bitmap_character_def.h 26 Sep 2006 08:15:51 -0000
1.8
+++ server/parser/bitmap_character_def.h 26 Sep 2006 08:40:23 -0000
1.9
@@ -51,21 +51,13 @@
#include "utility.h"
#include "smart_ptr.h"
//#include "movie_interface.h"
+
#include <cstdarg>
#include <cassert>
+#include <memory> // for auto_ptr
namespace gnash {
-/// Dirty wrapper around image::{rgb,rgba}
-struct image_rgb_or_rgba : public ref_counted
-{
- int type; // 0: rgb, 1: rgba
- union {
- image::rgb* rgb;
- image::rgba* rgba;
- };
-};
-
/// Definition of a bitmap character
//
/// This includes:
@@ -80,49 +72,38 @@
/// or image::rgba pointer. We should probably move
/// the methods for actually reading such tags instead.
///
+/// One problem with this class is that it relies on the
+/// availability of a render_handler in order to transform
+/// image::rgb or image::rgba to a bitmap_info.
+///
class bitmap_character_def : public ref_counted
{
public:
- bitmap_character_def(image::rgb* image)
- {
- assert(image != 0);
- _image.type = 0;
- _image.rgb = image;
- }
+ /// Construct a bitmap_character_def from an image::rgb
+ //
+ /// NOTE: uses currently registered render_handler to
+ /// create a bitmap_info, don't call before a renderer
+ /// has been registered
+ ///
+ bitmap_character_def(std::auto_ptr<image::rgb> image);
+
+ /// Construct a bitmap_character_def from an image::rgba
+ //
+ /// NOTE: uses currently registered render_handler to
+ /// create a bitmap_info, don't call before a renderer
+ /// has been registered
+ ///
+ bitmap_character_def(std::auto_ptr<image::rgba> image);
- bitmap_character_def(image::rgba* image)
- {
- assert(image != 0);
- _image.type = 1;
- _image.rgba = image;
+ gnash::bitmap_info* get_bitmap_info() {
+ return _bitmap_info.get_ptr();
}
-#if 0
- virtual character* create_character_instance(character* parent,
- int id);
-#endif
-
- // Use the renderer to create a bitmap_info from the image
- // information. DO NOT CALL THIS FUNCTION FROM THE PARSER LIB !
- gnash::bitmap_info* get_bitmap_info();
-
-#if 0 // this would be the preferred interface to set a cache from the
- // outside. currently unused
- void set_bitmap_info(smart_ptr<gnash::bitmap_info> bi)
- {
- _bitmap_info = bi;
- }
-#endif
-
-
private:
smart_ptr<gnash::bitmap_info> _bitmap_info;
-
- image_rgb_or_rgba _image;
-
};
Index: server/swf/tag_loaders.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/swf/tag_loaders.cpp,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -b -r1.49 -r1.50
--- server/swf/tag_loaders.cpp 25 Sep 2006 16:00:57 -0000 1.49
+++ server/swf/tag_loaders.cpp 26 Sep 2006 08:40:23 -0000 1.50
@@ -36,7 +36,7 @@
//
//
-/* $Id: tag_loaders.cpp,v 1.49 2006/09/25 16:00:57 strk Exp $ */
+/* $Id: tag_loaders.cpp,v 1.50 2006/09/26 08:40:23 strk Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -262,7 +262,7 @@
assert(j_in);
j_in->discard_partial_buffer();
- image::rgb* im = image::read_swf_jpeg2_with_tables(j_in);
+ std::auto_ptr<image::rgb> im (
image::read_swf_jpeg2_with_tables(j_in) );
//bi = render::create_bitmap_info_rgb(im);
//delete im;
#else
@@ -302,7 +302,7 @@
{
//bitmap_info* bi = NULL;
#if TU_CONFIG_LINK_TO_JPEGLIB
- image::rgb* im = image::read_jpeg(in->get_underlying_stream());
+ std::auto_ptr<image::rgb> im (
image::read_jpeg(in->get_underlying_stream()) );
//bi = render::create_bitmap_info_rgb(im);
//delete im;
#else
@@ -393,7 +393,6 @@
if (m->get_create_bitmaps() == DO_LOAD_BITMAPS)
{
- image::rgba* im = NULL;
#if TU_CONFIG_LINK_TO_JPEGLIB == 0 || TU_CONFIG_LINK_TO_ZLIB == 0
log_error("gnash is not linked to jpeglib/zlib -- can't load
jpeg/zipped image data!\n");
@@ -404,7 +403,7 @@
//
// Read rgb data.
- im = image::read_swf_jpeg3(in->get_underlying_stream());
+ std::auto_ptr<image::rgba> im(
image::read_swf_jpeg3(in->get_underlying_stream()) );
// Read alpha channel.
in->set_position(alpha_position);
@@ -421,13 +420,11 @@
delete [] buffer;
- //bitmap_info* bi = render::create_bitmap_info_rgba(im);
- //delete im;
-#endif
// Create bitmap character.
bitmap_character_def* ch = new bitmap_character_def(im);
m->add_bitmap_character_def(character_id, ch);
+#endif
}
}
@@ -462,10 +459,10 @@
log_error("gnash is not linked to zlib -- can't load zipped image
data!\n");
return;
#else
- if (tag == 20)
+ if (tag == SWF::DEFINELOSSLESS) // 20
{
// RGB image data.
- image::rgb* image = image::create_rgb(width, height);
+ std::auto_ptr<image::rgb> image ( image::create_rgb(width,
height) );
if (bitmap_format == 3)
{
@@ -488,7 +485,7 @@
for (int j = 0; j < height; j++)
{
uint8_t* image_in_row = buffer +
color_table_size * 3 + j * pitch;
- uint8_t* image_out_row =
image::scanline(image, j);
+ uint8_t* image_out_row =
image::scanline(image.get(), j);
for (int i = 0; i < width; i++)
{
uint8_t pixel = image_in_row[i
* bytes_per_pixel];
@@ -515,7 +512,7 @@
for (int j = 0; j < height; j++)
{
uint8_t* image_in_row = buffer + j *
pitch;
- uint8_t* image_out_row =
image::scanline(image, j);
+ uint8_t* image_out_row =
image::scanline(image.get(), j);
for (int i = 0; i < width; i++)
{
uint16_t pixel = image_in_row[i
* 2] | (image_in_row[i * 2 + 1] << 8);
@@ -545,7 +542,7 @@
for (int j = 0; j < height; j++)
{
uint8_t* image_in_row = buffer + j *
pitch;
- uint8_t* image_out_row =
image::scanline(image, j);
+ uint8_t* image_out_row =
image::scanline(image.get(), j);
for (int i = 0; i < width; i++)
{
uint8_t a = image_in_row[i * 4
+ 0];
@@ -574,7 +571,7 @@
// RGBA image data.
assert(tag == SWF::DEFINELOSSLESS2); // 36
- image::rgba* image = image::create_rgba(width, height);
+ std::auto_ptr<image::rgba> image (
image::create_rgba(width, height) );
if (bitmap_format == 3)
{
@@ -597,7 +594,7 @@
for (int j = 0; j < height; j++)
{
uint8_t* image_in_row = buffer +
color_table_size * 4 + j * pitch;
- uint8_t* image_out_row =
image::scanline(image, j);
+ uint8_t* image_out_row =
image::scanline(image.get(), j);
for (int i = 0; i < width; i++)
{
uint8_t pixel = image_in_row[i
* bytes_per_pixel];
@@ -625,7 +622,7 @@
for (int j = 0; j < height; j++)
{
uint8_t* image_in_row = buffer + j *
pitch;
- uint8_t* image_out_row =
image::scanline(image, j);
+ uint8_t* image_out_row =
image::scanline(image.get(), j);
for (int i = 0; i < width; i++)
{
uint16_t pixel = image_in_row[i
* 2] | (image_in_row[i * 2 + 1] << 8);
@@ -650,7 +647,7 @@
// Need to re-arrange ARGB into RGBA.
for (int j = 0; j < height; j++)
{
- uint8_t* image_row =
image::scanline(image, j);
+ uint8_t* image_row =
image::scanline(image.get(), j);
for (int i = 0; i < width; i++)
{
uint8_t a = image_row[i * 4 +
0];
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog server/parser/bitmap_character_...,
Sandro Santilli <=