Skip to content

Commit

Permalink
Merged PR 4955623: Migrate OSS up to 09471c3 (gsl-3.1.0 update)
Browse files Browse the repository at this point in the history
- Move to GSL 3.1.0 (GH-6908)
- Replace the color table init code with two const arrays (GH-6913)
- Replace basic_string_view<T> with span<const T> (GH-6921)
- Replace gsl::at with a new til::at(span) for pre-checked bounds (GH-6925)

Related work items: MSFT:27866336
  • Loading branch information
DHowett committed Jul 23, 2020
2 parents 878ed57 + 09471c3 commit 52d0e3c
Show file tree
Hide file tree
Showing 515 changed files with 1,292 additions and 780 deletions.
3 changes: 3 additions & 0 deletions .github/actions/spell-check/dictionary/microsoft.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ACLs
altform
backplating
DACL
DACLs
Expand All @@ -9,7 +10,9 @@ microsoftonline
osgvsowi
powerrename
powershell
pscustomobject
SACLs
tdbuildteamid
vcruntime
visualstudio
wslpath
4 changes: 4 additions & 0 deletions .github/actions/spell-check/expect/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1083,6 +1083,8 @@ INITCOMMONCONTROLSEX
INITDIALOG
initguid
INITMENU
imagemagick
inkscape
inl
INLINEPREFIX
Inlines
Expand Down Expand Up @@ -1530,6 +1532,7 @@ nothrow
NOTICKS
NOTIMPL
notin
NOTOPMOST
NOTNULL
NOTRACK
NOTSUPPORTED
Expand Down Expand Up @@ -2265,6 +2268,7 @@ targetentrypoint
TARGETLIBS
TARGETNAME
targetnametoken
targetsize
targetver
taskbar
tbar
Expand Down
6 changes: 6 additions & 0 deletions doc/cascadia/profiles.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"switchToTab",
"toggleFocusMode",
"toggleFullscreen",
"toggleAlwaysOnTop",
"toggleRetroEffect",
"find",
"setTabColor",
Expand Down Expand Up @@ -324,6 +325,11 @@
"additionalProperties": true,
"description": "Properties that affect the entire window, regardless of the profile settings.",
"properties": {
"alwaysOnTop": {
"default": false,
"description": "When set to true, the window is created on top of all other windows. If multiple windows are all \"always on top\", the most recently focused one will be the topmost",
"type": "boolean"
},
"alwaysShowTabs": {
"default": true,
"description": "When set to true, tabs are always displayed. When set to false and \"showTabsInTitlebar\" is set to false, tabs only appear after opening a new tab.",
Expand Down
181 changes: 181 additions & 0 deletions res/terminal/Generate-TerminalAssets.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
#
# Generate-TerminalAssets.ps1
#
# Typical usage:
# .\Generate-TerminalAssets.ps1 -Path .\Terminal.svg -HighContrastPath .\Terminal_HC.svg -Destination .\images
# .\Generate-TerminalAssets.ps1 -Path .\Terminal_Pre.svg -HighContrastPath .\Terminal_Pre_HC.svg -Destination .\images-Pre
# .\Generate-TerminalAssets.ps1 -Path .\Terminal_Dev.svg -HighContrastPath .\Terminal_Dev_HC.svg -Destination .\images-Dev
#
# Some icons benefit from manual hints. The most efficient way to do that is to run the script twice:
#
# 1. Run .\Generate-TerminalAssets.ps1 ...args... -Destination .\images -KeepIntermediates
# 2. Manually hint the intermediate images under .\images\_intermediate*.png
# 3. Run .\Generate-TerminalAssets.ps1 ...args... -Destination .\images -UseExistingIntermediates
#
# Hinting the intermediate files minimizes the number of times you'll have to
# hint the same image. You may want to hint just the _intermediate.*.png and
# _intermediate.black.*.png files, and delete _intermediate.white.*.png. The
# script will then automatically derive _intermediate.white.*.png from
# _intermediate.black.*.png.
#

Param(
[Parameter(Mandatory=$true,ValueFromPipeline=$true)]
[string]$Path,
[string]$Destination,
[int[]]$Altforms = (16, 20, 24, 30, 32, 36, 40, 48, 60, 64, 72, 80, 96, 256),
[switch]$Unplated = $true,
[float[]]$Scales = (1.0, 1.25, 1.5, 2.0, 4.0),
[string]$HighContrastPath = "",
[switch]$UseExistingIntermediates = $false,
[switch]$KeepIntermediates = $false
)

$assetTypes = @(
[pscustomobject]@{Name="LargeTile"; W=310; H=310; IconSize=96}
[pscustomobject]@{Name="LockScreenLogo"; W=24; H=24; IconSize=24}
[pscustomobject]@{Name="SmallTile"; W=71; H=71; IconSize=36}
[pscustomobject]@{Name="SplashScreen"; W=620; H=300; IconSize=96}
[pscustomobject]@{Name="Square44x44Logo"; W=44; H=44; IconSize=32}
[pscustomobject]@{Name="Square150x150Logo"; W=150; H=150; IconSize=48}
[pscustomobject]@{Name="StoreLogo"; W=50; H=50; IconSize=36}
[pscustomobject]@{Name="Wide310x150Logo"; W=310; H=150; IconSize=48}
)

function CeilToEven ([int]$i) { if ($i % 2 -eq 0) { [int]($i) } else { [int]($i + 1) } }

$inflatedAssetSizes = $assetTypes | ForEach-Object {
$as = $_;
$scales | ForEach-Object {
[pscustomobject]@{
Name = $as.Name + ".scale-$($_*100)"
W = [math]::Round($as.W * $_, [System.MidpointRounding]::ToPositiveInfinity)
H = [math]::Round($as.H * $_, [System.MidpointRounding]::ToPositiveInfinity)
IconSize = CeilToEven ($as.IconSize * $_)
}
}
}

$allAssetSizes = $inflatedAssetSizes + ($Altforms | ForEach-Object {
[pscustomobject]@{
Name = "Square44x44Logo.targetsize-${_}"
W = [int]$_
H = [int]$_
IconSize = [int]$_
}
If ($Unplated) {
[pscustomobject]@{
Name = "Square44x44Logo.targetsize-${_}_altform-unplated"
W = [int]$_
H = [int]$_
IconSize = [int]$_
}
}
})

# Cross product with the 3 high contrast modes
$allAssetSizes = $allAssetSizes | ForEach-Object {
$asset = $_
("standard", "black", "white") | ForEach-Object {
$contrast = $_
$name = $asset.Name
If ($contrast -Ne "standard") {
If ($HighContrastPath -Eq "") {
# "standard" is the default, so we can omit it in filenames
return
}
$name += "_contrast-" + $contrast
}
[pscustomobject]@{
Name = $name
W = $asset.W
H = $asset.H
IconSize = $asset.IconSize
Contrast = $_
}
}
}

$allSizes = $allAssetSizes.IconSize | Group-Object | Select-Object -Expand Name

$TranslatedSVGPath = & wsl wslpath -u ((Get-Item $Path -ErrorAction:Stop).FullName -Replace "\\","/")
$TranslatedSVGContrastPath = $null
If ($HighContrastPath -Ne "") {
$TranslatedSVGContrastPath = & wsl wslpath -u ((Get-Item $HighContrastPath -ErrorAction:Stop).FullName -Replace "\\","/")
}
& wsl which inkscape | Out-Null
If ($LASTEXITCODE -Ne 0) { throw "Inkscape is not installed in WSL" }
& wsl which convert | Out-Null
If ($LASTEXITCODE -Ne 0) { throw "imagemagick is not installed in WSL" }

If (-Not [string]::IsNullOrEmpty($Destination)) {
New-Item -Type Directory $Destination -EA:Ignore
$TranslatedOutDir = & wsl wslpath -u ((Get-Item $Destination -EA:Stop).FullName -Replace "\\","/")
} Else {
$TranslatedOutDir = "."
}

$intermediateFiles = [System.Collections.Concurrent.ConcurrentBag[string]]::new()

# Generate the base icons
$allSizes | ForEach-Object -Parallel {
$sz = $_;

$destinationNt = $using:Destination
$destinationWsl = $using:TranslatedOutDir
$svgStandardWsl = $using:TranslatedSVGPath
$svgContrastWsl = $using:TranslatedSVGContrastPath

$intermediateStandardNt = "$destinationNt\_intermediate.standard.$($sz).png"
$intermediateStandardWsl = "$destinationWsl/_intermediate.standard.$($sz).png"

If (($using:UseExistingIntermediates -Eq $false) -Or (-Not (Test-Path $intermediateStandardNt))) {
wsl inkscape -z -e "$intermediateStandardWsl" -w $sz -h $sz $svgStandardWsl
} Else {
Write-Host "Using existing $intermediateStandardNt"
}

($using:intermediateFiles).Add($intermediateStandardNt)

If ($svgContrastWsl -Ne $null) {
$intermediateBlackNt = "$destinationNt\_intermediate.black.$($sz).png"
$intermediateWhiteNt = "$destinationNt\_intermediate.white.$($sz).png"
$intermediateBlackWsl = "$destinationWsl/_intermediate.black.$($sz).png"
$intermediateWhiteWsl = "$destinationWsl/_intermediate.white.$($sz).png"

If (($using:UseExistingIntermediates -Eq $false) -Or (-Not (Test-Path $intermediateBlackNt))) {
wsl inkscape -z -e "$intermediateBlackWsl" -w $sz -h $sz $svgContrastWsl
} Else {
Write-Host "Using existing $intermediateBlackNt"
}

If (($using:UseExistingIntermediates -Eq $false) -Or (-Not (Test-Path $intermediateWhiteNt))) {
# The HC white icon is just a negative image of the HC black one
wsl convert "$intermediateBlackWsl" -channel RGB -negate "$intermediateWhiteWsl"
} Else {
Write-Host "Using existing $intermediateWhiteNt"
}

($using:intermediateFiles).Add($intermediateBlackNt)
($using:intermediateFiles).Add($intermediateWhiteNt)
}
}

# Once the base icons are done, splat them into the middles of larger canvases.
$allAssetSizes | ForEach-Object -Parallel {
$asset = $_
If ($asset.W -Eq $asset.H -And $asset.IconSize -eq $asset.W) {
Write-Host "Copying base icon for size=$($asset.IconSize), contrast=$($asset.Contrast) to $($asset.Name)"
Copy-Item "${using:Destination}\_intermediate.$($asset.Contrast).$($asset.IconSize).png" "${using:Destination}\$($asset.Name).png" -Force
} Else {
wsl convert "$($using:TranslatedOutDir)/_intermediate.$($asset.Contrast).$($asset.IconSize).png" -gravity center -background transparent -extent "$($asset.W)x$($asset.H)" "$($using:TranslatedOutDir)/$($asset.Name).png"
}
}

If ($KeepIntermediates -Eq $false) {
$intermediateFiles | ForEach-Object {
Write-Host "Cleaning up intermediate file $_"
Remove-Item $_
}
}

17 changes: 17 additions & 0 deletions res/terminal/Terminal_Dev_HC.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions res/terminal/Terminal_HC.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions res/terminal/Terminal_Pre_HC.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 52d0e3c

Please sign in to comment.