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

Side by Side Diff: ui/views/color_chooser/color_chooser_view.cc

Issue 2697063003: Revert of SkScalarMul is deprecated (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « ui/gfx/render_text.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/color_chooser/color_chooser_view.h" 5 #include "ui/views/color_chooser/color_chooser_view.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 if (hue_ != hue) { 257 if (hue_ != hue) {
258 hue_ = hue; 258 hue_ = hue;
259 SchedulePaint(); 259 SchedulePaint();
260 } 260 }
261 } 261 }
262 262
263 void ColorChooserView::SaturationValueView::OnSaturationValueChanged( 263 void ColorChooserView::SaturationValueView::OnSaturationValueChanged(
264 SkScalar saturation, 264 SkScalar saturation,
265 SkScalar value) { 265 SkScalar value) {
266 SkScalar scalar_size = SkIntToScalar(kSaturationValueSize - 1); 266 SkScalar scalar_size = SkIntToScalar(kSaturationValueSize - 1);
267 int x = SkScalarFloorToInt(saturation * scalar_size) + kBorderWidth; 267 int x = SkScalarFloorToInt(SkScalarMul(saturation, scalar_size)) +
268 int y = SkScalarFloorToInt((SK_Scalar1 - value) * scalar_size) + kBorderWidth; 268 kBorderWidth;
269 int y = SkScalarFloorToInt(SkScalarMul(SK_Scalar1 - value, scalar_size)) +
270 kBorderWidth;
269 if (gfx::Point(x, y) == marker_position_) 271 if (gfx::Point(x, y) == marker_position_)
270 return; 272 return;
271 273
272 marker_position_.set_x(x); 274 marker_position_.set_x(x);
273 marker_position_.set_y(y); 275 marker_position_.set_y(y);
274 SchedulePaint(); 276 SchedulePaint();
275 } 277 }
276 278
277 void ColorChooserView::SaturationValueView::ProcessEventAtLocation( 279 void ColorChooserView::SaturationValueView::ProcessEventAtLocation(
278 const gfx::Point& point) { 280 const gfx::Point& point) {
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 if (key_event.type() != ui::ET_KEY_PRESSED || 466 if (key_event.type() != ui::ET_KEY_PRESSED ||
465 (key_event.key_code() != ui::VKEY_RETURN && 467 (key_event.key_code() != ui::VKEY_RETURN &&
466 key_event.key_code() != ui::VKEY_ESCAPE)) 468 key_event.key_code() != ui::VKEY_ESCAPE))
467 return false; 469 return false;
468 470
469 GetWidget()->Close(); 471 GetWidget()->Close();
470 return true; 472 return true;
471 } 473 }
472 474
473 } // namespace views 475 } // namespace views
OLDNEW
« no previous file with comments | « ui/gfx/render_text.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698