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

Side by Side Diff: chrome/browser/media/webrtc/window_icon_util_x11.cc

Issue 2823003002: SkBitmap and SkPixelRef no longer need lock/unlock (Closed)
Patch Set: win fix after rebase Created 3 years, 8 months 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 // 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 <X11/Xatom.h> 7 #include <X11/Xatom.h>
8 #include <X11/Xutil.h> 8 #include <X11/Xutil.h>
9 9
10 #include "ui/gfx/x/x11_error_tracker.h" 10 #include "ui/gfx/x/x11_error_tracker.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 width = static_cast<int>(data[i]); 52 width = static_cast<int>(data[i]);
53 height = static_cast<int>(data[i + 1]); 53 height = static_cast<int>(data[i + 1]);
54 start = i + 2; 54 start = i + 2;
55 } 55 }
56 i = i + 2 + static_cast<int>(data[i] * data[i + 1]); 56 i = i + 2 + static_cast<int>(data[i] * data[i + 1]);
57 } 57 }
58 58
59 SkBitmap result; 59 SkBitmap result;
60 SkImageInfo info = SkImageInfo::MakeN32(width, height, kUnpremul_SkAlphaType); 60 SkImageInfo info = SkImageInfo::MakeN32(width, height, kUnpremul_SkAlphaType);
61 result.allocPixels(info); 61 result.allocPixels(info);
62 result.lockPixels();
63 62
64 uint32_t* pixels_data = reinterpret_cast<uint32_t*>(result.getPixels()); 63 uint32_t* pixels_data = reinterpret_cast<uint32_t*>(result.getPixels());
65 64
66 for (long y = 0; y < height; ++y) { 65 for (long y = 0; y < height; ++y) {
67 for (long x = 0; x < width; ++x) { 66 for (long x = 0; x < width; ++x) {
68 pixels_data[result.rowBytesAsPixels() * y + x] = 67 pixels_data[result.rowBytesAsPixels() * y + x] =
69 static_cast<uint32_t>(data[start + width * y + x]); 68 static_cast<uint32_t>(data[start + width * y + x]);
70 } 69 }
71 } 70 }
72 71
73 XFree(data); 72 XFree(data);
74 return gfx::ImageSkia::CreateFrom1xBitmap(result); 73 return gfx::ImageSkia::CreateFrom1xBitmap(result);
75 } 74 }
OLDNEW
« no previous file with comments | « chrome/browser/media/webrtc/window_icon_util_mac.mm ('k') | chrome/browser/plugins/plugin_power_saver_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698