MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / ActionDef_Frame

Function ActionDef_Frame

Source/Wasm/WasmRuntime.cpp:915–933  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

913#define ActionDef_Scale Scale::alloc
914
915static Own<ActionDuration> ActionDef_Frame(String clipStr, float duration) {
916 auto def = FrameActionDef::create();
917 auto [tex, rect] = SharedClipCache.loadTexture(clipStr);
918 if (!tex) {
919 Error("invalid texture \"{}\" used for creating frame action.", clipStr.toString());
920 return FrameAction::alloc(def);
921 }
922 if (rect.getHeight() > rect.getWidth()) {
923 Error("invalid texture \"%s\" (height > width) used for creating frame action.", clipStr.toString());
924 return FrameAction::alloc(def);
925 }
926 def->clipStr = clipStr.toString();
927 auto totalFrames = s_cast<int>(rect.getWidth() / rect.getHeight());
928 for (int i = 0; i < totalFrames; i++) {
929 def->rects.push_back(New<Rect>(rect.getX() + i * rect.getHeight(), rect.getY(), rect.getHeight(), rect.getHeight()));
930 }
931 def->duration = duration;
932 return FrameAction::alloc(def);
933}
934
935static Own<ActionDuration> ActionDef_Frame(String clipStr, float duration, const std::vector<uint32_t>& frames) {
936 auto def = FrameActionDef::create();

Callers 2

actiondef_frameFunction · 0.85

Calls 11

loadTextureMethod · 0.80
toStringMethod · 0.65
createFunction · 0.50
ErrorEnum · 0.50
allocFunction · 0.50
getHeightMethod · 0.45
getWidthMethod · 0.45
push_backMethod · 0.45
getXMethod · 0.45
getYMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected