Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 22 matching lines...) Expand all Loading... | |
| 33 | 33 |
| 34 // Creates a color from four-byte in BGRA order, i.e. DesktopFrame::data(). | 34 // Creates a color from four-byte in BGRA order, i.e. DesktopFrame::data(). |
| 35 explicit RgbaColor(const uint8_t* bgra); | 35 explicit RgbaColor(const uint8_t* bgra); |
| 36 | 36 |
| 37 // Creates a color from BGRA channels in a uint format. Consumers should make | 37 // Creates a color from BGRA channels in a uint format. Consumers should make |
| 38 // sure the memory order of the uint32_t is always BGRA from left to right, no | 38 // sure the memory order of the uint32_t is always BGRA from left to right, no |
| 39 // matter the system endian. This function creates an equivalent RgbaColor | 39 // matter the system endian. This function creates an equivalent RgbaColor |
| 40 // instance from the ToUInt32() result of another RgbaColor instance. | 40 // instance from the ToUInt32() result of another RgbaColor instance. |
| 41 explicit RgbaColor(uint32_t bgra); | 41 explicit RgbaColor(uint32_t bgra); |
| 42 | 42 |
| 43 // Converts an int to uint32_t, and creates a RGBA instance. This constructor | |
| 44 // helps users to write RgbaColor(0) without ambiguous conversion error. | |
| 45 explicit RgbaColor(int bgra); | |
|
Sergey Ulanov
2016/11/17 02:07:39
Do you still need this?
Hzj_jie
2016/11/17 07:14:55
Yes, it uses in test_utils_unittest.cc.
| |
| 46 | |
| 43 // Returns true if |this| and |right| is the same color. | 47 // Returns true if |this| and |right| is the same color. |
| 44 bool operator==(const RgbaColor& right) const; | 48 bool operator==(const RgbaColor& right) const; |
| 45 | 49 |
| 46 // Returns true if |this| and |right| are different colors. | 50 // Returns true if |this| and |right| are different colors. |
| 47 bool operator!=(const RgbaColor& right) const; | 51 bool operator!=(const RgbaColor& right) const; |
| 48 | 52 |
| 49 uint32_t ToUInt32() const; | 53 uint32_t ToUInt32() const; |
| 50 | 54 |
| 51 uint8_t blue; | 55 uint8_t blue; |
| 52 uint8_t green; | 56 uint8_t green; |
| 53 uint8_t red; | 57 uint8_t red; |
| 54 uint8_t alpha; | 58 uint8_t alpha; |
| 55 }; | 59 }; |
| 56 static_assert( | 60 static_assert( |
| 57 DesktopFrame::kBytesPerPixel == sizeof(RgbaColor), | 61 DesktopFrame::kBytesPerPixel == sizeof(RgbaColor), |
| 58 "A pixel in DesktopFrame should be safe to be represented by a RgbaColor"); | 62 "A pixel in DesktopFrame should be safe to be represented by a RgbaColor"); |
| 59 | 63 |
| 60 } // namespace webrtc | 64 } // namespace webrtc |
| 61 | 65 |
| 62 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_RGBA_COLOR_H_ | 66 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_RGBA_COLOR_H_ |
| OLD | NEW |