| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 } | 70 } |
| 71 data++; | 71 data++; |
| 72 } | 72 } |
| 73 } | 73 } |
| 74 } | 74 } |
| 75 | 75 |
| 76 // Premultiplies RGB components of the pixel data in the given image by | 76 // Premultiplies RGB components of the pixel data in the given image by |
| 77 // the corresponding alpha components. | 77 // the corresponding alpha components. |
| 78 void AlphaMul(uint32_t* data, int width, int height) { | 78 void AlphaMul(uint32_t* data, int width, int height) { |
| 79 static_assert(sizeof(uint32_t) == kBytesPerPixel, | 79 static_assert(sizeof(uint32_t) == kBytesPerPixel, |
| 80 "size of uint32 should be the number of bytes per pixel"); | 80 "size of uint32_t should be the number of bytes per pixel"); |
| 81 | 81 |
| 82 for (uint32_t* data_end = data + width * height; data != data_end; ++data) { | 82 for (uint32_t* data_end = data + width * height; data != data_end; ++data) { |
| 83 RGBQUAD* from = reinterpret_cast<RGBQUAD*>(data); | 83 RGBQUAD* from = reinterpret_cast<RGBQUAD*>(data); |
| 84 RGBQUAD* to = reinterpret_cast<RGBQUAD*>(data); | 84 RGBQUAD* to = reinterpret_cast<RGBQUAD*>(data); |
| 85 to->rgbBlue = | 85 to->rgbBlue = |
| 86 (static_cast<uint16_t>(from->rgbBlue) * from->rgbReserved) / 0xff; | 86 (static_cast<uint16_t>(from->rgbBlue) * from->rgbReserved) / 0xff; |
| 87 to->rgbGreen = | 87 to->rgbGreen = |
| 88 (static_cast<uint16_t>(from->rgbGreen) * from->rgbReserved) / 0xff; | 88 (static_cast<uint16_t>(from->rgbGreen) * from->rgbReserved) / 0xff; |
| 89 to->rgbRed = | 89 to->rgbRed = |
| 90 (static_cast<uint16_t>(from->rgbRed) * from->rgbReserved) / 0xff; | 90 (static_cast<uint16_t>(from->rgbRed) * from->rgbReserved) / 0xff; |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 | 239 |
| 240 // Pre-multiply the resulting pixels since MouseCursor uses premultiplied | 240 // Pre-multiply the resulting pixels since MouseCursor uses premultiplied |
| 241 // images. | 241 // images. |
| 242 AlphaMul(reinterpret_cast<uint32_t*>(image->data()), width, height); | 242 AlphaMul(reinterpret_cast<uint32_t*>(image->data()), width, height); |
| 243 | 243 |
| 244 return new MouseCursor( | 244 return new MouseCursor( |
| 245 image.release(), DesktopVector(hotspot_x, hotspot_y)); | 245 image.release(), DesktopVector(hotspot_x, hotspot_y)); |
| 246 } | 246 } |
| 247 | 247 |
| 248 } // namespace webrtc | 248 } // namespace webrtc |
| OLD | NEW |