| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2006,2007,2008, Google Inc. All rights reserved. | 2 * Copyright (c) 2006,2007,2008, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 SkPaint pathPaint = paint; | 331 SkPaint pathPaint = paint; |
| 332 pathPaint.setPathEffect( | 332 pathPaint.setPathEffect( |
| 333 SkCornerPathEffect::Make(SkFloatToScalar(cornerRadius))); | 333 SkCornerPathEffect::Make(SkFloatToScalar(cornerRadius))); |
| 334 canvas->drawPath(path, pathPaint); | 334 canvas->drawPath(path, pathPaint); |
| 335 } | 335 } |
| 336 | 336 |
| 337 template <typename PrimitiveType> | 337 template <typename PrimitiveType> |
| 338 void drawPlatformFocusRing(const PrimitiveType& primitive, | 338 void drawPlatformFocusRing(const PrimitiveType& primitive, |
| 339 SkCanvas* canvas, | 339 SkCanvas* canvas, |
| 340 SkColor color, | 340 SkColor color, |
| 341 int width) { | 341 float width) { |
| 342 SkPaint paint; | 342 SkPaint paint; |
| 343 paint.setAntiAlias(true); | 343 paint.setAntiAlias(true); |
| 344 paint.setStyle(SkPaint::kStroke_Style); | 344 paint.setStyle(SkPaint::kStroke_Style); |
| 345 paint.setColor(color); | 345 paint.setColor(color); |
| 346 paint.setStrokeWidth(GraphicsContext::focusRingWidth(width)); | 346 paint.setStrokeWidth(width); |
| 347 | 347 |
| 348 #if OS(MACOSX) | 348 #if OS(MACOSX) |
| 349 paint.setAlpha(64); | 349 paint.setAlpha(64); |
| 350 const float cornerRadius = (width - 1) * 0.5f; | 350 const float cornerRadius = (width - 1) * 0.5f; |
| 351 #else | 351 #else |
| 352 const float cornerRadius = 1; | 352 const float cornerRadius = width; |
| 353 #endif | 353 #endif |
| 354 | 354 |
| 355 drawFocusRingPrimitive(primitive, canvas, paint, cornerRadius); | 355 drawFocusRingPrimitive(primitive, canvas, paint, cornerRadius); |
| 356 | 356 |
| 357 #if OS(MACOSX) | 357 #if OS(MACOSX) |
| 358 // Inner part | 358 // Inner part |
| 359 paint.setAlpha(128); | 359 paint.setAlpha(128); |
| 360 paint.setStrokeWidth(paint.getStrokeWidth() * 0.5f); | 360 paint.setStrokeWidth(paint.getStrokeWidth() * 0.5f); |
| 361 drawFocusRingPrimitive(primitive, canvas, paint, cornerRadius); | 361 drawFocusRingPrimitive(primitive, canvas, paint, cornerRadius); |
| 362 #endif | 362 #endif |
| 363 } | 363 } |
| 364 | 364 |
| 365 template void PLATFORM_EXPORT drawPlatformFocusRing<SkRect>(const SkRect&, | 365 template void PLATFORM_EXPORT drawPlatformFocusRing<SkRect>(const SkRect&, |
| 366 SkCanvas*, | 366 SkCanvas*, |
| 367 SkColor, | 367 SkColor, |
| 368 int width); | 368 float width); |
| 369 template void PLATFORM_EXPORT drawPlatformFocusRing<SkPath>(const SkPath&, | 369 template void PLATFORM_EXPORT drawPlatformFocusRing<SkPath>(const SkPath&, |
| 370 SkCanvas*, | 370 SkCanvas*, |
| 371 SkColor, | 371 SkColor, |
| 372 int width); | 372 float width); |
| 373 | 373 |
| 374 } // namespace blink | 374 } // namespace blink |
| OLD | NEW |