void DefineEditTextTag::read(SWFStream& in, movie_definition& m) { _rect = readRect(in); in.align(); in.ensureBytes(2); int flags = in.read_u8(); _hasText = flags & (1 << 7); _wordWrap = flags & (1 << 6); _multiline = flags & (1 << 5); _password = flags & (1 << 4); _readOnly = flags & (1 << 3); const bool hasColor = flags & (1 << 2); const bool hasMaxChars = flags & (1 << 1); const bool hasFont = flags & (1 << 0); flags = in.read_u8(); // 0: no font class, 1 font class and height, can't be true if has_font was true bool hasFontClass = flags & (1 << 7); if (hasFontClass && hasFont ) { IF_VERBOSE_MALFORMED_SWF( log_swferror("DefineEditText: hasFontClass can't be true if " "hasFont is true, ignoring"); );
/// Format of the bit-packed rectangle is: /// /// bits | name | description /// ------+-------+------------------------- /// 5 | nbits | number of bits used in subsequent values /// nbits | xmin | minimum X value /// nbits | xmax | maximum X value /// nbits | ymin | minimum Y value /// nbits | ymax | maximum Y value /// /// If max values are less then min values the SWF is malformed; /// in this case this method will raise an swf_error and set the /// rectangle to the NULL rectangle. See is_null(). SWFRect readRect(SWFStream& in) { in.align(); in.ensureBits(5); const int nbits = in.read_uint(5); int minx = 0, maxx = 0, miny = 0, maxy = 0; if (nbits > 0) { in.ensureBits(nbits*4); minx = in.read_sint(nbits); maxx = in.read_sint(nbits); miny = in.read_sint(nbits); maxy = in.read_sint(nbits); } // Check if this SWFRect is valid. if (maxx < minx || maxy < miny) { // We set invalid rectangles to NULL, but we might instead // want to actually swap the values if the proprietary player // does so. TODO: check it out. IF_VERBOSE_MALFORMED_SWF( log_swferror(_("Invalid rectangle: " "minx=%g maxx=%g miny=%g maxy=%g"), minx, maxx, miny, maxy); );
// read placeObject2 actions void PlaceObject2Tag::readPlaceActions(SWFStream& in) { const int movie_version = _movie_def.get_version(); in.ensureBytes(2); std::uint16_t reserved = in.read_u16(); IF_VERBOSE_MALFORMED_SWF( if (reserved != 0) { log_swferror(_("Reserved field in PlaceObject actions == " "%u (expected 0)"), reserved); } );
// Updates the transform properties of the DisplayObject at // the specified depth. void DisplayList::moveDisplayObject(int depth, const SWFCxForm* color_xform, const SWFMatrix* mat, boost::uint16_t* ratio) { testInvariant(); DisplayObject* ch = getDisplayObjectAtDepth(depth); if (! ch) { // FIXME, should this be log_aserror? IF_VERBOSE_MALFORMED_SWF( log_swferror(_("moveDisplayObject() -- can't find object at depth %d"), depth); );