OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/media/webrtc/window_icon_util.h" | 5 #include "chrome/browser/media/webrtc/window_icon_util.h" |
6 | 6 |
7 #include <ApplicationServices/ApplicationServices.h> | 7 #include <ApplicationServices/ApplicationServices.h> |
8 #include <Cocoa/Cocoa.h> | 8 #include <Cocoa/Cocoa.h> |
9 #include <CoreFoundation/CoreFoundation.h> | 9 #include <CoreFoundation/CoreFoundation.h> |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 } | 46 } |
47 | 47 |
48 CGDataProviderRef provider = CGImageGetDataProvider(cg_icon_image); | 48 CGDataProviderRef provider = CGImageGetDataProvider(cg_icon_image); |
49 CFDataRef cf_data = CGDataProviderCopyData(provider); | 49 CFDataRef cf_data = CGDataProviderCopyData(provider); |
50 | 50 |
51 int src_stride = CGImageGetBytesPerRow(cg_icon_image); | 51 int src_stride = CGImageGetBytesPerRow(cg_icon_image); |
52 const uint8_t* src_data = CFDataGetBytePtr(cf_data); | 52 const uint8_t* src_data = CFDataGetBytePtr(cf_data); |
53 | 53 |
54 SkBitmap result; | 54 SkBitmap result; |
55 result.allocN32Pixels(width, height, false); | 55 result.allocN32Pixels(width, height, false); |
56 result.lockPixels(); | |
57 | 56 |
58 uint8_t* pixels_data = reinterpret_cast<uint8_t*>(result.getPixels()); | 57 uint8_t* pixels_data = reinterpret_cast<uint8_t*>(result.getPixels()); |
59 | 58 |
60 libyuv::ABGRToARGB(src_data, src_stride, pixels_data, result.rowBytes(), | 59 libyuv::ABGRToARGB(src_data, src_stride, pixels_data, result.rowBytes(), |
61 width, height); | 60 width, height); |
62 | 61 |
63 CFRelease(cf_data); | 62 CFRelease(cf_data); |
64 | 63 |
65 return gfx::ImageSkia::CreateFrom1xBitmap(result); | 64 return gfx::ImageSkia::CreateFrom1xBitmap(result); |
66 } | 65 } |
OLD | NEW |