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

Side by Side Diff: ash/wm/frame_painter.cc

Issue 10206021: Merge 133595 - ash: Fix transparency glitches in window header (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1084/src/
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « ash/wm/frame_painter.h ('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 "ash/wm/frame_painter.h" 5 #include "ash/wm/frame_painter.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/shell_window_ids.h" 8 #include "ash/shell_window_ids.h"
9 #include "ash/wm/window_util.h" 9 #include "ash/wm/window_util.h"
10 #include "base/logging.h" // DCHECK 10 #include "base/logging.h" // DCHECK
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 shader->unref(); 105 shader->unref();
106 // Adjust canvas to compensate for image sampling offset, draw, then adjust 106 // Adjust canvas to compensate for image sampling offset, draw, then adjust
107 // back. This is cheaper than pushing/popping the entire canvas state. 107 // back. This is cheaper than pushing/popping the entire canvas state.
108 canvas->sk_canvas()->translate(SkIntToScalar(-bitmap_offset_x), 0); 108 canvas->sk_canvas()->translate(SkIntToScalar(-bitmap_offset_x), 0);
109 canvas->sk_canvas()->drawPath(path, *paint); 109 canvas->sk_canvas()->drawPath(path, *paint);
110 canvas->sk_canvas()->translate(SkIntToScalar(bitmap_offset_x), 0); 110 canvas->sk_canvas()->translate(SkIntToScalar(bitmap_offset_x), 0);
111 } 111 }
112 112
113 // Returns true if |window| is a visible, normal window. 113 // Returns true if |window| is a visible, normal window.
114 bool IsVisibleNormalWindow(aura::Window* window) { 114 bool IsVisibleNormalWindow(aura::Window* window) {
115 // We must use TargetVisibility() because windows animate in and out and
116 // IsVisible() also tracks the layer visibility state.
115 return window && 117 return window &&
116 window->IsVisible() && 118 window->TargetVisibility() &&
117 window->type() == aura::client::WINDOW_TYPE_NORMAL; 119 window->type() == aura::client::WINDOW_TYPE_NORMAL;
118 } 120 }
119 121
120 } // namespace 122 } // namespace
121 123
122 namespace ash { 124 namespace ash {
123 125
124 // static 126 // static
125 int FramePainter::kActiveWindowOpacity = 230; // "Linus-approved" values 127 int FramePainter::kActiveWindowOpacity = 230; // "Linus-approved" values
126 int FramePainter::kInactiveWindowOpacity = 204; 128 int FramePainter::kInactiveWindowOpacity = 204;
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 if (ash::wm::IsWindowMaximized(window) || 458 if (ash::wm::IsWindowMaximized(window) ||
457 ash::wm::IsWindowFullscreen(window)) { 459 ash::wm::IsWindowFullscreen(window)) {
458 window->set_hit_test_bounds_override_inner(gfx::Insets()); 460 window->set_hit_test_bounds_override_inner(gfx::Insets());
459 } else { 461 } else {
460 window->set_hit_test_bounds_override_inner( 462 window->set_hit_test_bounds_override_inner(
461 gfx::Insets(kResizeInsideBoundsSize, kResizeInsideBoundsSize, 463 gfx::Insets(kResizeInsideBoundsSize, kResizeInsideBoundsSize,
462 kResizeInsideBoundsSize, kResizeInsideBoundsSize)); 464 kResizeInsideBoundsSize, kResizeInsideBoundsSize));
463 } 465 }
464 } 466 }
465 467
468 void FramePainter::OnWindowVisibilityChanged(aura::Window* window,
469 bool visible) {
470 // Hiding a window may trigger the solo window appearance in a different
471 // window.
472 if (!visible && UseSoloWindowHeader())
473 SchedulePaintForSoloWindow();
474 }
475
466 void FramePainter::OnWindowDestroying(aura::Window* destroying) { 476 void FramePainter::OnWindowDestroying(aura::Window* destroying) {
467 DCHECK_EQ(window_, destroying); 477 DCHECK_EQ(window_, destroying);
468 // Must be removed here and not in the destructor, as the aura::Window is 478 // Must be removed here and not in the destructor, as the aura::Window is
469 // already destroyed when our destructor runs. 479 // already destroyed when our destructor runs.
470 window_->RemoveObserver(this); 480 window_->RemoveObserver(this);
471 window_ = NULL; 481 window_ = NULL;
472 482
473 // For purposes of painting and solo window computation, we're done. 483 // For purposes of painting and solo window computation, we're done.
474 instances_->erase(this); 484 instances_->erase(this);
475 485
476 // If we have two or more windows open and we close this one, we might trigger 486 // If we have two or more windows open and we close this one, we might trigger
477 // the solo window appearance. If so, find the window that is becoming solo 487 // the solo window appearance for another window.
478 // and schedule it to paint. 488 if (UseSoloWindowHeader())
479 if (UseSoloWindowHeader()) { 489 SchedulePaintForSoloWindow();
480 for (std::set<FramePainter*>::const_iterator it = instances_->begin();
481 it != instances_->end();
482 ++it) {
483 FramePainter* painter = *it;
484 if (IsVisibleNormalWindow(painter->window_) && painter->frame_)
485 painter->frame_->non_client_view()->SchedulePaint();
486 }
487 }
488 } 490 }
489 491
490 /////////////////////////////////////////////////////////////////////////////// 492 ///////////////////////////////////////////////////////////////////////////////
491 // FramePainter, private: 493 // FramePainter, private:
492 494
493 void FramePainter::SetButtonImages(views::ImageButton* button, 495 void FramePainter::SetButtonImages(views::ImageButton* button,
494 int normal_bitmap_id, 496 int normal_bitmap_id,
495 int hot_bitmap_id, 497 int hot_bitmap_id,
496 int pushed_bitmap_id) { 498 int pushed_bitmap_id) {
497 ui::ThemeProvider* theme_provider = frame_->GetThemeProvider(); 499 ui::ThemeProvider* theme_provider = frame_->GetThemeProvider();
(...skipping 19 matching lines...) Expand all
517 ++it) { 519 ++it) {
518 if (IsVisibleNormalWindow((*it)->window_)) { 520 if (IsVisibleNormalWindow((*it)->window_)) {
519 window_count++; 521 window_count++;
520 if (window_count > 1) 522 if (window_count > 1)
521 return false; 523 return false;
522 } 524 }
523 } 525 }
524 return window_count == 1; 526 return window_count == 1;
525 } 527 }
526 528
529 // static
530 void FramePainter::SchedulePaintForSoloWindow() {
531 for (std::set<FramePainter*>::const_iterator it = instances_->begin();
532 it != instances_->end();
533 ++it) {
534 FramePainter* painter = *it;
535 if (IsVisibleNormalWindow(painter->window_))
536 painter->frame_->non_client_view()->SchedulePaint();
537 }
538 }
539
527 } // namespace ash 540 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/frame_painter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698