Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(198)

Side by Side Diff: webrtc/modules/desktop_capture/rgba_color.cc

Issue 2500883004: Add DesktopFrame rotation functions (Closed)
Patch Set: Resolve review comments Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 23 matching lines...) Expand all
34 34
35 RgbaColor::RgbaColor(uint8_t blue, uint8_t green, uint8_t red) 35 RgbaColor::RgbaColor(uint8_t blue, uint8_t green, uint8_t red)
36 : RgbaColor(blue, green, red, 0xff) {} 36 : RgbaColor(blue, green, red, 0xff) {}
37 37
38 RgbaColor::RgbaColor(const uint8_t* bgra) 38 RgbaColor::RgbaColor(const uint8_t* bgra)
39 : RgbaColor(bgra[0], bgra[1], bgra[2], bgra[3]) {} 39 : RgbaColor(bgra[0], bgra[1], bgra[2], bgra[3]) {}
40 40
41 RgbaColor::RgbaColor(uint32_t bgra) 41 RgbaColor::RgbaColor(uint32_t bgra)
42 : RgbaColor(reinterpret_cast<uint8_t*>(&bgra)) {} 42 : RgbaColor(reinterpret_cast<uint8_t*>(&bgra)) {}
43 43
44 RgbaColor::RgbaColor(int bgra) : RgbaColor(static_cast<uint32_t>(bgra)) {}
45
44 bool RgbaColor::operator==(const RgbaColor& right) const { 46 bool RgbaColor::operator==(const RgbaColor& right) const {
45 return blue == right.blue && green == right.green && red == right.red && 47 return blue == right.blue && green == right.green && red == right.red &&
46 AlphaEquals(alpha, right.alpha); 48 AlphaEquals(alpha, right.alpha);
47 } 49 }
48 50
49 bool RgbaColor::operator!=(const RgbaColor& right) const { 51 bool RgbaColor::operator!=(const RgbaColor& right) const {
50 return !(*this == right); 52 return !(*this == right);
51 } 53 }
52 54
53 uint32_t RgbaColor::ToUInt32() const { 55 uint32_t RgbaColor::ToUInt32() const {
54 #if defined(WEBRTC_ARCH_LITTLE_ENDIAN) 56 #if defined(WEBRTC_ARCH_LITTLE_ENDIAN)
55 return blue | (green << 8) | (red << 16) | (alpha << 24); 57 return blue | (green << 8) | (red << 16) | (alpha << 24);
56 #else 58 #else
57 return (blue << 24) | (green << 16) | (red << 8) | alpha; 59 return (blue << 24) | (green << 16) | (red << 8) | alpha;
58 #endif 60 #endif
59 } 61 }
60 62
61 } // namespace webrtc 63 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698