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 = SkGradientShader::CreateLinear(points, |
257 kGradientColors, kGradientPoints, arraysize(kGradientPoints), | 257 kGradientColors, kGradientPoints, arraysize(kGradientPoints), |
258 SkShader::kRepeat_TileMode); | 258 SkShader::kRepeat_TileMode); |
259 DCHECK(shader); | 259 DCHECK(shader); |
260 | 260 |
261 SkPaint paint; | 261 SkPaint paint; |
262 paint.setShader(shader); | 262 paint.setShader(shader.get()); |
263 shader->unref(); | |
264 | 263 |
265 paint.setStyle(SkPaint::kFill_Style); | 264 paint.setStyle(SkPaint::kFill_Style); |
266 paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 265 paint.setXfermodeMode(SkXfermode::kSrc_Mode); |
267 | 266 |
268 canvas->DrawRect(GetLocalBounds(), paint); | 267 canvas->DrawRect(GetLocalBounds(), paint); |
269 #else | 268 #else |
270 canvas->DrawColor(SkColorSetRGB(210, 225, 246), | 269 canvas->DrawColor(SkColorSetRGB(210, 225, 246), |
271 SkXfermode::kSrc_Mode); | 270 SkXfermode::kSrc_Mode); |
272 #endif | 271 #endif |
273 } | 272 } |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 bool TouchSelectionControllerImpl::IsSelectionHandle2Visible() { | 486 bool TouchSelectionControllerImpl::IsSelectionHandle2Visible() { |
488 return selection_handle_2_->visible(); | 487 return selection_handle_2_->visible(); |
489 } | 488 } |
490 | 489 |
491 TouchSelectionController* TouchSelectionController::create( | 490 TouchSelectionController* TouchSelectionController::create( |
492 TouchSelectionClientView* client_view) { | 491 TouchSelectionClientView* client_view) { |
493 return new TouchSelectionControllerImpl(client_view); | 492 return new TouchSelectionControllerImpl(client_view); |
494 } | 493 } |
495 | 494 |
496 } // namespace views | 495 } // namespace views |
OLD | NEW |