OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008-2009 Torch Mobile, Inc. | 3 * Copyright (C) 2008-2009 Torch Mobile, Inc. |
4 * Copyright (C) 2013 Google Inc. All rights reserved. | 4 * Copyright (C) 2013 Google Inc. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 void setURLFragmentForRect(const String& name, const IntRect&); | 351 void setURLFragmentForRect(const String& name, const IntRect&); |
352 | 352 |
353 // Sets location of a URL destination (a.k.a. anchor) in the page. | 353 // Sets location of a URL destination (a.k.a. anchor) in the page. |
354 void setURLDestinationLocation(const String& name, const IntPoint&); | 354 void setURLDestinationLocation(const String& name, const IntPoint&); |
355 | 355 |
356 static void adjustLineToPixelBoundaries(FloatPoint& p1, | 356 static void adjustLineToPixelBoundaries(FloatPoint& p1, |
357 FloatPoint& p2, | 357 FloatPoint& p2, |
358 float strokeWidth, | 358 float strokeWidth, |
359 StrokeStyle); | 359 StrokeStyle); |
360 | 360 |
361 static int focusRingOutsetExtent(int offset, int width) { | 361 static int focusRingOutsetExtent(int offset, int width); |
362 // Unlike normal outlines (whole width is outside of the offset), focus | |
363 // rings are drawn with the center of the path aligned with the offset, so | |
364 // only half of the width is outside of the offset. | |
365 return focusRingOffset(offset) + (width + 1) / 2; | |
366 } | |
367 | 362 |
368 #if DCHECK_IS_ON() | 363 #if DCHECK_IS_ON() |
369 void setInDrawingRecorder(bool); | 364 void setInDrawingRecorder(bool); |
370 #endif | 365 #endif |
371 | 366 |
372 static sk_sp<SkColorFilter> WebCoreColorFilterToSkiaColorFilter(ColorFilter); | 367 static sk_sp<SkColorFilter> WebCoreColorFilterToSkiaColorFilter(ColorFilter); |
373 | 368 |
374 private: | 369 private: |
375 const GraphicsContextState* immutableState() const { return m_paintState; } | 370 const GraphicsContextState* immutableState() const { return m_paintState; } |
376 | 371 |
377 GraphicsContextState* mutableState() { | 372 GraphicsContextState* mutableState() { |
378 realizePaintSave(); | 373 realizePaintSave(); |
379 return m_paintState; | 374 return m_paintState; |
380 } | 375 } |
381 | 376 |
382 template <typename DrawTextFunc> | 377 template <typename DrawTextFunc> |
383 void drawTextPasses(const DrawTextFunc&); | 378 void drawTextPasses(const DrawTextFunc&); |
384 | 379 |
385 #if OS(MACOSX) | |
386 static inline int focusRingOffset(int offset) { return offset + 2; } | |
387 #else | |
388 static inline int focusRingOffset(int offset) { return 0; } | |
389 #endif | |
390 | |
391 void saveLayer(const SkRect* bounds, const PaintFlags*); | 380 void saveLayer(const SkRect* bounds, const PaintFlags*); |
392 void restoreLayer(); | 381 void restoreLayer(); |
393 | 382 |
394 // Helpers for drawing a focus ring (drawFocusRing) | 383 // Helpers for drawing a focus ring (drawFocusRing) |
395 void drawFocusRingPath(const SkPath&, const Color&, float width); | 384 void drawFocusRingPath(const SkPath&, const Color&, float width); |
396 void drawFocusRingRect(const SkRect&, const Color&, float width); | 385 void drawFocusRingRect(const SkRect&, const Color&, float width); |
397 | 386 |
398 // SkCanvas wrappers. | 387 // SkCanvas wrappers. |
399 void clipRRect(const SkRRect&, | 388 void clipRRect(const SkRRect&, |
400 AntiAliasingMode = NotAntiAliased, | 389 AntiAliasingMode = NotAntiAliased, |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 | 448 |
460 float m_deviceScaleFactor; | 449 float m_deviceScaleFactor; |
461 | 450 |
462 unsigned m_printing : 1; | 451 unsigned m_printing : 1; |
463 unsigned m_hasMetaData : 1; | 452 unsigned m_hasMetaData : 1; |
464 }; | 453 }; |
465 | 454 |
466 } // namespace blink | 455 } // namespace blink |
467 | 456 |
468 #endif // GraphicsContext_h | 457 #endif // GraphicsContext_h |
OLD | NEW |