Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 88f5127

Browse files
[[ ThreadedRendering ]] Commented changes made.
1 parent 671bcf0 commit 88f5127

39 files changed

+120
-21
lines changed

engine/engine-mobile.xcodeproj/project.pbxproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
3CC6F42812AD0A6100852B3B /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3CC6F42712AD0A6100852B3B /* CFNetwork.framework */; };
2525
4C529CBC1973CF16007C5F7C /* sysunxthreads.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C529CBB1973CF16007C5F7C /* sysunxthreads.cpp */; };
2626
4C529CBF1973CF4A007C5F7C /* stacktile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C529CBD1973CF4A007C5F7C /* stacktile.cpp */; };
27-
4C529CC11973CF61007C5F7C /* iphone_test.livecode in Resources */ = {isa = PBXBuildFile; fileRef = 4C529CC01973CF61007C5F7C /* iphone_test.livecode */; };
2827
4C977245193C986700DB2F4A /* coretextfonts.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C977244193C986700DB2F4A /* coretextfonts.cpp */; };
2928
4CD038F316C8FE1700EBCCBA /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4CD038F216C8FE1700EBCCBA /* Default-568h@2x.png */; };
3029
4CD7DFE318A140D800CBCB57 /* opensslsocket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4DD3DEA61040AD9300CAC7EF /* opensslsocket.cpp */; };
@@ -513,7 +512,6 @@
513512
4C529CBB1973CF16007C5F7C /* sysunxthreads.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = sysunxthreads.cpp; path = src/sysunxthreads.cpp; sourceTree = "<group>"; };
514513
4C529CBD1973CF4A007C5F7C /* stacktile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = stacktile.cpp; path = src/stacktile.cpp; sourceTree = "<group>"; };
515514
4C529CBE1973CF4A007C5F7C /* stacktile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = stacktile.h; path = src/stacktile.h; sourceTree = "<group>"; };
516-
4C529CC01973CF61007C5F7C /* iphone_test.livecode */ = {isa = PBXFileReference; lastKnownFileType = file; name = iphone_test.livecode; path = ../../../../Desktop/test_stacks/iphone_test.livecode; sourceTree = "<group>"; };
517515
4C6D0A371407D04D003B1BA3 /* sysunxnetwork.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = sysunxnetwork.cpp; path = src/sysunxnetwork.cpp; sourceTree = "<group>"; };
518516
4C7D1CE31476747700129F01 /* exec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = exec.h; path = src/exec.h; sourceTree = "<group>"; };
519517
4C7D1CE5147674C300129F01 /* mblcamera.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = mblcamera.cpp; path = src/mblcamera.cpp; sourceTree = "<group>"; };
@@ -1295,7 +1293,6 @@
12951293
4DD3DF3A1040B03B00CAC7EF /* Configurations */,
12961294
4DD3DDAC1040ABB000CAC7EF /* Sources */,
12971295
4DD3DD9A1040AA9A00CAC7EF /* Products */,
1298-
4C529CC01973CF61007C5F7C /* iphone_test.livecode */,
12991296
4DD3DD9C1040AA9A00CAC7EF /* standalone-mobile-Info.plist */,
13001297
4D82FCFF171487A400C48403 /* template-store-entitlements.xcent */,
13011298
4D08A36D138FF3250081F990 /* standalone.ios */,
@@ -2001,7 +1998,6 @@
20011998
isa = PBXResourcesBuildPhase;
20021999
buildActionMask = 2147483647;
20032000
files = (
2004-
4C529CC11973CF61007C5F7C /* iphone_test.livecode in Resources */,
20052001
4D7E3A591281835D00E7F80A /* Default.png in Resources */,
20062002
4CD038F316C8FE1700EBCCBA /* Default-568h@2x.png in Resources */,
20072003
);

engine/src/button.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ MCButton::MCButton()
279279
// MW-2014-06-19: [[ IconGravity ]] By default buttons use legacy behavior.
280280
m_icon_gravity = kMCGravityNone;
281281

282+
// MM-2014-07-31: [[ ThreadedRendering ]] Used to ensure the default button animate message is only posted from a single thread.
282283
m_animate_posted = false;
283284
}
284285

@@ -354,6 +355,7 @@ MCButton::MCButton(const MCButton &bref) : MCControl(bref)
354355
// MW-2014-06-19: [[ IconGravity ]] Copy the other buttons gravity
355356
m_icon_gravity = kMCGravityNone;
356357

358+
// MM-2014-07-31: [[ ThreadedRendering ]] Used to ensure the default button animate message is only posted from a single thread.
357359
m_animate_posted = false;
358360
}
359361

@@ -1563,6 +1565,7 @@ void MCButton::timer(MCNameRef mptr, MCParameter *params)
15631565
{
15641566
if (state & CS_SHOW_DEFAULT)
15651567
{
1568+
// MM-2014-07-31: [[ ThreadedRendering ]] Flag that there is no longer a default button animation message pending.
15661569
m_animate_posted = false;
15671570
// MW-2011-08-18: [[ Layers ]] Invalidate the whole object.
15681571
layer_redrawall();

engine/src/button.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ class MCButton : public MCControl
140140
static MCImage *macrbhilite;
141141
static MCImage *macrbhilitetrack;
142142

143+
// MM-2014-07-31: [[ ThreadedRendering ]] Used to ensure the default button animate message is only posted from a single thread.
143144
bool m_animate_posted : 1;
144145

145146
public:

engine/src/buttondraw.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,6 +1678,8 @@ void MCButton::drawstandardbutton(MCDC *dc, MCRectangle &srect)
16781678
if (!(winfo.state & WTHEME_STATE_PRESSED) && winfo.state & WTHEME_STATE_HASDEFAULT && IsMacLFAM() && MCaqua && dc -> gettype() == CONTEXT_TYPE_SCREEN && !(flags & F_DISABLED) && getstyleint(flags) == F_STANDARD)
16791679
{
16801680
MCcurtheme->drawwidget(dc, winfo, srect);
1681+
1682+
// MM-2014-07-31: [[ ThreadedRendering ]] Make sure only a single thread posts the timer message (i.e. the first that gets here)
16811683
if (!m_animate_posted)
16821684
{
16831685
MCThreadMutexLock(MCanimationmutex);

engine/src/desktop-dc.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,7 @@ bool MCScreenDC::isbackdrop(MCPlatformWindowRef p_window)
555555

556556
void MCScreenDC::redrawbackdrop(MCPlatformSurfaceRef p_surface, MCGRegionRef p_region)
557557
{
558+
// MM-2014-07-31: [[ ThreadedRendering ]] Updated to use new platform surface API.
558559
MCGContextRef t_context;
559560
MCGRaster t_raster;
560561
MCGIntegerRectangle t_bounds;

engine/src/desktop-stack.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,21 +369,25 @@ class MCDesktopStackSurface: public MCStackSurface
369369
{
370370
}
371371

372+
// MM-2014-07-31: [[ ThreadedRendering ]] Updated to wrap new platform surface API.
372373
bool LockGraphics(MCGIntegerRectangle p_region, MCGContextRef& r_context, MCGRaster &r_raster)
373374
{
374375
return MCPlatformSurfaceLockGraphics(m_surface, p_region, r_context, r_raster);
375376
}
376-
377+
378+
// MM-2014-07-31: [[ ThreadedRendering ]] Updated to wrap new platform surface API.
377379
void UnlockGraphics(MCGIntegerRectangle p_region, MCGContextRef p_context, MCGRaster &p_raster)
378380
{
379381
MCPlatformSurfaceUnlockGraphics(m_surface, p_region, p_context, p_raster);
380382
}
381383

384+
// MM-2014-07-31: [[ ThreadedRendering ]] Updated to wrap new platform surface API.
382385
bool LockPixels(MCGIntegerRectangle p_area, MCGRaster& r_raster)
383386
{
384387
return MCPlatformSurfaceLockPixels(m_surface, p_area, r_raster);
385388
}
386389

390+
// MM-2014-07-31: [[ ThreadedRendering ]] Updated to wrap new platform surface API.
387391
void UnlockPixels(MCGIntegerRectangle p_area, MCGRaster& p_raster)
388392
{
389393
MCPlatformSurfaceUnlockPixels(m_surface, p_area, p_raster);

engine/src/globals.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,7 @@ Boolean MCmainstackschanged = False;
496496
// UDP sockets.
497497
Boolean MCallowdatagrambroadcasts = False;
498498

499+
// MM-2014-07-31: [[ ThreadedRendering ]] Used to ensure only a single animation message is sent per redraw
499500
MCThreadMutexRef MCanimationmutex = NULL;
500501

501502
////////////////////////////////////////////////////////////////////////////////
@@ -821,6 +822,7 @@ void X_clear_globals(void)
821822
// MW-2013-03-20: [[ MainStacksChanged ]]
822823
MCmainstackschanged = False;
823824

825+
// MM-2014-07-31: [[ ThreadedRendering ]]
824826
MCanimationmutex = NULL;
825827

826828
#ifdef _ANDROID_MOBILE
@@ -856,6 +858,7 @@ bool X_open(int argc, char *argv[], char *envp[])
856858
// MM-2014-02-14: [[ LibOpenSSL 1.0.1e ]] Initialise the openlSSL module.
857859
InitialiseSSL();
858860

861+
// MM-2014-07-31: [[ ThreadedRendering ]]
859862
MCThreadPoolInitialize();
860863
MCStackTileInitialize();
861864
MCThreadMutexCreate(MCanimationmutex);
@@ -1208,6 +1211,7 @@ int X_close(void)
12081211
// MM-2013-09-03: [[ RefactorGraphics ]] Initialize graphics library.
12091212
MCGraphicsFinalize();
12101213

1214+
// MM-2014-07-31: [[ ThreadedRendering ]]
12111215
MCThreadPoolFinalize();
12121216
MCStackTileFinalize();
12131217
MCThreadMutexRelease(MCanimationmutex);

engine/src/globals.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,7 @@ extern MCPoint MCgroupedobjectoffset;
411411
// addresses will work.
412412
extern Boolean MCallowdatagrambroadcasts;
413413

414+
// MM-2014-07-31: [[ ThreadedRendering ]] Used to ensure only a single animation message is sent per redraw
414415
extern MCThreadMutexRef MCanimationmutex;
415416

416417
///////////////////////////////////////////////////////////////////////////////

engine/src/idraw.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,9 @@ void MCImage::drawme(MCDC *dc, int2 sx, int2 sy, uint2 sw, uint2 sh, int2 dx, in
212212
{
213213
MCGImageFrame *t_frame = nil;
214214
if (m_rep->LockImageFrame(currentframe, getdevicescale(), t_frame))
215-
{
215+
{
216+
217+
// MM-2014-07-31: [[ ThreadedRendering ]] Make sure only a single thread posts the timer message (i.e. the first that gets here)
216218
if (!m_animate_posted)
217219
{
218220
MCThreadMutexLock(MCanimationmutex);

engine/src/image.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ MCImage::MCImage()
102102

103103
m_center_rect = MCRectangleMake(INT16_MIN, INT16_MIN, UINT16_MAX, UINT16_MAX);
104104

105+
// MM-2014-07-31: [[ ThreadedRendering ]] Used to ensure the image animate message is only posted from a single thread.
105106
m_animate_posted = false;
106107
}
107108

@@ -154,6 +155,7 @@ MCImage::MCImage(const MCImage &iref) : MCControl(iref)
154155

155156
m_center_rect = iref.m_center_rect;
156157

158+
// MM-2014-07-31: [[ ThreadedRendering ]] Used to ensure the image animate message is only posted from a single thread.
157159
m_animate_posted = false;
158160
}
159161

@@ -497,7 +499,9 @@ void MCImage::timer(MCNameRef mptr, MCParameter *params)
497499
else
498500
if ((isvisible() || m_needs) && irepeatcount && m_rep != nil && m_rep->GetFrameCount() > 1)
499501
{
502+
// MM-2014-07-31: [[ ThreadedRendering ]] Flag that there is no longer an image animation message pending.
500503
m_animate_posted = false;
504+
501505
advanceframe();
502506
if (irepeatcount)
503507
{

0 commit comments

Comments
 (0)