| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 void setStrokeThickness(float thickness) { mutableState()->setStrokeThicknes
s(thickness); } | 113 void setStrokeThickness(float thickness) { mutableState()->setStrokeThicknes
s(thickness); } |
| 114 | 114 |
| 115 StrokeStyle strokeStyle() const { return immutableState()->strokeData().styl
e(); } | 115 StrokeStyle strokeStyle() const { return immutableState()->strokeData().styl
e(); } |
| 116 void setStrokeStyle(StrokeStyle style) { mutableState()->setStrokeStyle(styl
e); } | 116 void setStrokeStyle(StrokeStyle style) { mutableState()->setStrokeStyle(styl
e); } |
| 117 | 117 |
| 118 Color strokeColor() const { return immutableState()->strokeColor(); } | 118 Color strokeColor() const { return immutableState()->strokeColor(); } |
| 119 void setStrokeColor(const Color& color) { mutableState()->setStrokeColor(col
or); } | 119 void setStrokeColor(const Color& color) { mutableState()->setStrokeColor(col
or); } |
| 120 SkColor effectiveStrokeColor() const { return immutableState()->effectiveStr
okeColor(); } | 120 SkColor effectiveStrokeColor() const { return immutableState()->effectiveStr
okeColor(); } |
| 121 | 121 |
| 122 Pattern* strokePattern() const { return immutableState()->strokePattern(); } | 122 Pattern* strokePattern() const { return immutableState()->strokePattern(); } |
| 123 void setStrokePattern(PassRefPtr<Pattern>); | 123 void setStrokePattern(PassRefPtr<Pattern>, float additionalAlpha = 1); |
| 124 | 124 |
| 125 Gradient* strokeGradient() const { return immutableState()->strokeGradient()
; } | 125 Gradient* strokeGradient() const { return immutableState()->strokeGradient()
; } |
| 126 void setStrokeGradient(PassRefPtr<Gradient>); | 126 void setStrokeGradient(PassRefPtr<Gradient>, float additionalAlpha = 1); |
| 127 | 127 |
| 128 void setLineCap(LineCap cap) { mutableState()->setLineCap(cap); } | 128 void setLineCap(LineCap cap) { mutableState()->setLineCap(cap); } |
| 129 void setLineDash(const DashArray& dashes, float dashOffset) { mutableState()
->setLineDash(dashes, dashOffset); } | 129 void setLineDash(const DashArray& dashes, float dashOffset) { mutableState()
->setLineDash(dashes, dashOffset); } |
| 130 void setLineJoin(LineJoin join) { mutableState()->setLineJoin(join); } | 130 void setLineJoin(LineJoin join) { mutableState()->setLineJoin(join); } |
| 131 void setMiterLimit(float limit) { mutableState()->setMiterLimit(limit); } | 131 void setMiterLimit(float limit) { mutableState()->setMiterLimit(limit); } |
| 132 | 132 |
| 133 WindRule fillRule() const { return immutableState()->fillRule(); } | 133 WindRule fillRule() const { return immutableState()->fillRule(); } |
| 134 void setFillRule(WindRule fillRule) { mutableState()->setFillRule(fillRule);
} | 134 void setFillRule(WindRule fillRule) { mutableState()->setFillRule(fillRule);
} |
| 135 | 135 |
| 136 Color fillColor() const { return immutableState()->fillColor(); } | 136 Color fillColor() const { return immutableState()->fillColor(); } |
| 137 void setFillColor(const Color& color) { mutableState()->setFillColor(color);
} | 137 void setFillColor(const Color& color) { mutableState()->setFillColor(color);
} |
| 138 SkColor effectiveFillColor() const { return immutableState()->effectiveFillC
olor(); } | 138 SkColor effectiveFillColor() const { return immutableState()->effectiveFillC
olor(); } |
| 139 | 139 |
| 140 void setFillPattern(PassRefPtr<Pattern>); | 140 void setFillPattern(PassRefPtr<Pattern>, float additionalAlpha = 1); |
| 141 Pattern* fillPattern() const { return immutableState()->fillPattern(); } | 141 Pattern* fillPattern() const { return immutableState()->fillPattern(); } |
| 142 | 142 |
| 143 void setFillGradient(PassRefPtr<Gradient>); | 143 void setFillGradient(PassRefPtr<Gradient>, float additionalAlpha = 1); |
| 144 Gradient* fillGradient() const { return immutableState()->fillGradient(); } | 144 Gradient* fillGradient() const { return immutableState()->fillGradient(); } |
| 145 | 145 |
| 146 SkDrawLooper* drawLooper() const { return immutableState()->drawLooper(); } | 146 SkDrawLooper* drawLooper() const { return immutableState()->drawLooper(); } |
| 147 | 147 |
| 148 bool getTransformedClipBounds(FloatRect* bounds) const; | 148 bool getTransformedClipBounds(FloatRect* bounds) const; |
| 149 SkMatrix getTotalMatrix() const; | 149 SkMatrix getTotalMatrix() const; |
| 150 | 150 |
| 151 void setShouldAntialias(bool antialias) { mutableState()->setShouldAntialias
(antialias); } | 151 void setShouldAntialias(bool antialias) { mutableState()->setShouldAntialias
(antialias); } |
| 152 bool shouldAntialias() const { return immutableState()->shouldAntialias(); } | 152 bool shouldAntialias() const { return immutableState()->shouldAntialias(); } |
| 153 | 153 |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 return focusRingOutset(offset) + (focusRingWidth(width) + 1) / 2; | 389 return focusRingOutset(offset) + (focusRingWidth(width) + 1) / 2; |
| 390 } | 390 } |
| 391 | 391 |
| 392 // public decl needed for OwnPtr wrapper. | 392 // public decl needed for OwnPtr wrapper. |
| 393 class RecordingState; | 393 class RecordingState; |
| 394 | 394 |
| 395 #if ENABLE(ASSERT) | 395 #if ENABLE(ASSERT) |
| 396 void setInDrawingRecorder(bool); | 396 void setInDrawingRecorder(bool); |
| 397 #endif | 397 #endif |
| 398 | 398 |
| 399 // Multiply a color's alpha channel by an additional alpha factor. This is |
| 400 // similar to Color::combineWithAlpha but uses Skia's rounding approach. |
| 401 static SkColor combineWithAlpha(SkColor color, float alpha) |
| 402 { |
| 403 return GraphicsContextState::combineWithAlpha(color, alpha); |
| 404 } |
| 405 |
| 399 private: | 406 private: |
| 400 const GraphicsContextState* immutableState() const { return m_paintState; } | 407 const GraphicsContextState* immutableState() const { return m_paintState; } |
| 401 | 408 |
| 402 GraphicsContextState* mutableState() | 409 GraphicsContextState* mutableState() |
| 403 { | 410 { |
| 404 realizePaintSave(); | 411 realizePaintSave(); |
| 405 return m_paintState; | 412 return m_paintState; |
| 406 } | 413 } |
| 407 | 414 |
| 408 static void setPathFromPoints(SkPath*, size_t, const FloatPoint*); | 415 static void setPathFromPoints(SkPath*, size_t, const FloatPoint*); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 | 515 |
| 509 unsigned m_accelerated : 1; | 516 unsigned m_accelerated : 1; |
| 510 unsigned m_isCertainlyOpaque : 1; | 517 unsigned m_isCertainlyOpaque : 1; |
| 511 unsigned m_printing : 1; | 518 unsigned m_printing : 1; |
| 512 unsigned m_antialiasHairlineImages : 1; | 519 unsigned m_antialiasHairlineImages : 1; |
| 513 }; | 520 }; |
| 514 | 521 |
| 515 } // namespace blink | 522 } // namespace blink |
| 516 | 523 |
| 517 #endif // GraphicsContext_h | 524 #endif // GraphicsContext_h |
| OLD | NEW |