Merge remote-tracking branch 'upstream/master' into tstools

This commit is contained in:
Ryan Lucia 2018-05-31 04:26:15 -04:00
commit fe0dd3e095
10 changed files with 35 additions and 40 deletions

View File

@ -49,16 +49,17 @@
<UpdateCheckerServer>updates.aegisub.org</UpdateCheckerServer> <UpdateCheckerServer>updates.aegisub.org</UpdateCheckerServer>
<UpdateCheckerURL>/trunk</UpdateCheckerURL> <UpdateCheckerURL>/trunk</UpdateCheckerURL>
<BoostPath>..\..\vendor\boost</BoostPath> <VendorRoot>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\vendor))</VendorRoot>
<FfmsSrcDir>..\..\vendor\ffms2</FfmsSrcDir> <BoostPath>$(VendorRoot)\boost</BoostPath>
<FfmpegSrcDir>..\..\vendor\ffmpeg</FfmpegSrcDir> <FfmsSrcDir>$(VendorRoot)\ffms2</FfmsSrcDir>
<FftwSrcDir>..\..\vendor\fftw</FftwSrcDir> <FfmpegSrcDir>$(VendorRoot)\ffmpeg</FfmpegSrcDir>
<Freetype2SrcDir>..\..\vendor\freetype2</Freetype2SrcDir> <FftwSrcDir>$(VendorRoot)\fftw</FftwSrcDir>
<FribidiSrcDir>..\..\vendor\fribidi</FribidiSrcDir> <Freetype2SrcDir>$(VendorRoot)\freetype2</Freetype2SrcDir>
<GtestSrcDir>..\..\vendor\googletest</GtestSrcDir> <FribidiSrcDir>$(VendorRoot)\fribidi</FribidiSrcDir>
<IcuSrcDir>..\..\vendor\icu\source</IcuSrcDir> <GtestSrcDir>$(VendorRoot)\googletest</GtestSrcDir>
<LibassSrcDir>..\..\vendor\libass</LibassSrcDir> <IcuSrcDir>$(VendorRoot)\icu\source</IcuSrcDir>
<WxSrcDir>..\..\vendor\wxWidgets</WxSrcDir> <LibassSrcDir>$(VendorRoot)\libass</LibassSrcDir>
<ZlibSrcDir>..\..\vendor\wxWidgets\src\zlib</ZlibSrcDir> <WxSrcDir>$(VendorRoot)\wxWidgets</WxSrcDir>
<ZlibSrcDir>$(VendorRoot)\wxWidgets\src\zlib</ZlibSrcDir>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View File

@ -34,7 +34,7 @@
<WholeProgramOptimization Condition="'$(Configuration)'=='Release'" >true</WholeProgramOptimization> <WholeProgramOptimization Condition="'$(Configuration)'=='Release'" >true</WholeProgramOptimization>
<CharacterSet >Unicode</CharacterSet> <CharacterSet >Unicode</CharacterSet>
<CharacterSet Condition="'$(AegisubMBCS)'=='true'" >MultiByte</CharacterSet> <CharacterSet Condition="'$(AegisubMBCS)'=='true'" >MultiByte</CharacterSet>
<PlatformToolset >v140_xp</PlatformToolset> <PlatformToolset >v141</PlatformToolset>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />

View File

@ -54,7 +54,7 @@
</InstallHeader> </InstallHeader>
<Yasm> <Yasm>
<InputRelativeSourceDir>$(FfmpegSrcDir)\</InputRelativeSourceDir> <InputRelativeSourceDir>$(FfmpegSrcDir)\</InputRelativeSourceDir>
<Include>%(Include) -I$(MSBuildThisFileDirectory) -I$(MSBuildThisFileDirectory)$(FfmpegSrcDir)</Include> <Include>%(Include) -I$(MSBuildThisFileDirectory) -I$(FfmpegSrcDir)</Include>
<Config Condition="'$(Platform)'=='Win32'">%(Config) -DPREFIX -Pconfig-x86.asm</Config> <Config Condition="'$(Platform)'=='Win32'">%(Config) -DPREFIX -Pconfig-x86.asm</Config>
<Config Condition="'$(Platform)'=='x64'">%(Config) -Pconfig-x64.asm</Config> <Config Condition="'$(Platform)'=='x64'">%(Config) -Pconfig-x64.asm</Config>
</Yasm> </Yasm>

View File

@ -10,7 +10,7 @@
<Target <Target
Name="ComputeHeaderOutputs" Name="ComputeHeaderOutputs"
Inputs="@(InstallHeader)" Inputs="@(InstallHeader)"
Outputs="@(InstallHeader->'%(HeaderRoot)|%(RelativeDir)')" Outputs="@(InstallHeader->'%(HeaderRoot)\%(RelativeDir)')"
BeforeTargets="InstallHeaders" BeforeTargets="InstallHeaders"
> >
<CalculateOutputDir <CalculateOutputDir

View File

@ -33,19 +33,6 @@ namespace bfs = boost::filesystem;
#undef CreateDirectory #undef CreateDirectory
namespace {
FINDEX_INFO_LEVELS find_info_level() {
OSVERSIONINFO osvi = {};
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&osvi);
if (osvi.dwMajorVersion > 6 || (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion >= 1))
return FindExInfoBasic;
else
return FindExInfoStandard;
}
}
namespace agi { namespace fs { namespace agi { namespace fs {
std::string ShortName(path const& p) { std::string ShortName(path const& p) {
std::wstring out(MAX_PATH + 1, 0); std::wstring out(MAX_PATH + 1, 0);
@ -98,7 +85,7 @@ DirectoryIterator::DirectoryIterator(path const& p, std::string const& filter)
: privdata(new PrivData) : privdata(new PrivData)
{ {
WIN32_FIND_DATA data; WIN32_FIND_DATA data;
privdata->h = FindFirstFileEx((p/(filter.empty() ? "*.*" : filter)).c_str(), find_info_level(), &data, FindExSearchNameMatch, nullptr, 0); privdata->h = FindFirstFileEx((p/(filter.empty() ? "*.*" : filter)).c_str(), FindExInfoBasic, &data, FindExSearchNameMatch, nullptr, 0);
if (privdata->h == INVALID_HANDLE_VALUE) { if (privdata->h == INVALID_HANDLE_VALUE) {
privdata.reset(); privdata.reset();
return; return;

View File

@ -67,6 +67,7 @@ size_t AudioRendererBitmapCacheBitmapFactory::GetBlockSize() const
AudioRenderer::AudioRenderer() AudioRenderer::AudioRenderer()
{ {
bitmaps.reserve(AudioStyle_MAX);
for (int i = 0; i < AudioStyle_MAX; ++i) for (int i = 0; i < AudioStyle_MAX; ++i)
bitmaps.emplace_back(256, AudioRendererBitmapCacheBitmapFactory(this)); bitmaps.emplace_back(256, AudioRendererBitmapCacheBitmapFactory(this));
@ -157,21 +158,20 @@ size_t AudioRenderer::NumBlocks(const int64_t samples) const
return static_cast<size_t>(duration / pixel_ms / cache_bitmap_width); return static_cast<size_t>(duration / pixel_ms / cache_bitmap_width);
} }
const wxBitmap *AudioRenderer::GetCachedBitmap(const int i, const AudioRenderingStyle style) wxBitmap const& AudioRenderer::GetCachedBitmap(const int i, const AudioRenderingStyle style)
{ {
assert(provider); assert(provider);
assert(renderer); assert(renderer);
bool created = false; bool created = false;
wxBitmap *bmp = bitmaps[style].Get(i, &created); auto& bmp = bitmaps[style].Get(i, &created);
assert(bmp);
if (created) if (created)
{ {
renderer->Render(*bmp, i*cache_bitmap_width, style); renderer->Render(bmp, i*cache_bitmap_width, style);
needs_age = true; needs_age = true;
} }
assert(bmp->IsOk()); assert(bmp.IsOk());
return bmp; return bmp;
} }
@ -201,7 +201,7 @@ void AudioRenderer::Render(wxDC &dc, wxPoint origin, const int start, const int
for (int i = firstbitmap; i <= lastbitmap; ++i) for (int i = firstbitmap; i <= lastbitmap; ++i)
{ {
dc.DrawBitmap(*GetCachedBitmap(i, style), origin); dc.DrawBitmap(GetCachedBitmap(i, style), origin);
origin.x += cache_bitmap_width; origin.x += cache_bitmap_width;
} }

View File

@ -111,7 +111,7 @@ class AudioRenderer {
/// ///
/// Will attempt retrieving the requested bitmap from the cache, creating it /// Will attempt retrieving the requested bitmap from the cache, creating it
/// if the cache doesn't have it. /// if the cache doesn't have it.
const wxBitmap *GetCachedBitmap(int i, AudioRenderingStyle style); wxBitmap const& GetCachedBitmap(int i, AudioRenderingStyle style);
/// @brief Update the block count in the bitmap caches /// @brief Update the block count in the bitmap caches
/// ///

View File

@ -240,7 +240,7 @@ void AudioSpectrumRenderer::Render(wxBitmap &bmp, int start, AudioRenderingStyle
{ {
// Derived audio data // Derived audio data
size_t block_index = (size_t)(ax * pixel_ms * provider->GetSampleRate() / 1000) >> derivation_dist; size_t block_index = (size_t)(ax * pixel_ms * provider->GetSampleRate() / 1000) >> derivation_dist;
float *power = cache->Get(block_index); float *power = &cache->Get(block_index);
// Prepare bitmap writing // Prepare bitmap writing
unsigned char *px = imgdata + (imgheight-1) * stride + (ax - start) * 3; unsigned char *px = imgdata + (imgheight-1) * stride + (ax - start) * 3;

View File

@ -109,6 +109,8 @@ public:
SetBlockCount(block_count); SetBlockCount(block_count);
} }
DataBlockCache(DataBlockCache&&) = default;
DataBlockCache& operator=(DataBlockCache&&) = default;
/// @brief Change the number of blocks in cache /// @brief Change the number of blocks in cache
/// @param block_count New number of blocks to hold /// @param block_count New number of blocks to hold
@ -158,12 +160,12 @@ public:
/// @return A pointer to the block in cache /// @return A pointer to the block in cache
/// ///
/// It is legal to pass 0 (null) for created, in this case nothing is returned in it. /// It is legal to pass 0 (null) for created, in this case nothing is returned in it.
BlockT *Get(size_t i, bool *created = nullptr) BlockT& Get(size_t i, bool *created = nullptr)
{ {
size_t mbi = i >> MacroblockExponent; size_t mbi = i >> MacroblockExponent;
assert(mbi < data.size()); assert(mbi < data.size());
MacroBlock &mb = data[mbi]; auto &mb = data[mbi];
// Move this macroblock to the front of the age list // Move this macroblock to the front of the age list
if (mb.blocks.empty()) if (mb.blocks.empty())
@ -193,6 +195,6 @@ public:
else else
if (created) *created = false; if (created) *created = false;
return b; return *b;
} }
}; };

View File

@ -419,7 +419,7 @@ class AutomationMenu final : public wxMenu {
WorkItem *FindOrMakeSubitem(std::string const &name) { WorkItem *FindOrMakeSubitem(std::string const &name) {
auto sub = std::find_if(subitems.begin(), subitems.end(), [&](WorkItem const &item) { return item.displayname == name; }); auto sub = std::find_if(subitems.begin(), subitems.end(), [&](WorkItem const &item) { return item.displayname == name; });
if (sub != subitems.end()) return &*sub; if (sub != subitems.end()) return &*sub;
subitems.emplace_back(name); subitems.emplace_back(name);
return &subitems.back(); return &subitems.back();
} }
@ -529,8 +529,13 @@ namespace menu {
} }
} }
#ifdef __WXMAC__
menu->Bind(wxEVT_MENU_OPEN, &CommandManager::OnMenuOpen, &menu->cm); menu->Bind(wxEVT_MENU_OPEN, &CommandManager::OnMenuOpen, &menu->cm);
menu->Bind(wxEVT_MENU, &CommandManager::OnMenuClick, &menu->cm); menu->Bind(wxEVT_MENU, &CommandManager::OnMenuClick, &menu->cm);
#else
window->Bind(wxEVT_MENU_OPEN, &CommandManager::OnMenuOpen, &menu->cm);
window->Bind(wxEVT_MENU, &CommandManager::OnMenuClick, &menu->cm);
#endif
#ifdef __WXMAC__ #ifdef __WXMAC__
bind_events(menu.get()); bind_events(menu.get());