| 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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 SkFilterQuality computeFilterQuality(Image*, const FloatRect& dest, const Fl
oatRect& src) const; | 264 SkFilterQuality computeFilterQuality(Image*, const FloatRect& dest, const Fl
oatRect& src) const; |
| 265 | 265 |
| 266 // URL drawing | 266 // URL drawing |
| 267 void setURLForRect(const KURL&, const IntRect&); | 267 void setURLForRect(const KURL&, const IntRect&); |
| 268 void setURLFragmentForRect(const String& name, const IntRect&); | 268 void setURLFragmentForRect(const String& name, const IntRect&); |
| 269 | 269 |
| 270 static void adjustLineToPixelBoundaries(FloatPoint& p1, FloatPoint& p2, floa
t strokeWidth, StrokeStyle); | 270 static void adjustLineToPixelBoundaries(FloatPoint& p1, FloatPoint& p2, floa
t strokeWidth, StrokeStyle); |
| 271 | 271 |
| 272 static int focusRingOutsetExtent(int offset, int width) | 272 static int focusRingOutsetExtent(int offset, int width) |
| 273 { | 273 { |
| 274 return focusRingOutset(offset) + (focusRingWidth(width) + 1) / 2; | 274 // Unlike normal outlines (whole width is outside of the offset), focus
rings are drawn with the |
| 275 // center of the path aligned with the offset, so only half of the width
is outside of the offset. |
| 276 return focusRingOffset(offset) + (focusRingWidth(width) + 1) / 2; |
| 275 } | 277 } |
| 276 | 278 |
| 279 #if OS(MACOSX) |
| 280 static int focusRingWidth(int width) { return width; } |
| 281 #else |
| 282 static int focusRingWidth(int width) { return 1; } |
| 283 #endif |
| 284 |
| 277 // public decl needed for OwnPtr wrapper. | 285 // public decl needed for OwnPtr wrapper. |
| 278 class RecordingState; | 286 class RecordingState; |
| 279 | 287 |
| 280 #if ENABLE(ASSERT) | 288 #if ENABLE(ASSERT) |
| 281 void setInDrawingRecorder(bool); | 289 void setInDrawingRecorder(bool); |
| 282 #endif | 290 #endif |
| 283 | 291 |
| 284 static PassRefPtr<SkColorFilter> WebCoreColorFilterToSkiaColorFilter(ColorFi
lter); | 292 static PassRefPtr<SkColorFilter> WebCoreColorFilterToSkiaColorFilter(ColorFi
lter); |
| 285 | 293 |
| 286 private: | 294 private: |
| 287 explicit GraphicsContext(SkCanvas*, DisplayItemList*, DisabledMode = Nothing
Disabled, SkMetaData* = 0); | 295 explicit GraphicsContext(SkCanvas*, DisplayItemList*, DisabledMode = Nothing
Disabled, SkMetaData* = 0); |
| 288 | 296 |
| 289 const GraphicsContextState* immutableState() const { return m_paintState; } | 297 const GraphicsContextState* immutableState() const { return m_paintState; } |
| 290 | 298 |
| 291 GraphicsContextState* mutableState() | 299 GraphicsContextState* mutableState() |
| 292 { | 300 { |
| 293 realizePaintSave(); | 301 realizePaintSave(); |
| 294 return m_paintState; | 302 return m_paintState; |
| 295 } | 303 } |
| 296 | 304 |
| 297 template<typename DrawTextFunc> | 305 template<typename DrawTextFunc> |
| 298 void drawTextPasses(const DrawTextFunc&); | 306 void drawTextPasses(const DrawTextFunc&); |
| 299 | 307 |
| 300 static void setPathFromPoints(SkPath*, size_t, const FloatPoint*); | 308 static void setPathFromPoints(SkPath*, size_t, const FloatPoint*); |
| 301 | 309 |
| 302 #if OS(MACOSX) | 310 #if OS(MACOSX) |
| 303 static inline int focusRingOutset(int offset) { return offset + 2; } | 311 static inline int focusRingOffset(int offset) { return offset + 2; } |
| 304 static inline int focusRingWidth(int width) { return width; } | |
| 305 #else | 312 #else |
| 306 static inline int focusRingOutset(int offset) { return 0; } | 313 static inline int focusRingOffset(int offset) { return 0; } |
| 307 static inline int focusRingWidth(int width) { return 1; } | |
| 308 static SkPMColor lineColors(int); | 314 static SkPMColor lineColors(int); |
| 309 static SkPMColor antiColors1(int); | 315 static SkPMColor antiColors1(int); |
| 310 static SkPMColor antiColors2(int); | 316 static SkPMColor antiColors2(int); |
| 311 static void draw1xMarker(SkBitmap*, int); | 317 static void draw1xMarker(SkBitmap*, int); |
| 312 static void draw2xMarker(SkBitmap*, int); | 318 static void draw2xMarker(SkBitmap*, int); |
| 313 #endif | 319 #endif |
| 314 | 320 |
| 315 void saveLayer(const SkRect* bounds, const SkPaint*); | 321 void saveLayer(const SkRect* bounds, const SkPaint*); |
| 316 void restoreLayer(); | 322 void restoreLayer(); |
| 317 | 323 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 | 391 |
| 386 float m_deviceScaleFactor; | 392 float m_deviceScaleFactor; |
| 387 | 393 |
| 388 unsigned m_printing : 1; | 394 unsigned m_printing : 1; |
| 389 unsigned m_hasMetaData : 1; | 395 unsigned m_hasMetaData : 1; |
| 390 }; | 396 }; |
| 391 | 397 |
| 392 } // namespace blink | 398 } // namespace blink |
| 393 | 399 |
| 394 #endif // GraphicsContext_h | 400 #endif // GraphicsContext_h |
| OLD | NEW |