[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash/server fill_style.cpp fill_style.h
From: |
Bastiaan Jacques |
Subject: |
[Gnash-commit] gnash/server fill_style.cpp fill_style.h |
Date: |
Wed, 28 May 2008 08:06:05 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Bastiaan Jacques <bjacques> 08/05/28 08:06:05
Modified files:
server : fill_style.cpp fill_style.h
Log message:
missing files for last commit
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/server/fill_style.cpp?cvsroot=gnash&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/gnash/server/fill_style.h?cvsroot=gnash&r1=1.19&r2=1.20
Patches:
Index: fill_style.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/fill_style.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- fill_style.cpp 20 May 2008 11:40:40 -0000 1.29
+++ fill_style.cpp 28 May 2008 08:06:05 -0000 1.30
@@ -55,9 +55,10 @@
m_type(SWF::FILL_SOLID),
m_color(), // FF.FF.FF.FF
m_gradient_bitmap_info(0),
- m_bitmap_character(0)
+ m_bitmap_character(0),
+ m_spread_mode(SWF::GRADIENT_SPREAD_PAD),
+ m_interpolation(SWF::GRADIENT_INTERPOL_NORMAL)
{
- assert(m_gradients.size() == 0);
}
@@ -142,10 +143,42 @@
// GRADIENT
in->ensureBytes(1);
- // num_gradients is not 8 bits, it is only the last 4.
- // at the moment, the first four are unused, so we may
- // mask, but this needs to be changed.
- unsigned int num_gradients = in->read_u8() & 15;
+
+ uint8_t grad_props = in->read_u8();
+
+ if (tag_type == SWF::DEFINESHAPE4 ||
+ tag_type == SWF::DEFINESHAPE4_) {
+ uint8_t spread_mode = grad_props >> 6;
+ switch(spread_mode) {
+ case 0:
+ m_spread_mode = SWF::GRADIENT_SPREAD_PAD;
+ break;
+ case 1:
+ m_spread_mode = SWF::GRADIENT_SPREAD_REFLECT;
+ break;
+ case 2:
+ m_spread_mode = SWF::GRADIENT_SPREAD_REPEAT;
+ break;
+ default:
+ IF_VERBOSE_MALFORMED_SWF(
+ log_swferror("Illegal spread mode in gradient
definition.");
+ );
+ }
+
+ uint8_t interpolation = (grad_props >> 4) & 3;
+ switch(interpolation) {
+ case 0:
+ m_interpolation = SWF::GRADIENT_INTERPOL_NORMAL;
+ case 1:
+ m_interpolation = SWF::GRADIENT_INTERPOL_LINEAR;
+ default:
+ IF_VERBOSE_MALFORMED_SWF(
+ log_swferror("Illegal interpolation mode in
gradient definition.");
+ );
+ }
+ }
+
+ uint8_t num_gradients = grad_props & 0xF;
if ( ! num_gradients )
{
IF_VERBOSE_MALFORMED_SWF(
Index: fill_style.h
===================================================================
RCS file: /sources/gnash/gnash/server/fill_style.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- fill_style.h 21 Apr 2008 11:27:43 -0000 1.19
+++ fill_style.h 28 May 2008 08:06:05 -0000 1.20
@@ -22,9 +22,9 @@
#define GNASH_FILL_STYLE_H
#include "smart_ptr.h" // GNASH_USE_GC
-#include "types.h"
#include "matrix.h"
#include "bitmap_character_def.h"
+#include "swf.h"
#include <vector> // for composition
@@ -151,6 +151,12 @@
/// Get fill type, see SWF::fill_style_type
int get_type() const { return m_type; }
+ SWF::gradient_spread_mode get_gradient_spread_mode()
+ { return m_spread_mode; }
+
+ SWF::gradient_interpolation_mode get_gradient_interpolation_mode()
+ { return m_interpolation; }
+
/// Sets this style to a blend of a and b. t = [0,1] (for shape
morphing)
void set_lerp(const fill_style& a, const fill_style& b, float t);
@@ -216,6 +222,9 @@
boost::intrusive_ptr<gnash::bitmap_info> m_gradient_bitmap_info;
boost::intrusive_ptr<bitmap_character_def> m_bitmap_character;
matrix m_bitmap_matrix;
+
+ SWF::gradient_spread_mode m_spread_mode;
+ SWF::gradient_interpolation_mode m_interpolation;
};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash/server fill_style.cpp fill_style.h,
Bastiaan Jacques <=