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

Side by Side Diff: trunk/src/ui/message_center/views/notification_view.cc

Issue 24262008: Revert 224473 "Remove dependency on ui::ScaleFactor from ui/gfx" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 3 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 | « trunk/src/ui/gfx/win/dpi.cc ('k') | trunk/src/ui/native_theme/native_theme_base.cc » ('j') | 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/message_center/views/notification_view.h" 5 #include "ui/message_center/views/notification_view.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "grit/ui_resources.h" 10 #include "grit/ui_resources.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 bool HasAlpha(gfx::ImageSkia& image, views::Widget* widget) { 101 bool HasAlpha(gfx::ImageSkia& image, views::Widget* widget) {
102 // Determine which bitmap to use. 102 // Determine which bitmap to use.
103 ui::ScaleFactor factor = ui::SCALE_FACTOR_100P; 103 ui::ScaleFactor factor = ui::SCALE_FACTOR_100P;
104 if (widget) { 104 if (widget) {
105 factor = ui::GetScaleFactorForNativeView(widget->GetNativeView()); 105 factor = ui::GetScaleFactorForNativeView(widget->GetNativeView());
106 if (factor == ui::SCALE_FACTOR_NONE) 106 if (factor == ui::SCALE_FACTOR_NONE)
107 factor = ui::SCALE_FACTOR_100P; 107 factor = ui::SCALE_FACTOR_100P;
108 } 108 }
109 109
110 // Extract that bitmap's alpha and look for a non-opaque pixel there. 110 // Extract that bitmap's alpha and look for a non-opaque pixel there.
111 SkBitmap bitmap = 111 SkBitmap bitmap = image.GetRepresentation(factor).sk_bitmap();
112 image.GetRepresentation(ui::GetImageScale(factor)).sk_bitmap();
113 if (!bitmap.isNull()) { 112 if (!bitmap.isNull()) {
114 SkBitmap alpha; 113 SkBitmap alpha;
115 alpha.setConfig(SkBitmap::kA1_Config, bitmap.width(), bitmap.height(), 0); 114 alpha.setConfig(SkBitmap::kA1_Config, bitmap.width(), bitmap.height(), 0);
116 bitmap.extractAlpha(&alpha); 115 bitmap.extractAlpha(&alpha);
117 for (int y = 0; y < bitmap.height(); ++y) { 116 for (int y = 0; y < bitmap.height(); ++y) {
118 for (int x = 0; x < bitmap.width(); ++x) { 117 for (int x = 0; x < bitmap.width(); ++x) {
119 if (alpha.getColor(x, y) != SK_ColorBLACK) { 118 if (alpha.getColor(x, y) != SK_ColorBLACK) {
120 return true; 119 return true;
121 } 120 }
122 } 121 }
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 return message_view_ ? 787 return message_view_ ?
789 message_view_->GetLinesForWidthAndLimit(width, limit) : 0; 788 message_view_->GetLinesForWidthAndLimit(width, limit) : 0;
790 } 789 }
791 790
792 int NotificationView::GetMessageHeight(int width, int limit) { 791 int NotificationView::GetMessageHeight(int width, int limit) {
793 return message_view_ ? 792 return message_view_ ?
794 message_view_->GetSizeForWidthAndLines(width, limit).height() : 0; 793 message_view_->GetSizeForWidthAndLines(width, limit).height() : 0;
795 } 794 }
796 795
797 } // namespace message_center 796 } // namespace message_center
OLDNEW
« no previous file with comments | « trunk/src/ui/gfx/win/dpi.cc ('k') | trunk/src/ui/native_theme/native_theme_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698