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

Side by Side Diff: ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc

Issue 266643003: linux_aura: Add a flag for experimenting with ARGB windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: USE_X11 Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/x11_whole_screen_move_loop.h" 5 #include "ui/views/widget/desktop_aura/x11_whole_screen_move_loop.h"
6 6
7 #include <X11/Xlib.h> 7 #include <X11/Xlib.h>
8 // Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class. 8 // Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class.
9 #undef RootWindow 9 #undef RootWindow
10 10
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 image->SetImage(drag_image_); 356 image->SetImage(drag_image_);
357 image->SetBounds(0, 0, drag_image_.width(), drag_image_.height()); 357 image->SetBounds(0, 0, drag_image_.width(), drag_image_.height());
358 widget->SetContentsView(image); 358 widget->SetContentsView(image);
359 widget->Show(); 359 widget->Show();
360 widget->GetNativeWindow()->layer()->SetFillsBoundsOpaquely(false); 360 widget->GetNativeWindow()->layer()->SetFillsBoundsOpaquely(false);
361 361
362 drag_widget_.reset(widget); 362 drag_widget_.reset(widget);
363 } 363 }
364 364
365 bool X11WholeScreenMoveLoop::CheckIfIconValid() { 365 bool X11WholeScreenMoveLoop::CheckIfIconValid() {
366 // TODO(erg): I've tried at least five different strategies for trying to 366 // Because we need a GL context per window, we do a quick check so that we
367 // build a mask based off the alpha channel. While all of them have worked, 367 // don't make another context if the window would just be displaying a mostly
368 // none of them have been performant and introduced multiple second 368 // transparent image.
369 // delays. (I spent a day getting a rectangle segmentation algorithm polished
370 // here...and then found that even through I had the rectangle extraction
371 // down to mere milliseconds, SkRegion still fell over on the number of
372 // rectangles.)
373 //
374 // Creating a mask here near instantaneously should be possible, as GTK does
375 // it, but I've blown days on this and I'm punting now.
376
377 const SkBitmap* in_bitmap = drag_image_.bitmap(); 369 const SkBitmap* in_bitmap = drag_image_.bitmap();
378 SkAutoLockPixels in_lock(*in_bitmap); 370 SkAutoLockPixels in_lock(*in_bitmap);
379 for (int y = 0; y < in_bitmap->height(); ++y) { 371 for (int y = 0; y < in_bitmap->height(); ++y) {
380 uint32* in_row = in_bitmap->getAddr32(0, y); 372 uint32* in_row = in_bitmap->getAddr32(0, y);
381 373
382 for (int x = 0; x < in_bitmap->width(); ++x) { 374 for (int x = 0; x < in_bitmap->width(); ++x) {
383 if (SkColorGetA(in_row[x]) > kMinAlpha) 375 if (SkColorGetA(in_row[x]) > kMinAlpha)
384 return true; 376 return true;
385 } 377 }
386 } 378 }
387 379
388 return false; 380 return false;
389 } 381 }
390 382
391 } // namespace views 383 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698