OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.h" | 5 #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <X11/Xatom.h> | 9 #include <X11/Xatom.h> |
10 | 10 |
(...skipping 1334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1345 | 1345 |
1346 bool DesktopDragDropClientAuraX11::IsValidDragImage( | 1346 bool DesktopDragDropClientAuraX11::IsValidDragImage( |
1347 const gfx::ImageSkia& image) { | 1347 const gfx::ImageSkia& image) { |
1348 if (image.isNull()) | 1348 if (image.isNull()) |
1349 return false; | 1349 return false; |
1350 | 1350 |
1351 // Because we need a GL context per window, we do a quick check so that we | 1351 // Because we need a GL context per window, we do a quick check so that we |
1352 // don't make another context if the window would just be displaying a mostly | 1352 // don't make another context if the window would just be displaying a mostly |
1353 // transparent image. | 1353 // transparent image. |
1354 const SkBitmap* in_bitmap = image.bitmap(); | 1354 const SkBitmap* in_bitmap = image.bitmap(); |
1355 SkAutoLockPixels in_lock(*in_bitmap); | |
1356 for (int y = 0; y < in_bitmap->height(); ++y) { | 1355 for (int y = 0; y < in_bitmap->height(); ++y) { |
1357 uint32_t* in_row = in_bitmap->getAddr32(0, y); | 1356 uint32_t* in_row = in_bitmap->getAddr32(0, y); |
1358 | 1357 |
1359 for (int x = 0; x < in_bitmap->width(); ++x) { | 1358 for (int x = 0; x < in_bitmap->width(); ++x) { |
1360 if (SkColorGetA(in_row[x]) > kMinAlpha) | 1359 if (SkColorGetA(in_row[x]) > kMinAlpha) |
1361 return true; | 1360 return true; |
1362 } | 1361 } |
1363 } | 1362 } |
1364 | 1363 |
1365 return false; | 1364 return false; |
1366 } | 1365 } |
1367 | 1366 |
1368 } // namespace views | 1367 } // namespace views |
OLD | NEW |