| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 bool contextDisabled() const { return m_disabledState; } | 102 bool contextDisabled() const { return m_disabledState; } |
| 103 | 103 |
| 104 // ---------- State management methods ----------------- | 104 // ---------- State management methods ----------------- |
| 105 void save(); | 105 void save(); |
| 106 void restore(); | 106 void restore(); |
| 107 unsigned saveCount() { return m_canvasStateStack.size(); } | 107 unsigned saveCount() { return m_canvasStateStack.size(); } |
| 108 #if ENABLE(ASSERT) | 108 #if ENABLE(ASSERT) |
| 109 void disableDestructionChecks() { m_disableDestructionChecks = true; } | 109 void disableDestructionChecks() { m_disableDestructionChecks = true; } |
| 110 #endif | 110 #endif |
| 111 | 111 |
| 112 void saveLayer(const SkRect* bounds, const SkPaint*); | |
| 113 void restoreLayer(); | |
| 114 | |
| 115 bool hasStroke() const { return strokeStyle() != NoStroke && strokeThickness
() > 0; } | 112 bool hasStroke() const { return strokeStyle() != NoStroke && strokeThickness
() > 0; } |
| 116 | 113 |
| 117 float strokeThickness() const { return immutableState()->strokeData().thickn
ess(); } | 114 float strokeThickness() const { return immutableState()->strokeData().thickn
ess(); } |
| 118 void setStrokeThickness(float thickness) { mutableState()->setStrokeThicknes
s(thickness); } | 115 void setStrokeThickness(float thickness) { mutableState()->setStrokeThicknes
s(thickness); } |
| 119 | 116 |
| 120 StrokeStyle strokeStyle() const { return immutableState()->strokeData().styl
e(); } | 117 StrokeStyle strokeStyle() const { return immutableState()->strokeData().styl
e(); } |
| 121 void setStrokeStyle(StrokeStyle style) { mutableState()->setStrokeStyle(styl
e); } | 118 void setStrokeStyle(StrokeStyle style) { mutableState()->setStrokeStyle(styl
e); } |
| 122 | 119 |
| 123 Color strokeColor() const { return immutableState()->strokeColor(); } | 120 Color strokeColor() const { return immutableState()->strokeColor(); } |
| 124 void setStrokeColor(const Color& color) { mutableState()->setStrokeColor(col
or); } | 121 void setStrokeColor(const Color& color) { mutableState()->setStrokeColor(col
or); } |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 void drawBidiText(const Font&, const TextRunPaintInfo&, const FloatPoint&, F
ont::CustomFontNotReadyAction = Font::DoNotPaintIfFontNotReady); | 326 void drawBidiText(const Font&, const TextRunPaintInfo&, const FloatPoint&, F
ont::CustomFontNotReadyAction = Font::DoNotPaintIfFontNotReady); |
| 330 void drawHighlightForText(const Font&, const TextRun&, const FloatPoint&, in
t h, const Color& backgroundColor, int from = 0, int to = -1); | 327 void drawHighlightForText(const Font&, const TextRun&, const FloatPoint&, in
t h, const Color& backgroundColor, int from = 0, int to = -1); |
| 331 | 328 |
| 332 void drawLineForText(const FloatPoint&, float width, bool printing); | 329 void drawLineForText(const FloatPoint&, float width, bool printing); |
| 333 enum DocumentMarkerLineStyle { | 330 enum DocumentMarkerLineStyle { |
| 334 DocumentMarkerSpellingLineStyle, | 331 DocumentMarkerSpellingLineStyle, |
| 335 DocumentMarkerGrammarLineStyle | 332 DocumentMarkerGrammarLineStyle |
| 336 }; | 333 }; |
| 337 void drawLineForDocumentMarker(const FloatPoint&, float width, DocumentMarke
rLineStyle); | 334 void drawLineForDocumentMarker(const FloatPoint&, float width, DocumentMarke
rLineStyle); |
| 338 | 335 |
| 336 // This behaves the same as save(), but in addition it allocates an offscree
n buffer. |
| 339 void beginTransparencyLayer(float opacity, const FloatRect* = 0); | 337 void beginTransparencyLayer(float opacity, const FloatRect* = 0); |
| 338 // Apply CompositeOperator when the layer is composited on the backdrop (i.e
. endLayer()). |
| 339 // Don't change the current CompositeOperator state. |
| 340 void beginLayer(float opacity, CompositeOperator, const FloatRect* = 0, Colo
rFilter = ColorFilterNone, ImageFilter* = 0); | 340 void beginLayer(float opacity, CompositeOperator, const FloatRect* = 0, Colo
rFilter = ColorFilterNone, ImageFilter* = 0); |
| 341 void endLayer(); | 341 void endLayer(); |
| 342 | 342 |
| 343 void beginCull(const FloatRect&); | 343 void beginCull(const FloatRect&); |
| 344 void endCull(); | 344 void endCull(); |
| 345 | 345 |
| 346 // Instead of being dispatched to the active canvas, draw commands following
beginRecording() | 346 // Instead of being dispatched to the active canvas, draw commands following
beginRecording() |
| 347 // are stored in a display list that can be replayed at a later time. Pass i
n the bounding | 347 // are stored in a display list that can be replayed at a later time. Pass i
n the bounding |
| 348 // rectangle for the content in the list. | 348 // rectangle for the content in the list. |
| 349 void beginRecording(const FloatRect&, uint32_t = 0); | 349 void beginRecording(const FloatRect&, uint32_t = 0); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 #else | 440 #else |
| 441 static inline int focusRingOutset(int offset) { return 0; } | 441 static inline int focusRingOutset(int offset) { return 0; } |
| 442 static inline int focusRingWidth(int width) { return 1; } | 442 static inline int focusRingWidth(int width) { return 1; } |
| 443 static SkPMColor lineColors(int); | 443 static SkPMColor lineColors(int); |
| 444 static SkPMColor antiColors1(int); | 444 static SkPMColor antiColors1(int); |
| 445 static SkPMColor antiColors2(int); | 445 static SkPMColor antiColors2(int); |
| 446 static void draw1xMarker(SkBitmap*, int); | 446 static void draw1xMarker(SkBitmap*, int); |
| 447 static void draw2xMarker(SkBitmap*, int); | 447 static void draw2xMarker(SkBitmap*, int); |
| 448 #endif | 448 #endif |
| 449 | 449 |
| 450 void saveLayer(const SkRect* bounds, const SkPaint*); |
| 451 void restoreLayer(); |
| 452 |
| 450 // Helpers for drawing a focus ring (drawFocusRing) | 453 // Helpers for drawing a focus ring (drawFocusRing) |
| 451 float prepareFocusRingPaint(SkPaint&, const Color&, int width) const; | 454 float prepareFocusRingPaint(SkPaint&, const Color&, int width) const; |
| 452 void drawFocusRingPath(const SkPath&, const Color&, int width); | 455 void drawFocusRingPath(const SkPath&, const Color&, int width); |
| 453 void drawFocusRingRect(const SkRect&, const Color&, int width); | 456 void drawFocusRingRect(const SkRect&, const Color&, int width); |
| 454 | 457 |
| 455 // SkCanvas wrappers. | 458 // SkCanvas wrappers. |
| 456 void clipPath(const SkPath&, AntiAliasingMode = NotAntiAliased, SkRegion::Op
= SkRegion::kIntersect_Op); | 459 void clipPath(const SkPath&, AntiAliasingMode = NotAntiAliased, SkRegion::Op
= SkRegion::kIntersect_Op); |
| 457 void clipRRect(const SkRRect&, AntiAliasingMode = NotAntiAliased, SkRegion::
Op = SkRegion::kIntersect_Op); | 460 void clipRRect(const SkRRect&, AntiAliasingMode = NotAntiAliased, SkRegion::
Op = SkRegion::kIntersect_Op); |
| 458 void concat(const SkMatrix&); | 461 void concat(const SkMatrix&); |
| 459 void drawRRect(const SkRRect&, const SkPaint&); | 462 void drawRRect(const SkRRect&, const SkPaint&); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 bool m_accelerated : 1; | 544 bool m_accelerated : 1; |
| 542 bool m_isCertainlyOpaque : 1; | 545 bool m_isCertainlyOpaque : 1; |
| 543 bool m_printing : 1; | 546 bool m_printing : 1; |
| 544 bool m_antialiasHairlineImages : 1; | 547 bool m_antialiasHairlineImages : 1; |
| 545 bool m_shouldSmoothFonts : 1; | 548 bool m_shouldSmoothFonts : 1; |
| 546 }; | 549 }; |
| 547 | 550 |
| 548 } // namespace blink | 551 } // namespace blink |
| 549 | 552 |
| 550 #endif // GraphicsContext_h | 553 #endif // GraphicsContext_h |
| OLD | NEW |