Projects
Essentials
lightspark
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 93
View file
lightspark.spec
Changed
@@ -20,7 +20,7 @@ %bcond_without rtmp Name: lightspark -Version: 0.7.2.99+git20160105.1059 +Version: 0.7.2.99+git20160111.1047 Release: 0 Summary: Modern, free, open-source flash player implementation License: LGPL-3.0+
View file
lightspark.tar.xz/ChangeLog
Changed
@@ -2,6 +2,8 @@ Version NEXT: + * implement rendering of embedded fonts in TextFields + * fix handling of multiple streams in SDL audio plugin, adds dependency on sdl_mixer * switch to internal xml parsing (based on pugixml), removes dependency on libxml++ * compilation using clang possible * implement several missing opcodes
View file
lightspark.tar.xz/src/backends/graphics.cpp
Changed
@@ -389,7 +389,7 @@ return pattern; } -bool CairoTokenRenderer::cairoPathFromTokens(cairo_t* cr, const std::vector<GeomToken>& tokens, double scaleCorrection, bool skipPaint) +bool CairoTokenRenderer::cairoPathFromTokens(cairo_t* cr, const tokensVector& tokens, double scaleCorrection, bool skipPaint) { cairo_scale(cr, scaleCorrection, scaleCorrection); @@ -705,7 +705,7 @@ return ret; } -bool CairoTokenRenderer::hitTest(const std::vector<GeomToken>& tokens, float scaleFactor, number_t x, number_t y) +bool CairoTokenRenderer::hitTest(const tokensVector& tokens, float scaleFactor, number_t x, number_t y) { cairo_surface_t* cairoSurface=cairo_image_surface_create_for_data(NULL, CAIRO_FORMAT_ARGB32, 0, 0, 0); cairo_t *cr=cairo_create(cairoSurface);
View file
lightspark.tar.xz/src/backends/graphics.h
Changed
@@ -302,12 +302,12 @@ { private: static cairo_pattern_t* FILLSTYLEToCairo(const FILLSTYLE& style, double scaleCorrection); - static bool cairoPathFromTokens(cairo_t* cr, const std::vector<GeomToken>& tokens, double scaleCorrection, bool skipFill); + static bool cairoPathFromTokens(cairo_t* cr, const tokensVector &tokens, double scaleCorrection, bool skipFill); static void quadraticBezier(cairo_t* cr, double control_x, double control_y, double end_x, double end_y); /* The tokens to be drawn */ - const std::vector<GeomToken> tokens; + const tokensVector tokens; /* * This is run by CairoRenderer::execute() */ @@ -325,7 +325,7 @@ @param _a The alpha factor to be applied @param _ms The masks that must be applied */ - CairoTokenRenderer(const std::vector<GeomToken>& _g, const MATRIX& _m, + CairoTokenRenderer(const tokensVector& _g, const MATRIX& _m, int32_t _x, int32_t _y, int32_t _w, int32_t _h, float _s, float _a, const std::vector<MaskData>& _ms) : CairoRenderer(_m,_x,_y,_w,_h,_s,_a,_ms),tokens(_g){} @@ -337,7 +337,7 @@ @param x The X in local coordinates @param y The Y in local coordinates */ - static bool hitTest(const std::vector<GeomToken>& tokens, float scaleFactor, number_t x, number_t y); + static bool hitTest(const tokensVector& tokens, float scaleFactor, number_t x, number_t y); }; class TextData
View file
lightspark.tar.xz/src/parsing/amf3_generator.cpp
Changed
@@ -216,7 +216,7 @@ throw ParseException("invalid marker in AMF3 vector"); } - _R<lightspark::Vector> ret=_MR(Template<Vector>::getInstanceS(type)); + _R<lightspark::Vector> ret=_MR(Template<Vector>::getInstanceS(type,ABCVm::getCurrentApplicationDomain(getVm()->currentCallContext))); //Add object to the map objMap.push_back(ret.getPtr());
View file
lightspark.tar.xz/src/parsing/tags.cpp
Changed
@@ -307,6 +307,9 @@ if(HasFont) { in >> FontID; + DefineFont3Tag* fonttag = dynamic_cast<DefineFont3Tag*>(root->dictionaryLookup(FontID)); + if (fonttag) + textData.font = fonttag->getFontname(); if(HasFontClass) in >> FontClass; in >> FontHeight; @@ -706,6 +709,8 @@ } //TODO: implment Kerning support ignore(in,KerningCount*4); + root->registerEmbeddedFont(getFontname(),this); + } ASObject* DefineFont3Tag::instance(Class_base* c) const { @@ -724,6 +729,57 @@ return ret; } +const tiny_string DefineFont3Tag::getFontname() const +{ + return tiny_string((const char*)FontName.data(),true); +} + +void DefineFont3Tag::fillTextTokens(tokensVector &tokens, const tiny_string text, int fontpixelsize,RGB textColor) const +{ + std::list<FILLSTYLE> fillStyles; + Vector2 curPos; + FILLSTYLE fs(1); + fs.FillStyleType = SOLID_FILL; + fs.Color = RGBA(textColor.Red,textColor.Green,textColor.Blue,255); + fillStyles.push_back(fs); + + number_t tokenscaling = fontpixelsize * this->scaling; + curPos.y = 20*1024 * this->scaling; + + for (CharIterator it = text.begin(); it != text.end(); it++) + { + if (*it == 13) + { + curPos.x = 0; + curPos.y += 20*1024 * this->scaling; + } + else + { + bool found = false; + for (uint i = 0; i < CodeTable.size(); i++) + { + if (CodeTable[i] == *it) + { + const std::vector<SHAPERECORD>& sr = getGlyphShapes().at(i).ShapeRecords; + Vector2 glyphPos = curPos*tokenscaling; + + MATRIX glyphMatrix(tokenscaling, tokenscaling, 0, 0, + glyphPos.x, + glyphPos.y); + + TokenContainer::FromShaperecordListToShapeVector(sr,tokens,fillStyles,glyphMatrix); + + curPos.x += FontAdvanceTable[i]; + found = true; + break; + } + } + if (!found) + LOG(LOG_INFO,"DefineFont3Tag:Character not found:"<<(int)*it<<" "<<text); + } + } +} + DefineFont4Tag::DefineFont4Tag(RECORDHEADER h, std::istream& in, RootMovieClip* root):DictionaryTag(h,root) { LOG(LOG_TRACE,_("DefineFont4"));
View file
lightspark.tar.xz/src/parsing/tags.h
Changed
@@ -488,6 +488,8 @@ public: DefineFont3Tag(RECORDHEADER h, std::istream& in, RootMovieClip* root); ASObject* instance(Class_base* c=NULL) const; + const tiny_string getFontname() const; + void fillTextTokens(tokensVector &tokens, const tiny_string text, int fontpixelsize, RGB textColor) const; }; class DefineFont4Tag : public DictionaryTag
View file
lightspark.tar.xz/src/scripting/abc.cpp
Changed
@@ -2104,6 +2104,10 @@ { case traits_info::Class: { + // check if class is alreadey defined in this context + if (root->applicationDomain->getVariableByMultinameOpportunistic(*mname)) + return; + //Check if this already defined in upper levels _NR<ASObject> tmpo=obj->getVariableByMultiname(*mname,ASObject::SKIP_IMPL); if(!tmpo.isNull()) @@ -2171,13 +2175,14 @@ { MemoryAccount* memoryAccount = getSys()->allocateMemoryAccount(className.name); Class_inherit* c=new (getSys()->unaccountedMemory) Class_inherit(className, memoryAccount); + c->context = this; if(instances[t->classi].supername) { // set superclass for classes that are not instantiated by newClass opcode (e.g. buttons) multiname mnsuper = *getMultiname(instances[t->classi].supername,NULL); ASObject* superclass=root->applicationDomain->getVariableByMultinameOpportunistic(mnsuper); - if(superclass && superclass->is<Class_base>()) + if(superclass && superclass->is<Class_base>() && !superclass->is<Class_inherit>()) { superclass->incRef(); c->setSuper(_MR(superclass->as<Class_base>()));
View file
lightspark.tar.xz/src/scripting/abc_opcodes.cpp
Changed
@@ -809,7 +809,7 @@ throw Class<TypeError>::getInstanceS("Wrong type in applytype"); } - Class_base* o_class = o_template->applyType(t); + Class_base* o_class = o_template->applyType(t,th->context->root->applicationDomain); // Register the type name in the global scope. The type name // is later used by the coerce opcode. @@ -1669,11 +1669,12 @@ } else { + tiny_string clsname = obj->getClassName(); obj->decRef(); for(int i=0;i<m;i++) args[i]->decRef(); //LOG(LOG_ERROR,_("Calling an undefined function ") << getSys()->getStringFromUniqueId(name->name_s_id)); - throwError<ReferenceError>(kCallNotFoundError, name->qualifiedString(), obj->getClassName()); + throwError<ReferenceError>(kCallNotFoundError, name->qualifiedString(), clsname); if(keepReturn) th->runtime_stack_push(getSys()->getUndefinedRef()); }
View file
lightspark.tar.xz/src/scripting/class.h
Changed
@@ -22,6 +22,7 @@ #include "scripting/toplevel/Integer.h" #include "scripting/toplevel/UInteger.h" #include "scripting/toplevel/Vector.h" +#include "scripting/flash/system/flashsystem.h" #include "compat.h" #include "asobject.h" #include "swf.h" @@ -418,17 +419,22 @@ return ret; } - Class_base* applyType(const std::vector<const Type*>& types) + Class_base* applyType(const std::vector<const Type*>& types,_NR<ApplicationDomain> applicationDomain) { QName instantiatedQName = getQName(types); + _NR<ApplicationDomain> appdomain = applicationDomain; + + // if type is a builtin class, it is handled in the systemDomain + if (appdomain.isNull() || (types.size() > 0 && !dynamic_cast<const Class_inherit*>(types[0]))) + appdomain = getSys()->systemDomain; - std::map<QName, Class_base*>::iterator it=getSys()->instantiatedTemplates.find(instantiatedQName); + std::map<QName, Class_base*>::iterator it=appdomain->instantiatedTemplates.find(instantiatedQName); Class<T>* ret=NULL; - if(it==getSys()->instantiatedTemplates.end()) //This class is not yet in the map, create it + if(it==appdomain->instantiatedTemplates.end()) //This class is not yet in the map, create it { MemoryAccount* memoryAccount = getSys()->allocateMemoryAccount(instantiatedQName.name); ret=new (getSys()->unaccountedMemory) TemplatedClass<T>(instantiatedQName,types,this,memoryAccount); - getSys()->instantiatedTemplates.insert(std::make_pair(instantiatedQName,ret)); + appdomain->instantiatedTemplates.insert(std::make_pair(instantiatedQName,ret)); ret->prototype = _MNR(new_objectPrototype()); T::sinit(ret); if(ret->super) @@ -446,16 +452,17 @@ ret->incRef(); return ret; } - Class_base* applyTypeByQName(const QName& qname) + Class_base* applyTypeByQName(const QName& qname,_NR<ApplicationDomain> applicationDomain) { const std::vector<const Type*> types; - std::map<QName, Class_base*>::iterator it=getSys()->instantiatedTemplates.find(qname); + _NR<ApplicationDomain> appdomain = applicationDomain; + std::map<QName, Class_base*>::iterator it=appdomain->instantiatedTemplates.find(qname); Class<T>* ret=NULL; - if(it==getSys()->instantiatedTemplates.end()) //This class is not yet in the map, create it + if(it==appdomain->instantiatedTemplates.end()) //This class is not yet in the map, create it { MemoryAccount* memoryAccount = getSys()->allocateMemoryAccount(qname.name); ret=new (getSys()->unaccountedMemory) TemplatedClass<T>(qname,types,this,memoryAccount); - getSys()->instantiatedTemplates.insert(std::make_pair(qname,ret)); + appdomain->instantiatedTemplates.insert(std::make_pair(qname,ret)); ret->prototype = _MNR(new_objectPrototype()); T::sinit(ret); if(ret->super) @@ -469,26 +476,26 @@ return ret; } - static Ref<Class_base> getTemplateInstance(const Type* type) + static Ref<Class_base> getTemplateInstance(const Type* type,_NR<ApplicationDomain> appdomain) { std::vector<const Type*> t(1,type); Template<T>* templ=getTemplate(); - Ref<Class_base> ret=_MR(templ->applyType(t)); + Ref<Class_base> ret=_MR(templ->applyType(t, appdomain)); templ->decRef(); return ret; } - static Ref<Class_base> getTemplateInstance(const QName& qname, ABCContext* context) + static Ref<Class_base> getTemplateInstance(const QName& qname, ABCContext* context,_NR<ApplicationDomain> appdomain) { Template<T>* templ=getTemplate(); - Ref<Class_base> ret=_MR(templ->applyTypeByQName(qname)); + Ref<Class_base> ret=_MR(templ->applyTypeByQName(qname,appdomain)); ret->context = context; templ->decRef(); return ret; } - static T* getInstanceS(const Type* type) + static T* getInstanceS(const Type* type,_NR<ApplicationDomain> appdomain) { - return static_cast<T*>(getTemplateInstance(type).getPtr()->getInstance(true,NULL,0)); + return static_cast<T*>(getTemplateInstance(type,appdomain).getPtr()->getInstance(true,NULL,0)); } static Template<T>* getTemplate(const QName& name)
View file
lightspark.tar.xz/src/scripting/flash/display/BitmapData.cpp
Changed
@@ -570,11 +570,11 @@ } } - Vector *result = Template<Vector>::getInstanceS(Template<Vector>::getTemplateInstance(Class<Number>::getClass()).getPtr()); + Vector *result = Template<Vector>::getInstanceS(Template<Vector>::getTemplateInstance(Class<Number>::getClass(),NullRef).getPtr(),NullRef); int channelOrder[4] = {2, 1, 0, 3}; // red, green, blue, alpha for (int j=0; j<4; j++) { - Vector *histogram = Template<Vector>::getInstanceS(Class<Number>::getClass()); + Vector *histogram = Template<Vector>::getInstanceS(Class<Number>::getClass(),NullRef); for (int level=0; level<256; level++) { histogram->append(abstract_d(counts[channelOrder[j]][level])); @@ -663,7 +663,7 @@ if (rect.isNull()) throwError<TypeError>(kNullPointerError, "rect"); - Vector *result = Template<Vector>::getInstanceS(Class<UInteger>::getClass()); + Vector *result = Template<Vector>::getInstanceS(Class<UInteger>::getClass(),NullRef); vector<uint32_t> pixelvec = th->pixels->getPixelVector(rect->getRect()); vector<uint32_t>::const_iterator it; for (it=pixelvec.begin(); it!=pixelvec.end(); ++it)
View file
lightspark.tar.xz/src/scripting/flash/display/Graphics.cpp
Changed
@@ -412,7 +412,7 @@ } void Graphics::pathToTokens(_NR<Vector> commands, _NR<Vector> data, - tiny_string winding, std::vector<GeomToken>& tokens) + tiny_string winding, tokensVector& tokens) { if (commands.isNull() || data.isNull()) return; @@ -552,7 +552,7 @@ return NULL; } -void Graphics::drawTrianglesToTokens(_NR<Vector> vertices, _NR<Vector> indices, _NR<Vector> uvtData, tiny_string culling, std::vector<GeomToken>& tokens) +void Graphics::drawTrianglesToTokens(_NR<Vector> vertices, _NR<Vector> indices, _NR<Vector> uvtData, tiny_string culling, tokensVector& tokens) { if (culling != "none") LOG(LOG_NOT_IMPLEMENTED, "Graphics.drawTriangles doesn't support culling");
View file
lightspark.tar.xz/src/scripting/flash/display/Graphics.h
Changed
@@ -69,12 +69,12 @@ static void pathToTokens(_NR<Vector> commands, _NR<Vector> data, tiny_string windings, - std::vector<GeomToken>& tokens); + tokensVector &tokens); static void drawTrianglesToTokens(_NR<Vector> vertices, _NR<Vector> indices, _NR<Vector> uvtData, tiny_string culling, - std::vector<GeomToken>& tokens); + tokensVector &tokens); ASFUNCTION(_constructor); ASFUNCTION(lineBitmapStyle); ASFUNCTION(lineGradientStyle);
View file
lightspark.tar.xz/src/scripting/flash/display/GraphicsBitmapFill.cpp
Changed
@@ -63,7 +63,7 @@ return Graphics::createBitmapFill(bitmapData, matrix, repeat, smooth); } -void GraphicsBitmapFill::appendToTokens(std::vector<GeomToken>& tokens) +void GraphicsBitmapFill::appendToTokens(tokensVector& tokens) { tokens.emplace_back(GeomToken(SET_FILL, toFillStyle()));
View file
lightspark.tar.xz/src/scripting/flash/display/GraphicsBitmapFill.h
Changed
@@ -41,7 +41,7 @@ ASPROPERTY_GETTER_SETTER(bool, repeat); ASPROPERTY_GETTER_SETTER(bool, smooth); FILLSTYLE toFillStyle(); - void appendToTokens(std::vector<GeomToken>& tokens); + void appendToTokens(tokensVector& tokens); }; };
View file
lightspark.tar.xz/src/scripting/flash/display/GraphicsEndFill.cpp
Changed
@@ -41,7 +41,7 @@ return FILLSTYLE(0xff); } -void GraphicsEndFill::appendToTokens(std::vector<GeomToken>& tokens) +void GraphicsEndFill::appendToTokens(tokensVector& tokens) { tokens.emplace_back(CLEAR_FILL); }
View file
lightspark.tar.xz/src/scripting/flash/display/GraphicsEndFill.h
Changed
@@ -1,20 +1,20 @@ /************************************************************************** - Lightspark, a free flash player implementation + Lightspark, a free flash player implementation - Copyright (C) 2013 Antti Ajanki (antti.ajanki@iki.fi) + Copyright (C) 2013 Antti Ajanki (antti.ajanki@iki.fi) - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. **************************************************************************/ #ifndef SCRIPTING_FLASH_DISPLAY_GRAPHICSENDFILL_H @@ -32,8 +32,8 @@ public: GraphicsEndFill(Class_base* c); static void sinit(Class_base* c); - FILLSTYLE toFillStyle(); - void appendToTokens(std::vector<GeomToken>& tokens); + FILLSTYLE toFillStyle(); + void appendToTokens(tokensVector& tokens); }; };
View file
lightspark.tar.xz/src/scripting/flash/display/GraphicsGradientFill.cpp
Changed
@@ -90,7 +90,7 @@ matrix, spreadMethod, interpolationMethod, focalPointRatio); } -void GraphicsGradientFill::appendToTokens(std::vector<GeomToken>& tokens) +void GraphicsGradientFill::appendToTokens(tokensVector& tokens) { tokens.emplace_back(GeomToken(SET_FILL, toFillStyle())); }
View file
lightspark.tar.xz/src/scripting/flash/display/GraphicsGradientFill.h
Changed
@@ -47,7 +47,7 @@ ASPROPERTY_GETTER_SETTER(tiny_string, spreadMethod); ASPROPERTY_GETTER_SETTER(tiny_string, type); FILLSTYLE toFillStyle(); - void appendToTokens(std::vector<GeomToken>& tokens); + void appendToTokens(tokensVector& tokens); }; };
View file
lightspark.tar.xz/src/scripting/flash/display/GraphicsPath.cpp
Changed
@@ -79,9 +79,9 @@ void GraphicsPath::ensureValid() { if (commands.isNull()) - commands = _MNR(Template<Vector>::getInstanceS(Class<Integer>::getClass())); + commands = _MNR(Template<Vector>::getInstanceS(Class<Integer>::getClass(),NullRef)); if (data.isNull()) - data = _MNR(Template<Vector>::getInstanceS(Class<Number>::getClass())); + data = _MNR(Template<Vector>::getInstanceS(Class<Number>::getClass(),NullRef)); } ASFUNCTIONBODY(GraphicsPath, curveTo) @@ -167,7 +167,7 @@ return NULL; } -void GraphicsPath::appendToTokens(std::vector<GeomToken>& tokens) +void GraphicsPath::appendToTokens(tokensVector& tokens) { Graphics::pathToTokens(commands, data, winding, tokens); }
View file
lightspark.tar.xz/src/scripting/flash/display/GraphicsPath.h
Changed
@@ -47,7 +47,7 @@ ASFUNCTION(moveTo); ASFUNCTION(wideLineTo); ASFUNCTION(wideMoveTo); - void appendToTokens(std::vector<GeomToken>& tokens); + void appendToTokens(tokensVector& tokens); }; };
View file
lightspark.tar.xz/src/scripting/flash/display/GraphicsShaderFill.cpp
Changed
@@ -66,7 +66,7 @@ return FILLSTYLE(0xff); } -void GraphicsShaderFill::appendToTokens(std::vector<GeomToken>& tokens) +void GraphicsShaderFill::appendToTokens(tokensVector& tokens) { LOG(LOG_NOT_IMPLEMENTED, "GraphicsShaderFill::appendToTokens()"); return;
View file
lightspark.tar.xz/src/scripting/flash/display/GraphicsShaderFill.h
Changed
@@ -40,7 +40,7 @@ ASPROPERTY_GETTER_SETTER(_NR<Matrix>, matrix); ASPROPERTY_GETTER_SETTER(_NR<Shader>, shader); FILLSTYLE toFillStyle(); - void appendToTokens(std::vector<GeomToken>& tokens); + void appendToTokens(tokensVector& tokens); }; };
View file
lightspark.tar.xz/src/scripting/flash/display/GraphicsSolidFill.cpp
Changed
@@ -57,7 +57,7 @@ return Graphics::createSolidFill(color, static_cast<uint8_t>(255*alpha)); } -void GraphicsSolidFill::appendToTokens(std::vector<GeomToken>& tokens) +void GraphicsSolidFill::appendToTokens(tokensVector& tokens) { tokens.emplace_back(GeomToken(SET_FILL, toFillStyle())); }
View file
lightspark.tar.xz/src/scripting/flash/display/GraphicsSolidFill.h
Changed
@@ -36,7 +36,7 @@ ASPROPERTY_GETTER_SETTER(number_t, alpha); ASPROPERTY_GETTER_SETTER(uint32_t, color); FILLSTYLE toFillStyle(); - void appendToTokens(std::vector<GeomToken>& tokens); + void appendToTokens(tokensVector& tokens); }; };
View file
lightspark.tar.xz/src/scripting/flash/display/GraphicsStroke.cpp
Changed
@@ -90,7 +90,7 @@ } } -void GraphicsStroke::appendToTokens(std::vector<GeomToken>& tokens) +void GraphicsStroke::appendToTokens(tokensVector& tokens) { LINESTYLE2 style(0xff); style.Width = thickness;
View file
lightspark.tar.xz/src/scripting/flash/display/GraphicsStroke.h
Changed
@@ -43,7 +43,7 @@ ASPROPERTY_GETTER_SETTER(bool, pixelHinting); ASPROPERTY_GETTER_SETTER(tiny_string, scaleMode); ASPROPERTY_GETTER_SETTER(number_t, thickness); - void appendToTokens(std::vector<GeomToken>& tokens); + void appendToTokens(tokensVector& tokens); }; };
View file
lightspark.tar.xz/src/scripting/flash/display/GraphicsTrianglePath.cpp
Changed
@@ -68,7 +68,7 @@ ASFUNCTIONBODY_GETTER_SETTER(GraphicsTrianglePath, uvtData); ASFUNCTIONBODY_GETTER_SETTER(GraphicsTrianglePath, vertices); -void GraphicsTrianglePath::appendToTokens(std::vector<GeomToken>& tokens) +void GraphicsTrianglePath::appendToTokens(tokensVector& tokens) { Graphics::drawTrianglesToTokens(vertices, indices, uvtData, culling, tokens); }
View file
lightspark.tar.xz/src/scripting/flash/display/GraphicsTrianglePath.h
Changed
@@ -40,7 +40,7 @@ ASPROPERTY_GETTER_SETTER(_NR<Vector>, indices); ASPROPERTY_GETTER_SETTER(_NR<Vector>, uvtData); ASPROPERTY_GETTER_SETTER(_NR<Vector>, vertices); - void appendToTokens(std::vector<GeomToken>& tokens); + void appendToTokens(tokensVector& tokens); }; };
View file
lightspark.tar.xz/src/scripting/flash/display/IGraphicsData.h
Changed
@@ -35,7 +35,7 @@ public: static void linkTraits(Class_base* c) {}; // Appends GeomTokens for drawing this object into tokens - virtual void appendToTokens(std::vector<GeomToken>& tokens) = 0; + virtual void appendToTokens(tokensVector& tokens) = 0; }; };
View file
lightspark.tar.xz/src/scripting/flash/display/TokenContainer.cpp
Changed
@@ -25,12 +25,12 @@ using namespace lightspark; using namespace std; -TokenContainer::TokenContainer(DisplayObject* _o) : owner(_o), scaling(1.0f) +TokenContainer::TokenContainer(DisplayObject* _o) : owner(_o),tokens(reporter_allocator<GeomToken>(getSys()->unaccountedMemory)), scaling(1.0f) { } TokenContainer::TokenContainer(DisplayObject* _o, const tokensVector& _tokens, float _scaling) : - owner(_o), tokens(_tokens.begin(),_tokens.end()), scaling(_scaling) + owner(_o), tokens(_tokens.begin(),_tokens.end(),reporter_allocator<GeomToken>(getSys()->unaccountedMemory)), scaling(_scaling) { } @@ -230,7 +230,7 @@ } /* Find the size of the active texture (bitmap set by the latest SET_FILL). */ -void TokenContainer::getTextureSize(std::vector<GeomToken>& tokens, int *width, int *height) +void TokenContainer::getTextureSize(tokensVector& tokens, int *width, int *height) { *width=0; *height=0;
View file
lightspark.tar.xz/src/scripting/flash/display/TokenContainer.h
Changed
@@ -46,11 +46,11 @@ * the tokens are cleared and scaling is set * to 1.0f. */ - std::vector<GeomToken> tokens; + tokensVector tokens; static void FromShaperecordListToShapeVector(const std::vector<SHAPERECORD>& shapeRecords, tokensVector& tokens, const std::list<FILLSTYLE>& fillStyles, const MATRIX& matrix = MATRIX()); - static void getTextureSize(std::vector<GeomToken>& tokens, int *width, int *height); + static void getTextureSize(tokensVector& tokens, int *width, int *height); uint16_t getCurrentLineWidth() const; float scaling; protected:
View file
lightspark.tar.xz/src/scripting/flash/display/flashdisplay.cpp
Changed
@@ -2314,7 +2314,7 @@ ASFUNCTIONBODY(Stage,_getStageVideos) { LOG(LOG_NOT_IMPLEMENTED, "Accelerated rendering through StageVideo not implemented, SWF should fall back to Video"); - return Template<Vector>::getInstanceS(Class<StageVideo>::getClass()); + return Template<Vector>::getInstanceS(Class<StageVideo>::getClass(),NullRef); } _NR<InteractiveObject> Stage::getFocusTarget()
View file
lightspark.tar.xz/src/scripting/flash/system/flashsystem.cpp
Changed
@@ -223,6 +223,11 @@ domainMemory.reset(); for(auto i = globalScopes.begin(); i != globalScopes.end(); ++i) (*i)->decRef(); + for(auto it = instantiatedTemplates.begin(); it != instantiatedTemplates.end(); ++it) + it->second->finalize(); + //Free template instantations by decRef'ing them + for(auto i = instantiatedTemplates.begin(); i != instantiatedTemplates.end(); ++i) + i->second->decRef(); } ASFUNCTIONBODY(ApplicationDomain,_constructor)
View file
lightspark.tar.xz/src/scripting/flash/system/flashsystem.h
Changed
@@ -62,6 +62,7 @@ ApplicationDomain(Class_base* c, _NR<ApplicationDomain> p=NullRef); void finalize(); std::map<const multiname*, Class_base*> classesBeingDefined; + std::map<QName, Class_base*> instantiatedTemplates; // list of classes where super class is not defined yet std::list<Class_base*> classesSuperNotFilled;
View file
lightspark.tar.xz/src/scripting/flash/text/flashtext.cpp
Changed
@@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. **************************************************************************/ +#include "scripting/abc.h" #include "scripting/flash/text/flashtext.h" #include "scripting/class.h" #include "compat.h" @@ -89,7 +90,7 @@ } TextField::TextField(Class_base* c, const TextData& textData, bool _selectable, bool readOnly) - : InteractiveObject(c), TextData(textData), type(ET_READ_ONLY), + : InteractiveObject(c), TextData(textData), TokenContainer(this), type(ET_READ_ONLY), antiAliasType(AA_NORMAL), gridFitType(GF_PIXEL), textInteractionMode(TI_NORMAL), alwaysShowSelection(false), caretIndex(0), condenseWhite(false), displayAsPassword(false), @@ -962,9 +963,14 @@ void TextField::requestInvalidation(InvalidateQueue* q) { - incRef(); - updateSizes(); - q->addToInvalidateQueue(_MR(this)); + if (!tokensEmpty()) + TokenContainer::requestInvalidation(q); + else + { + incRef(); + updateSizes(); + q->addToInvalidateQueue(_MR(this)); + } } IDrawable* TextField::invalidate(DisplayObject* target, const MATRIX& initialMatrix) @@ -978,6 +984,17 @@ return NULL; } + RootMovieClip* currentRoot=getSys()->mainClip; + DefineFont3Tag* embeddedfont = currentRoot->getEmbeddedFont(font); + tokens.clear(); + if (embeddedfont) + { + scaling = 1.0f/1024.0f/20.0f; + embeddedfont->fillTextTokens(tokens,text,fontSize,textColor); + } + if (!tokensEmpty()) + return TokenContainer::invalidate(target, initialMatrix); + MATRIX totalMatrix; std::vector<IDrawable::MaskData> masks; computeMasksAndMatrix(target, masks, totalMatrix);
View file
lightspark.tar.xz/src/scripting/flash/text/flashtext.h
Changed
@@ -65,7 +65,7 @@ static void buildTraits(ASObject* o); }; -class TextField: public InteractiveObject, public TextData +class TextField: public InteractiveObject, public TextData, public TokenContainer { private: /* @@ -112,7 +112,7 @@ ANTI_ALIAS_TYPE antiAliasType; GRID_FIT_TYPE gridFitType; TEXT_INTERACTION_MODE textInteractionMode; - _NR<ASString> restrictChars; + _NR<ASString> restrictChars; public: TextField(Class_base* c, const TextData& textData=TextData(), bool _selectable=true, bool readOnly=true); void finalize();
View file
lightspark.tar.xz/src/scripting/toplevel/toplevel.cpp
Changed
@@ -437,7 +437,10 @@ rest->resize(passedToRest); //Give the reference of the other args to an array for(uint32_t j=0;j<passedToRest;j++) + { + args[passedToLocals+j]->incRef(); rest->set(j,_MR(args[passedToLocals+j])); + } assert_and_throw(cc.locals_size>args_len+1); cc.locals[args_len+1]=rest; @@ -756,7 +759,7 @@ if (mn->ns.size() >= 1 && mn->ns[0].getImpl().name == "__AS3__.vec") { QName qname(getSys()->getStringFromUniqueId(mn->name_s_id),mn->ns[0].getImpl().name); - typeObject = Template<Vector>::getTemplateInstance(qname,context).getPtr(); + typeObject = Template<Vector>::getTemplateInstance(qname,context,context->root->applicationDomain).getPtr(); } } return typeObject->as<Type>(); @@ -1168,11 +1171,6 @@ if(cls==this || cls==Class<ASObject>::getClass()) return true; - // it seems that classes with the same name from different applicationDomains - // are treated as equal, so we test for same names - //if (this->getQualifiedClassName() == cls->getQualifiedClassName()) - // return true; - //Now check the interfaces if (considerInterfaces) {
View file
lightspark.tar.xz/src/scripting/toplevel/toplevel.h
Changed
@@ -48,6 +48,7 @@ class Any; class Void; class Class_object; +class ApplicationDomain; // Enum used during early binding in abc_optimizer.cpp enum EARLY_BIND_STATUS { NOT_BINDED=0, CANNOT_BIND=1, BINDED }; @@ -233,7 +234,7 @@ QName template_name; public: Template_base(QName name); - virtual Class_base* applyType(const std::vector<const Type*>& t)=0; + virtual Class_base* applyType(const std::vector<const Type*>& t,_NR<ApplicationDomain> appdomain)=0; }; class Class_object: public Class_base
View file
lightspark.tar.xz/src/swf.cpp
Changed
@@ -587,8 +587,6 @@ } for(auto it = customClasses.begin(); it != customClasses.end(); ++it) (*it)->finalize(); - for(auto it = instantiatedTemplates.begin(); it != instantiatedTemplates.end(); ++it) - it->second->finalize(); for(auto it = templates.begin(); it != templates.end(); ++it) it->second->finalize(); @@ -605,10 +603,6 @@ for(auto i = customClasses.begin(); i != customClasses.end(); ++i) (*i)->decRef(); - //Free template instantations by decRef'ing them - for(auto i = instantiatedTemplates.begin(); i != instantiatedTemplates.end(); ++i) - i->second->decRef(); - //Free templates by decRef'ing them for(auto i = templates.begin(); i != templates.end(); ++i) i->second->decRef(); @@ -1339,6 +1333,7 @@ if (loader && !loader->allowLoadingSWF()) { _NR<LoaderInfo> li=loader->getContentLoaderInfo(); + li->incRef(); getVm()->addEvent(li,_MR(Class<SecurityErrorEvent>::getInstanceS( "Cannot import a SWF file when LoaderContext.allowCodeImport is false."))); // 3226 return; @@ -1609,7 +1604,7 @@ if(this==sys->mainClip) { /* now the frameRate is available and all SymbolClass tags have created their classes */ - sys->addFrameTick(1000/frameRate,sys); + sys->addTick(1000/frameRate,sys); } else { @@ -2104,3 +2099,16 @@ } } } + +void RootMovieClip::registerEmbeddedFont(const tiny_string fontname, DefineFont3Tag *tag) +{ + embeddedfonts[fontname] = tag; +} + +DefineFont3Tag *RootMovieClip::getEmbeddedFont(const tiny_string fontname) const +{ + auto it = embeddedfonts.find(fontname); + if (it != embeddedfonts.end()) + return it->second; + return NULL; +}
View file
lightspark.tar.xz/src/swf.h
Changed
@@ -57,6 +57,7 @@ class ApplicationDomain; class SecurityDomain; class Class_inherit; +class DefineFont3Tag; class RootMovieClip: public MovieClip { @@ -69,6 +70,7 @@ Spinlock dictSpinlock; std::list < DictionaryTag* > dictionary; std::list< std::pair<tiny_string, DictionaryTag*> > classesToBeBound; + std::map < tiny_string,DefineFont3Tag* > embeddedfonts; //frameSize and frameRate are valid only after the header has been parsed RECT frameSize; @@ -122,6 +124,8 @@ void addBinding(const tiny_string& name, DictionaryTag *tag); void bindClass(const QName &classname, Class_inherit* cls); void checkBinding(DictionaryTag* tag); + void registerEmbeddedFont(const tiny_string fontname,DefineFont3Tag* tag); + DefineFont3Tag* getEmbeddedFont(const tiny_string fontname) const; }; class ThreadProfile @@ -332,7 +336,6 @@ //This is an array of fixed size, we can avoid using std::vector Class_base** builtinClasses; std::map<QName, Template_base*> templates; - std::map<QName, Class_base*> instantiatedTemplates; //Flags for command line options bool useInterpreter;
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.