OLD | NEW |
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/touchui/touch_selection_controller_impl.h" | 5 #include "ui/views/touchui/touch_selection_controller_impl.h" |
6 | 6 |
7 #include "base/time.h" | 7 #include "base/time.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "grit/ui_strings.h" | 9 #include "grit/ui_strings.h" |
10 #include "third_party/skia/include/effects/SkGradientShader.h" | 10 #include "third_party/skia/include/effects/SkGradientShader.h" |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 | 246 |
247 static const SkScalar kGradientPoints[2] = { | 247 static const SkScalar kGradientPoints[2] = { |
248 SkIntToScalar(0), | 248 SkIntToScalar(0), |
249 SkIntToScalar(1) | 249 SkIntToScalar(1) |
250 }; | 250 }; |
251 | 251 |
252 SkPoint points[2]; | 252 SkPoint points[2]; |
253 points[0].iset(0, 0); | 253 points[0].iset(0, 0); |
254 points[1].iset(0, height()); | 254 points[1].iset(0, height()); |
255 | 255 |
256 SkShader* shader = SkGradientShader::CreateLinear(points, | 256 skia::RefPtr<SkShader> shader = skia::AdoptRef( |
257 kGradientColors, kGradientPoints, arraysize(kGradientPoints), | 257 SkGradientShader::CreateLinear( |
258 SkShader::kRepeat_TileMode); | 258 points, kGradientColors, kGradientPoints, |
| 259 arraysize(kGradientPoints), |
| 260 SkShader::kRepeat_TileMode)); |
259 DCHECK(shader); | 261 DCHECK(shader); |
260 | 262 |
261 SkPaint paint; | 263 SkPaint paint; |
262 paint.setShader(shader); | 264 paint.setShader(shader.get()); |
263 shader->unref(); | |
264 | 265 |
265 paint.setStyle(SkPaint::kFill_Style); | 266 paint.setStyle(SkPaint::kFill_Style); |
266 paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 267 paint.setXfermodeMode(SkXfermode::kSrc_Mode); |
267 | 268 |
268 canvas->DrawRect(GetLocalBounds(), paint); | 269 canvas->DrawRect(GetLocalBounds(), paint); |
269 #else | 270 #else |
270 canvas->DrawColor(SkColorSetRGB(210, 225, 246), | 271 canvas->DrawColor(SkColorSetRGB(210, 225, 246), |
271 SkXfermode::kSrc_Mode); | 272 SkXfermode::kSrc_Mode); |
272 #endif | 273 #endif |
273 } | 274 } |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 bool TouchSelectionControllerImpl::IsSelectionHandle2Visible() { | 488 bool TouchSelectionControllerImpl::IsSelectionHandle2Visible() { |
488 return selection_handle_2_->visible(); | 489 return selection_handle_2_->visible(); |
489 } | 490 } |
490 | 491 |
491 TouchSelectionController* TouchSelectionController::create( | 492 TouchSelectionController* TouchSelectionController::create( |
492 TouchSelectionClientView* client_view) { | 493 TouchSelectionClientView* client_view) { |
493 return new TouchSelectionControllerImpl(client_view); | 494 return new TouchSelectionControllerImpl(client_view); |
494 } | 495 } |
495 | 496 |
496 } // namespace views | 497 } // namespace views |
OLD | NEW |