| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/autocomplete/autocomplete_edit_view_win.h" | 5 #include "chrome/browser/autocomplete/autocomplete_edit_view_win.h" |
| 6 | 6 |
| 7 #include <locale> | 7 #include <locale> |
| 8 | 8 |
| 9 #include "app/gfx/chrome_canvas.h" | 9 #include "app/gfx/canvas.h" |
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| 11 #include "app/l10n_util_win.h" | 11 #include "app/l10n_util_win.h" |
| 12 #include "app/os_exchange_data.h" | 12 #include "app/os_exchange_data.h" |
| 13 #include "app/win_util.h" | 13 #include "app/win_util.h" |
| 14 #include "base/base_drag_source.h" | 14 #include "base/base_drag_source.h" |
| 15 #include "base/base_drop_target.h" | 15 #include "base/base_drop_target.h" |
| 16 #include "base/basictypes.h" | 16 #include "base/basictypes.h" |
| 17 #include "base/clipboard.h" | 17 #include "base/clipboard.h" |
| 18 #include "base/iat_patch.h" | 18 #include "base/iat_patch.h" |
| 19 #include "base/lazy_instance.h" | 19 #include "base/lazy_instance.h" |
| (...skipping 1982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2002 | 2002 |
| 2003 // Create a paint context for drawing the antialiased stroke. | 2003 // Create a paint context for drawing the antialiased stroke. |
| 2004 SkPaint paint; | 2004 SkPaint paint; |
| 2005 paint.setAntiAlias(true); | 2005 paint.setAntiAlias(true); |
| 2006 paint.setStrokeWidth(kStrokeWidthPixels); | 2006 paint.setStrokeWidth(kStrokeWidthPixels); |
| 2007 paint.setStrokeCap(SkPaint::kRound_Cap); | 2007 paint.setStrokeCap(SkPaint::kRound_Cap); |
| 2008 | 2008 |
| 2009 // Create a canvas as large as |scheme_rect| to do our drawing, and initialize | 2009 // Create a canvas as large as |scheme_rect| to do our drawing, and initialize |
| 2010 // it to fully transparent so any antialiasing will look nice when painted | 2010 // it to fully transparent so any antialiasing will look nice when painted |
| 2011 // atop the edit. | 2011 // atop the edit. |
| 2012 ChromeCanvas canvas(scheme_rect.Width(), scheme_rect.Height(), false); | 2012 gfx::Canvas canvas(scheme_rect.Width(), scheme_rect.Height(), false); |
| 2013 // TODO (jcampan): This const_cast should not be necessary once the SKIA | 2013 // TODO (jcampan): This const_cast should not be necessary once the SKIA |
| 2014 // API has been changed to return a non-const bitmap. | 2014 // API has been changed to return a non-const bitmap. |
| 2015 (const_cast<SkBitmap&>(canvas.getDevice()->accessBitmap(true))). | 2015 (const_cast<SkBitmap&>(canvas.getDevice()->accessBitmap(true))). |
| 2016 eraseARGB(0, 0, 0, 0); | 2016 eraseARGB(0, 0, 0, 0); |
| 2017 | 2017 |
| 2018 // Calculate the start and end of the stroke, which are just the lower left | 2018 // Calculate the start and end of the stroke, which are just the lower left |
| 2019 // and upper right corners of the canvas, inset by the radius of the endcap | 2019 // and upper right corners of the canvas, inset by the radius of the endcap |
| 2020 // so we don't clip the endcap off. | 2020 // so we don't clip the endcap off. |
| 2021 const SkScalar kEndCapRadiusPixels = kStrokeWidthPixels / SkIntToScalar(2); | 2021 const SkScalar kEndCapRadiusPixels = kStrokeWidthPixels / SkIntToScalar(2); |
| 2022 const SkPoint start_point = { | 2022 const SkPoint start_point = { |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2253 } | 2253 } |
| 2254 | 2254 |
| 2255 void AutocompleteEditViewWin::RepaintDropHighlight(int position) { | 2255 void AutocompleteEditViewWin::RepaintDropHighlight(int position) { |
| 2256 if ((position != -1) && (position <= GetTextLength())) { | 2256 if ((position != -1) && (position <= GetTextLength())) { |
| 2257 const POINT min_loc(PosFromChar(position)); | 2257 const POINT min_loc(PosFromChar(position)); |
| 2258 const RECT highlight_bounds = {min_loc.x - 1, font_y_adjustment_, | 2258 const RECT highlight_bounds = {min_loc.x - 1, font_y_adjustment_, |
| 2259 min_loc.x + 2, font_ascent_ + font_descent_ + font_y_adjustment_}; | 2259 min_loc.x + 2, font_ascent_ + font_descent_ + font_y_adjustment_}; |
| 2260 InvalidateRect(&highlight_bounds, false); | 2260 InvalidateRect(&highlight_bounds, false); |
| 2261 } | 2261 } |
| 2262 } | 2262 } |
| OLD | NEW |