mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 16:12:40 +08:00
Merge branch 'v1.6' of github.com:cocos-creator/cocos2d-x-lite into v1.6
This commit is contained in:
@@ -24,82 +24,6 @@
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/*
|
||||
* Bitmask Operations
|
||||
*
|
||||
* Note this doesn't provide any locking/exclusion, and isn't atomic.
|
||||
* Additionally no bounds checking is done on the bitmask array.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* int num_resources;
|
||||
* unsigned int resource_bits[BITS_TO_WORDS(num_resources)];
|
||||
* bitmask_init(resource_bits, num_resources);
|
||||
* ...
|
||||
* int bit = bitmask_ffz(resource_bits, num_resources);
|
||||
* bitmask_set(resource_bits, bit);
|
||||
* ...
|
||||
* if (bitmask_test(resource_bits, bit)) { ... }
|
||||
* ...
|
||||
* bitmask_clear(resource_bits, bit);
|
||||
*
|
||||
*/
|
||||
|
||||
#define BITS_PER_WORD (sizeof(unsigned int) * 8)
|
||||
#define BITS_TO_WORDS(x) (((x) + BITS_PER_WORD - 1) / BITS_PER_WORD)
|
||||
#define BIT_IN_WORD(x) ((x) % BITS_PER_WORD)
|
||||
#define BIT_WORD(x) ((x) / BITS_PER_WORD)
|
||||
#define BIT_MASK(x) (1 << BIT_IN_WORD(x))
|
||||
|
||||
static inline void bitmask_init(unsigned int *bitmask, int num_bits)
|
||||
{
|
||||
memset(bitmask, 0, BITS_TO_WORDS(num_bits)*sizeof(unsigned int));
|
||||
}
|
||||
|
||||
static inline int bitmask_ffz(unsigned int *bitmask, int num_bits)
|
||||
{
|
||||
int bit, result;
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < BITS_TO_WORDS(num_bits); i++) {
|
||||
bit = ffs(~bitmask[i]);
|
||||
if (bit) {
|
||||
// ffs is 1-indexed, return 0-indexed result
|
||||
bit--;
|
||||
result = BITS_PER_WORD * i + bit;
|
||||
if (result >= num_bits)
|
||||
return -1;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static inline int bitmask_weight(unsigned int *bitmask, int num_bits)
|
||||
{
|
||||
size_t i;
|
||||
int weight = 0;
|
||||
|
||||
for (i = 0; i < BITS_TO_WORDS(num_bits); i++)
|
||||
weight += __builtin_popcount(bitmask[i]);
|
||||
return weight;
|
||||
}
|
||||
|
||||
static inline void bitmask_set(unsigned int *bitmask, int bit)
|
||||
{
|
||||
bitmask[BIT_WORD(bit)] |= BIT_MASK(bit);
|
||||
}
|
||||
|
||||
static inline void bitmask_clear(unsigned int *bitmask, int bit)
|
||||
{
|
||||
bitmask[BIT_WORD(bit)] &= ~BIT_MASK(bit);
|
||||
}
|
||||
|
||||
static inline bool bitmask_test(unsigned int *bitmask, int bit)
|
||||
{
|
||||
return bitmask[BIT_WORD(bit)] & BIT_MASK(bit);
|
||||
}
|
||||
|
||||
static inline int popcount(unsigned int x)
|
||||
{
|
||||
return __builtin_popcount(x);
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include <OpenalSoft/al.h>
|
||||
#endif
|
||||
#include "platform/CCPlatformMacros.h"
|
||||
#include "audio/apple/AudioMacros.h"
|
||||
#include "audio/win32/AudioMacros.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
namespace experimental{
|
||||
|
||||
@@ -1028,8 +1028,9 @@ void GraphicsNode::allocBuffer()
|
||||
{
|
||||
if (_buffer) {
|
||||
const auto iterator = std::find(_buffers.begin(), _buffers.end(), _buffer);
|
||||
if (iterator != _buffers.end()) {
|
||||
if (iterator != _buffers.end() && (*iterator) != _buffers.back()) {
|
||||
_buffer = *(iterator+1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1934,7 +1934,6 @@ void register_all_anysdk_manual(JSContext* cx, JS::HandleObject obj) {
|
||||
|
||||
cocos2d::EventListenerCustom* _event = cocos2d::Director::getInstance()->getEventDispatcher()->addCustomEventListener(ScriptingCore::EVENT_RESET, [&](cocos2d::EventCustom *event) {
|
||||
cocos2d::Director::getInstance()->getEventDispatcher()->removeEventListener(_event);
|
||||
CC_SAFE_RELEASE(_event);
|
||||
|
||||
ProtocolIAPResultListener::clear();
|
||||
if (ProtocolAdsResultListener::_instance != nullptr)
|
||||
@@ -1962,5 +1961,4 @@ void register_all_anysdk_manual(JSContext* cx, JS::HandleObject obj) {
|
||||
CC_SAFE_DELETE(ProtocolRECListener::_instance);
|
||||
}
|
||||
});
|
||||
_event->retain();
|
||||
}
|
||||
|
||||
@@ -94,8 +94,8 @@
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(OutDir);$(EngineRoot)external\win32\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>libcurl.lib;websockets.lib;mozjs-52.lib;mozglue.lib;libSpine.lib;libDragonBones.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ProgramDatabaseFile>$(ProjectDir)../../../runtime/win32/$(TargetName).pdb</ProgramDatabaseFile>
|
||||
<OutputFile>$(ProjectDir)../../../runtime/win32/$(TargetName)$(TargetExt)</OutputFile>
|
||||
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<IgnoreSpecificDefaultLibraries>libcmt.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||
</Link>
|
||||
<ResourceCompile>
|
||||
@@ -135,6 +135,9 @@ if not exist "$(ProjectDir)..\..\..\runtime\win32" mkdir "$(ProjectDir)..\..\..\
|
||||
xcopy /Y /Q "$(OutDir)*.dll" "$(ProjectDir)..\..\..\runtime\win32"
|
||||
xcopy /Y /Q "$(OutDir)*.exe" "$(ProjectDir)..\..\..\runtime\win32"
|
||||
xcopy /Y /Q "$(OutDir)lang" "$(ProjectDir)..\..\..\runtime\win32"
|
||||
|
||||
|
||||
if exist "$(ProjectDir)..\..\..\..\..\simulator\win32\config.json" copy "$(ProjectDir)..\..\..\..\..\simulator\win32\config.json" "$(OutDir)config.json"
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
|
||||
@@ -8,9 +8,8 @@
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>
|
||||
<LocalDebuggerCommand>$(TargetPath)</LocalDebuggerCommand>
|
||||
<LocalDebuggerCommandArguments>
|
||||
</LocalDebuggerCommandArguments>
|
||||
<LocalDebuggerCommand>$(OutDir)$(TargetName)$(TargetExt)</LocalDebuggerCommand>
|
||||
<LocalDebuggerCommandArguments>-search-path "$(ProjectDir)..\..\..\..\..\simulator\win32"</LocalDebuggerCommandArguments>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LocalDebuggerCommand>$(TargetPath)</LocalDebuggerCommand>
|
||||
|
||||
@@ -38,7 +38,7 @@ classes = WebView
|
||||
# will apply to all class names. This is a convenience wildcard to be able to skip similar named
|
||||
# functions from all classes.
|
||||
|
||||
skip = WebView::[setOnShouldStartLoading setOnDidFinishLoading setOnDidFailLoading setOnJSCallback loadData]
|
||||
skip = WebView::[setOnShouldStartLoading setOnDidFinishLoading setOnDidFailLoading loadData]
|
||||
|
||||
rename_functions =
|
||||
|
||||
|
||||
Reference in New Issue
Block a user