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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 canvas->drawPath(path, pathPaint); | 368 canvas->drawPath(path, pathPaint); |
369 } | 369 } |
370 | 370 |
371 template<typename PrimitiveType> | 371 template<typename PrimitiveType> |
372 void drawPlatformFocusRing(const PrimitiveType& primitive, SkCanvas* canvas, SkC
olor color, int width) | 372 void drawPlatformFocusRing(const PrimitiveType& primitive, SkCanvas* canvas, SkC
olor color, int width) |
373 { | 373 { |
374 SkPaint paint; | 374 SkPaint paint; |
375 paint.setAntiAlias(true); | 375 paint.setAntiAlias(true); |
376 paint.setStyle(SkPaint::kStroke_Style); | 376 paint.setStyle(SkPaint::kStroke_Style); |
377 paint.setColor(color); | 377 paint.setColor(color); |
| 378 paint.setStrokeWidth(GraphicsContext::focusRingWidth(width)); |
378 | 379 |
379 #if OS(MACOSX) | 380 #if OS(MACOSX) |
380 paint.setStrokeWidth(width); | |
381 paint.setAlpha(64); | 381 paint.setAlpha(64); |
382 float cornerRadius = (width - 1) * 0.5f; | 382 const float cornerRadius = (width - 1) * 0.5f; |
383 #else | 383 #else |
384 paint.setStrokeWidth(1); | |
385 const float cornerRadius = 1; | 384 const float cornerRadius = 1; |
386 #endif | 385 #endif |
387 | 386 |
388 drawFocusRingPrimitive(primitive, canvas, paint, cornerRadius); | 387 drawFocusRingPrimitive(primitive, canvas, paint, cornerRadius); |
389 | 388 |
390 #if OS(MACOSX) | 389 #if OS(MACOSX) |
391 // Inner part | 390 // Inner part |
392 paint.setAlpha(128); | 391 paint.setAlpha(128); |
393 paint.setStrokeWidth(paint.getStrokeWidth() * 0.5f); | 392 paint.setStrokeWidth(paint.getStrokeWidth() * 0.5f); |
394 drawFocusRingPrimitive(primitive, canvas, paint, cornerRadius); | 393 drawFocusRingPrimitive(primitive, canvas, paint, cornerRadius); |
395 #endif | 394 #endif |
396 } | 395 } |
397 | 396 |
398 template void PLATFORM_EXPORT drawPlatformFocusRing<SkRect>(const SkRect&, SkCan
vas*, SkColor, int width); | 397 template void PLATFORM_EXPORT drawPlatformFocusRing<SkRect>(const SkRect&, SkCan
vas*, SkColor, int width); |
399 template void PLATFORM_EXPORT drawPlatformFocusRing<SkPath>(const SkPath&, SkCan
vas*, SkColor, int width); | 398 template void PLATFORM_EXPORT drawPlatformFocusRing<SkPath>(const SkPath&, SkCan
vas*, SkColor, int width); |
400 | 399 |
401 } // namespace blink | 400 } // namespace blink |
OLD | NEW |