Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
googletest
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
googletest
Commits
a6b146df
Commit
a6b146df
authored
Jul 15, 2017
by
Zulkarnine Mahmud
Committed by
GitHub
Jul 15, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix assumption for foreground bit offset
parent
6a75e3c1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
gtest.cc
googletest/src/gtest.cc
+16
-3
No files found.
googletest/src/gtest.cc
View file @
a6b146df
...
@@ -2895,7 +2895,7 @@ WORD GetColorAttribute(GTestColor color) {
...
@@ -2895,7 +2895,7 @@ WORD GetColorAttribute(GTestColor color) {
}
}
int
GetBgOffset
(
WORD
background_mask
)
{
int
GetBgOffset
(
WORD
background_mask
)
{
if
(
background_mask
==
0
)
return
0
;
//let's not fall into infinite loop
if
(
background_mask
==
0
)
return
0
;
int
bitOffset
=
0
;
int
bitOffset
=
0
;
while
((
background_mask
&
1
)
==
0
)
{
while
((
background_mask
&
1
)
==
0
)
{
...
@@ -2905,6 +2905,16 @@ int GetBgOffset(WORD background_mask) {
...
@@ -2905,6 +2905,16 @@ int GetBgOffset(WORD background_mask) {
return
bitOffset
;
return
bitOffset
;
}
}
int
GetFgOffset
(
WORD
foreground_mask
)
{
if
(
foreground_mask
==
0
)
return
0
;
int
bitOffset
=
0
;
while
((
foreground_mask
&
1
)
==
0
)
{
foreground_mask
>>=
1
;
++
bitOffset
;
}
return
bitOffset
;
}
WORD
GetNewColor
(
GTestColor
color
,
WORD
old_color_attrs
)
{
WORD
GetNewColor
(
GTestColor
color
,
WORD
old_color_attrs
)
{
// Let's reuse the BG
// Let's reuse the BG
static
const
WORD
background_mask
=
BACKGROUND_BLUE
|
BACKGROUND_GREEN
|
BACKGROUND_RED
|
BACKGROUND_INTENSITY
;
static
const
WORD
background_mask
=
BACKGROUND_BLUE
|
BACKGROUND_GREEN
|
BACKGROUND_RED
|
BACKGROUND_INTENSITY
;
...
@@ -2912,9 +2922,12 @@ WORD GetNewColor(GTestColor color, WORD old_color_attrs) {
...
@@ -2912,9 +2922,12 @@ WORD GetNewColor(GTestColor color, WORD old_color_attrs) {
const
WORD
existing_bg
=
old_color_attrs
&
background_mask
;
const
WORD
existing_bg
=
old_color_attrs
&
background_mask
;
WORD
new_color
=
GetColorAttribute
(
color
)
|
existing_bg
|
FOREGROUND_INTENSITY
;
WORD
new_color
=
GetColorAttribute
(
color
)
|
existing_bg
|
FOREGROUND_INTENSITY
;
static
const
int
bg_bitOffset
=
GetBgOffset
(
background_mask
);
//it does not change
static
const
int
bg_bitOffset
=
GetBgOffset
(
background_mask
);
static
const
int
fg_bitOffset
=
GetFgOffset
(
foreground_mask
);
if
(((
new_color
&
background_mask
)
>>
bg_bitOffset
)
==
(
new_color
&
foreground_mask
))
new_color
^=
FOREGROUND_INTENSITY
;
//revert intensity
if
(((
new_color
&
background_mask
)
>>
bg_bitOffset
)
==
((
new_color
&
foreground_mask
)
>>
fg_bitOffset
))
{
new_color
^=
FOREGROUND_INTENSITY
;
//invert intensity
}
return
new_color
;
return
new_color
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment