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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 91 |
92 // ---------- State management methods ----------------- | 92 // ---------- State management methods ----------------- |
93 void save(); | 93 void save(); |
94 void restore(); | 94 void restore(); |
95 | 95 |
96 #if ENABLE(ASSERT) | 96 #if ENABLE(ASSERT) |
97 unsigned saveCount() const; | 97 unsigned saveCount() const; |
98 void disableDestructionChecks() { m_disableDestructionChecks = true; } | 98 void disableDestructionChecks() { m_disableDestructionChecks = true; } |
99 #endif | 99 #endif |
100 | 100 |
101 void saveLayer(const SkRect* bounds, const SkPaint*); | |
102 void restoreLayer(); | |
103 | |
104 bool hasStroke() const { return strokeStyle() != NoStroke && strokeThickness
() > 0; } | 101 bool hasStroke() const { return strokeStyle() != NoStroke && strokeThickness
() > 0; } |
105 | 102 |
106 float strokeThickness() const { return immutableState()->strokeData().thickn
ess(); } | 103 float strokeThickness() const { return immutableState()->strokeData().thickn
ess(); } |
107 void setStrokeThickness(float thickness) { mutableState()->setStrokeThicknes
s(thickness); } | 104 void setStrokeThickness(float thickness) { mutableState()->setStrokeThicknes
s(thickness); } |
108 | 105 |
109 StrokeStyle strokeStyle() const { return immutableState()->strokeData().styl
e(); } | 106 StrokeStyle strokeStyle() const { return immutableState()->strokeData().styl
e(); } |
110 void setStrokeStyle(StrokeStyle style) { mutableState()->setStrokeStyle(styl
e); } | 107 void setStrokeStyle(StrokeStyle style) { mutableState()->setStrokeStyle(styl
e); } |
111 | 108 |
112 Color strokeColor() const { return immutableState()->strokeColor(); } | 109 Color strokeColor() const { return immutableState()->strokeColor(); } |
113 void setStrokeColor(const Color& color) { mutableState()->setStrokeColor(col
or); } | 110 void setStrokeColor(const Color& color) { mutableState()->setStrokeColor(col
or); } |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 void drawBidiText(const Font&, const TextRunPaintInfo&, const FloatPoint&, F
ont::CustomFontNotReadyAction = Font::DoNotPaintIfFontNotReady); | 315 void drawBidiText(const Font&, const TextRunPaintInfo&, const FloatPoint&, F
ont::CustomFontNotReadyAction = Font::DoNotPaintIfFontNotReady); |
319 void drawHighlightForText(const Font&, const TextRun&, const FloatPoint&, in
t h, const Color& backgroundColor, int from = 0, int to = -1); | 316 void drawHighlightForText(const Font&, const TextRun&, const FloatPoint&, in
t h, const Color& backgroundColor, int from = 0, int to = -1); |
320 | 317 |
321 void drawLineForText(const FloatPoint&, float width, bool printing); | 318 void drawLineForText(const FloatPoint&, float width, bool printing); |
322 enum DocumentMarkerLineStyle { | 319 enum DocumentMarkerLineStyle { |
323 DocumentMarkerSpellingLineStyle, | 320 DocumentMarkerSpellingLineStyle, |
324 DocumentMarkerGrammarLineStyle | 321 DocumentMarkerGrammarLineStyle |
325 }; | 322 }; |
326 void drawLineForDocumentMarker(const FloatPoint&, float width, DocumentMarke
rLineStyle); | 323 void drawLineForDocumentMarker(const FloatPoint&, float width, DocumentMarke
rLineStyle); |
327 | 324 |
| 325 // beginLayer()/endLayer() behaves like save()/restore() for only CTM and cl
ip states. |
328 void beginTransparencyLayer(float opacity, const FloatRect* = 0); | 326 void beginTransparencyLayer(float opacity, const FloatRect* = 0); |
| 327 // Apply CompositeOperator when the layer is composited on the backdrop (i.e
. endLayer()). |
| 328 // Don't change the current CompositeOperator state. |
329 void beginLayer(float opacity, CompositeOperator, const FloatRect* = 0, Colo
rFilter = ColorFilterNone, ImageFilter* = 0); | 329 void beginLayer(float opacity, CompositeOperator, const FloatRect* = 0, Colo
rFilter = ColorFilterNone, ImageFilter* = 0); |
330 void endLayer(); | 330 void endLayer(); |
331 | 331 |
332 void beginCull(const FloatRect&); | 332 void beginCull(const FloatRect&); |
333 void endCull(); | 333 void endCull(); |
334 | 334 |
335 // Instead of being dispatched to the active canvas, draw commands following
beginRecording() | 335 // Instead of being dispatched to the active canvas, draw commands following
beginRecording() |
336 // are stored in a display list that can be replayed at a later time. Pass i
n the bounding | 336 // are stored in a display list that can be replayed at a later time. Pass i
n the bounding |
337 // rectangle for the content in the list. | 337 // rectangle for the content in the list. |
338 void beginRecording(const FloatRect&, uint32_t = 0); | 338 void beginRecording(const FloatRect&, uint32_t = 0); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 #else | 429 #else |
430 static inline int focusRingOutset(int offset) { return 0; } | 430 static inline int focusRingOutset(int offset) { return 0; } |
431 static inline int focusRingWidth(int width) { return 1; } | 431 static inline int focusRingWidth(int width) { return 1; } |
432 static SkPMColor lineColors(int); | 432 static SkPMColor lineColors(int); |
433 static SkPMColor antiColors1(int); | 433 static SkPMColor antiColors1(int); |
434 static SkPMColor antiColors2(int); | 434 static SkPMColor antiColors2(int); |
435 static void draw1xMarker(SkBitmap*, int); | 435 static void draw1xMarker(SkBitmap*, int); |
436 static void draw2xMarker(SkBitmap*, int); | 436 static void draw2xMarker(SkBitmap*, int); |
437 #endif | 437 #endif |
438 | 438 |
| 439 void saveLayer(const SkRect* bounds, const SkPaint*); |
| 440 void restoreLayer(); |
| 441 |
439 // Helpers for drawing a focus ring (drawFocusRing) | 442 // Helpers for drawing a focus ring (drawFocusRing) |
440 float prepareFocusRingPaint(SkPaint&, const Color&, int width) const; | 443 float prepareFocusRingPaint(SkPaint&, const Color&, int width) const; |
441 void drawFocusRingPath(const SkPath&, const Color&, int width); | 444 void drawFocusRingPath(const SkPath&, const Color&, int width); |
442 void drawFocusRingRect(const SkRect&, const Color&, int width); | 445 void drawFocusRingRect(const SkRect&, const Color&, int width); |
443 | 446 |
444 // SkCanvas wrappers. | 447 // SkCanvas wrappers. |
445 void clipPath(const SkPath&, AntiAliasingMode = NotAntiAliased, SkRegion::Op
= SkRegion::kIntersect_Op); | 448 void clipPath(const SkPath&, AntiAliasingMode = NotAntiAliased, SkRegion::Op
= SkRegion::kIntersect_Op); |
446 void clipRRect(const SkRRect&, AntiAliasingMode = NotAntiAliased, SkRegion::
Op = SkRegion::kIntersect_Op); | 449 void clipRRect(const SkRRect&, AntiAliasingMode = NotAntiAliased, SkRegion::
Op = SkRegion::kIntersect_Op); |
447 void concat(const SkMatrix&); | 450 void concat(const SkMatrix&); |
448 void drawRRect(const SkRRect&, const SkPaint&); | 451 void drawRRect(const SkRRect&, const SkPaint&); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 bool m_accelerated : 1; | 515 bool m_accelerated : 1; |
513 bool m_isCertainlyOpaque : 1; | 516 bool m_isCertainlyOpaque : 1; |
514 bool m_printing : 1; | 517 bool m_printing : 1; |
515 bool m_antialiasHairlineImages : 1; | 518 bool m_antialiasHairlineImages : 1; |
516 bool m_shouldSmoothFonts : 1; | 519 bool m_shouldSmoothFonts : 1; |
517 }; | 520 }; |
518 | 521 |
519 } // namespace blink | 522 } // namespace blink |
520 | 523 |
521 #endif // GraphicsContext_h | 524 #endif // GraphicsContext_h |
OLD | NEW |