Move colorbrewer into its own proper header (#17444)

I'm planning to use the `dark2` color palette in the upcoming
cooked read rewrite as a debug aid to paint dirty regions.
Now that it's going to be used in more than one place I figured
it may be time to properly add it to the NOTICE file even if
it still won't be shipped with the final product.
This commit is contained in:
Leonard Hecker 2024-06-20 18:55:13 +02:00 committed by GitHub
parent 5d46e317b2
commit 324e0f425a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 47 additions and 71 deletions

View File

@ -1,77 +1,40 @@
aci aci
admins
allcolors allcolors
Apc
apc
backpressure
breadcrumb breadcrumb
breadcrumbs breadcrumbs
bsd
calt
ccmp ccmp
ccon ccon
changelog
clickable clickable
clig
CMMI CMMI
colorbrewer
consvc consvc
copyable copyable
Counterintuitively
CtrlDToClose
CVS
CUI
cybersecurity
dalet dalet
Dcs
dcs dcs
deselection deselection
dialytika dialytika
diffing diffing
dje dje
downside
downsides downsides
dze dze
dzhe dzhe
DTo
EDDB
EDDC
Emacspeak Emacspeak
Enum'd
Fitt Fitt
formattings
FTCS FTCS
ftp
fvar
gantt gantt
gcc
geeksforgeeks
ghe ghe
github
gje gje
godbolt godbolt
hostname
hostnames
https
hyperlink
hyperlinking hyperlinking
hyperlinks hyperlinks
iconify
ID
img
inlined
issuetitle
It'd
kje kje
libfuzzer libfuzzer
libuv
liga liga
lje lje
Llast Llast
llvm
Lmid Lmid
locl locl
lol lol
lorem
Lorigin Lorigin
maxed maxed
megathread megathread
@ -80,28 +43,23 @@ mkmk
mnt mnt
mru mru
nje nje
noreply
notwrapped notwrapped
ogonek ogonek
ok'd
overlined overlined
perlw perlw
pipeline
postmodern postmodern
Powerline Powerline
powerline
ptys ptys
pwshw pwshw
quickfix
qof qof
qps qps
Remappings quickfix
Retargets
rclt rclt
reimplementation reimplementation
Remappings
reserialization reserialization
reserialize
reserializes reserializes
Retargets
rlig rlig
rubyw rubyw
runtimes runtimes
@ -109,33 +67,18 @@ servicebus
shcha shcha
similaritytolerance similaritytolerance
slnt slnt
Sos
ssh
sustainability
stakeholders stakeholders
sustainability
sxn sxn
timeline
timelines
timestamped
TLDR TLDR
tokenizes
tonos tonos
toolset toolset
truthiness
tshe tshe
ubuntu
UEFI UEFI
uiatextrange uiatextrange
UIs
und und
unregister
versioned
vsdevcmd vsdevcmd
walkthrough
walkthroughs
We'd
westus westus
wildcards
workarounds workarounds
XBox XBox
YBox YBox

View File

@ -515,6 +515,7 @@ dsound
DSSCL DSSCL
DSwap DSwap
DTest DTest
DTo
DTTERM DTTERM
dup'ed dup'ed
dvi dvi

View File

@ -325,6 +325,27 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
``` ```
## ColorBrewer
**Source**: [https://colorbrewer2.org/](https://colorbrewer2.org/)
### License
```
Apache-Style Software License for ColorBrewer software and ColorBrewer Color Schemes
Copyright (c) 2002 Cynthia Brewer, Mark Harrower, and The Pennsylvania State University.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
```
# Microsoft Open Source # Microsoft Open Source
This product also incorporates source code from other Microsoft open source projects, all licensed under the MIT license. This product also incorporates source code from other Microsoft open source projects, all licensed under the MIT license.

View File

@ -3,7 +3,7 @@
#pragma once #pragma once
namespace Microsoft::Console::Render::Atlas::colorbrewer namespace til::colorbrewer
{ {
// The following list of colors is only used as a debug aid and not part of the final product. // The following list of colors is only used as a debug aid and not part of the final product.
// They're licensed under: // They're licensed under:
@ -22,7 +22,7 @@ namespace Microsoft::Console::Render::Atlas::colorbrewer
// CONDITIONS OF ANY KIND, either express or implied. See the License for the // CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License. // specific language governing permissions and limitations under the License.
// //
inline constexpr u32 pastel1[]{ inline constexpr uint32_t pastel1[]{
0xfbb4ae, 0xfbb4ae,
0xb3cde3, 0xb3cde3,
0xccebc5, 0xccebc5,
@ -33,4 +33,15 @@ namespace Microsoft::Console::Render::Atlas::colorbrewer
0xfddaec, 0xfddaec,
0xf2f2f2, 0xf2f2f2,
}; };
inline constexpr uint32_t dark2[]{
0x1b9e77,
0xd95f02,
0x7570b3,
0xe7298a,
0x66a61e,
0xe6ab02,
0xa6761d,
0x666666,
};
} }

View File

@ -465,6 +465,7 @@ void AtlasEngine::_present()
return; return;
} }
#pragma warning(suppress : 4127) // conditional expression is constant
if (!ATLAS_DEBUG_SHOW_DIRTY && !_p.s->target->disablePresent1 && memcmp(&dirtyRect, &fullRect, sizeof(RECT)) != 0) if (!ATLAS_DEBUG_SHOW_DIRTY && !_p.s->target->disablePresent1 && memcmp(&dirtyRect, &fullRect, sizeof(RECT)) != 0)
{ {
params.DirtyRectsCount = 1; params.DirtyRectsCount = 1;

View File

@ -7,7 +7,7 @@
#include <til/unicode.h> #include <til/unicode.h>
#if ATLAS_DEBUG_SHOW_DIRTY #if ATLAS_DEBUG_SHOW_DIRTY
#include "colorbrewer.h" #include <til/colorbrewer.h>
#endif #endif
#if ATLAS_DEBUG_DUMP_RENDER_TARGET #if ATLAS_DEBUG_DUMP_RENDER_TARGET
@ -911,7 +911,7 @@ void BackendD2D::_debugShowDirty(const RenderingPayload& p)
static_cast<f32>(rect.right), static_cast<f32>(rect.right),
static_cast<f32>(rect.bottom), static_cast<f32>(rect.bottom),
}; };
const auto color = colorbrewer::pastel1[i] | 0x1f000000; const auto color = til::colorbrewer::pastel1[i] | 0x1f000000;
_fillRectangle(rectF, color); _fillRectangle(rectF, color);
} }
} }

View File

@ -17,7 +17,7 @@
#include "../../types/inc/ColorFix.hpp" #include "../../types/inc/ColorFix.hpp"
#if ATLAS_DEBUG_SHOW_DIRTY || ATLAS_DEBUG_COLORIZE_GLYPH_ATLAS #if ATLAS_DEBUG_SHOW_DIRTY || ATLAS_DEBUG_COLORIZE_GLYPH_ATLAS
#include "colorbrewer.h" #include <til/colorbrewer.h>
#endif #endif
TIL_FAST_MATH_BEGIN TIL_FAST_MATH_BEGIN
@ -2222,7 +2222,7 @@ void BackendD3D::_debugShowDirty(const RenderingPayload& p)
if (rect.non_empty()) if (rect.non_empty())
{ {
_appendQuad() = { _appendQuad() = {
.shadingType = ShadingType::Selection, .shadingType = static_cast<u16>(ShadingType::Selection),
.position = { .position = {
static_cast<i16>(rect.left), static_cast<i16>(rect.left),
static_cast<i16>(rect.top), static_cast<i16>(rect.top),
@ -2231,7 +2231,7 @@ void BackendD3D::_debugShowDirty(const RenderingPayload& p)
static_cast<u16>(rect.right - rect.left), static_cast<u16>(rect.right - rect.left),
static_cast<u16>(rect.bottom - rect.top), static_cast<u16>(rect.bottom - rect.top),
}, },
.color = colorbrewer::pastel1[i] | 0x1f000000, .color = til::colorbrewer::pastel1[i] | 0x1f000000,
}; };
} }
} }

View File

@ -32,7 +32,6 @@
<ClInclude Include="BackendD2D.h" /> <ClInclude Include="BackendD2D.h" />
<ClInclude Include="BackendD3D.h" /> <ClInclude Include="BackendD3D.h" />
<ClInclude Include="BuiltinGlyphs.h" /> <ClInclude Include="BuiltinGlyphs.h" />
<ClInclude Include="colorbrewer.h" />
<ClInclude Include="common.h" /> <ClInclude Include="common.h" />
<ClInclude Include="dwrite.h" /> <ClInclude Include="dwrite.h" />
<ClInclude Include="DWriteTextAnalysis.h" /> <ClInclude Include="DWriteTextAnalysis.h" />
@ -102,4 +101,4 @@
<AdditionalIncludeDirectories>$(SolutionDir)\oss\stb;$(OutDir)$(ProjectName);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)\oss\stb;$(OutDir)$(ProjectName);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
</Project> </Project>