Commit 51daeb97 authored by rnk@chromium.org's avatar rnk@chromium.org

Fix Clang errors in the Windows screen capture code

"and" and "xor" are alternate spellings of the "&&" and "^" operators,
and clang doesn't like it if you use them as identifiers.

Clang also doesn't like static_cast<> from void * to a function pointer,
but reinterpret_cast<> works.

R=alexeypa@chromium.org
BUG=82385

Review URL: https://chromiumcodereview.appspot.com/13852007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@195057 0039d316-1c4b-4281-b951-d872f2087c98
parent 65aa2cd2
...@@ -217,7 +217,7 @@ ScreenCapturerWin::ScreenCapturerWin(bool disable_aero) ...@@ -217,7 +217,7 @@ ScreenCapturerWin::ScreenCapturerWin(bool disable_aero)
} }
if (dwmapi_library_.is_valid() && composition_func_ == NULL) { if (dwmapi_library_.is_valid() && composition_func_ == NULL) {
composition_func_ = static_cast<DwmEnableCompositionFunc>( composition_func_ = reinterpret_cast<DwmEnableCompositionFunc>(
dwmapi_library_.GetFunctionPointer("DwmEnableComposition")); dwmapi_library_.GetFunctionPointer("DwmEnableComposition"));
} }
} }
...@@ -542,8 +542,8 @@ void ScreenCapturerWin::CaptureCursor() { ...@@ -542,8 +542,8 @@ void ScreenCapturerWin::CaptureCursor() {
for (int x = 0; x < width; x++) { for (int x = 0; x < width; x++) {
int byte = y * row_bytes + x / 8; int byte = y * row_bytes + x / 8;
int bit = 7 - x % 8; int bit = 7 - x % 8;
int and = and_mask[byte] & (1 << bit); int and_bit = and_mask[byte] & (1 << bit);
int xor = xor_mask[byte] & (1 << bit); int xor_bit = xor_mask[byte] & (1 << bit);
// The two cursor masks combine as follows: // The two cursor masks combine as follows:
// AND XOR Windows Result Our result RGB Alpha // AND XOR Windows Result Our result RGB Alpha
...@@ -554,13 +554,13 @@ void ScreenCapturerWin::CaptureCursor() { ...@@ -554,13 +554,13 @@ void ScreenCapturerWin::CaptureCursor() {
// Since we don't support XOR cursors, we replace the "Reverse Screen" // Since we don't support XOR cursors, we replace the "Reverse Screen"
// with black. In this case, we also add an outline around the cursor // with black. In this case, we also add an outline around the cursor
// so that it is visible against a dark background. // so that it is visible against a dark background.
int rgb = (!and && xor) ? 0xff : 0x00; int rgb = (!and_bit && xor_bit) ? 0xff : 0x00;
int alpha = (and && !xor) ? 0x00 : 0xff; int alpha = (and_bit && !xor_bit) ? 0x00 : 0xff;
*dst++ = rgb; *dst++ = rgb;
*dst++ = rgb; *dst++ = rgb;
*dst++ = rgb; *dst++ = rgb;
*dst++ = alpha; *dst++ = alpha;
if (and && xor) { if (and_bit && xor_bit) {
add_outline = true; add_outline = true;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment