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

Unified Diff: ui/views/controls/menu/menu_scroll_view_container.cc

Issue 10702136: Support high dpi in menu scroll arrow, submenu arrow and drag_utils. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/controls/menu/menu_image_util.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/menu/menu_scroll_view_container.cc
diff --git a/ui/views/controls/menu/menu_scroll_view_container.cc b/ui/views/controls/menu/menu_scroll_view_container.cc
index 0bc133e8d59ef99c307d0c61577a9ed484671b69..66856811c68cf6c229ba41e3f4b62c8730f9559b 100644
--- a/ui/views/controls/menu/menu_scroll_view_container.cc
+++ b/ui/views/controls/menu/menu_scroll_view_container.cc
@@ -20,6 +20,9 @@
#include "ui/views/controls/menu/menu_item_view.h"
#include "ui/views/controls/menu/submenu_view.h"
+#include "third_party/skia/include/core/SkPath.h"
Ben Goodger (Google) 2012/07/12 03:12:45 sort with others
oshima 2012/07/12 04:00:19 Done.
+#include "third_party/skia/include/core/SkPaint.h"
+
using ui::NativeTheme;
// Height of the scroll arrow.
@@ -93,13 +96,28 @@ class MenuScrollButton : public View {
// Then the arrow.
int x = width() / 2;
int y = (height() - config.scroll_arrow_height) / 2;
- int delta_y = 1;
+
+ int x_left = x - config.scroll_arrow_height;
+ int x_right = x + config.scroll_arrow_height;
+ int y_bottom;
+
if (!is_up_) {
- delta_y = -1;
- y += config.scroll_arrow_height;
+ y_bottom = y;
+ y = y_bottom + config.scroll_arrow_height;
+ } else {
+ y_bottom = y + config.scroll_arrow_height;
}
- for (int i = 0; i < config.scroll_arrow_height; ++i, --x, y += delta_y)
- canvas->FillRect(gfx::Rect(x, y, (i * 2) + 1, 1), arrow_color);
+ SkPath path;
+ path.setFillType(SkPath::kWinding_FillType);
+ path.moveTo(SkIntToScalar(x), SkIntToScalar(y));
+ path.lineTo(SkIntToScalar(x_left), SkIntToScalar(y_bottom));
+ path.lineTo(SkIntToScalar(x_right), SkIntToScalar(y_bottom));
+ path.lineTo(SkIntToScalar(x), SkIntToScalar(y));
+ SkPaint paint;
+ paint.setStyle(SkPaint::kFill_Style);
+ paint.setAntiAlias(true);
+ paint.setColor(arrow_color);
+ canvas->DrawPath(path, paint);
}
private:
« no previous file with comments | « ui/views/controls/menu/menu_image_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698