| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 class SkRRect; | 54 class SkRRect; |
| 55 class SkTextBlob; | 55 class SkTextBlob; |
| 56 struct SkRect; | 56 struct SkRect; |
| 57 | 57 |
| 58 namespace blink { | 58 namespace blink { |
| 59 | 59 |
| 60 class ClipRecorderStack; | 60 class ClipRecorderStack; |
| 61 class DisplayItemList; | 61 class DisplayItemList; |
| 62 class ImageBuffer; | 62 class ImageBuffer; |
| 63 class KURL; | 63 class KURL; |
| 64 class GraphicsContextClient; | |
| 65 | 64 |
| 66 class PLATFORM_EXPORT GraphicsContext { | 65 class PLATFORM_EXPORT GraphicsContext { |
| 67 WTF_MAKE_NONCOPYABLE(GraphicsContext); WTF_MAKE_FAST_ALLOCATED; | 66 WTF_MAKE_NONCOPYABLE(GraphicsContext); WTF_MAKE_FAST_ALLOCATED; |
| 68 public: | 67 public: |
| 69 enum AccessMode { | 68 enum AccessMode { |
| 70 ReadOnly, | 69 ReadOnly, |
| 71 ReadWrite | 70 ReadWrite |
| 72 }; | 71 }; |
| 73 | 72 |
| 74 enum DisabledMode { | 73 enum DisabledMode { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 99 void save(); | 98 void save(); |
| 100 void restore(); | 99 void restore(); |
| 101 | 100 |
| 102 #if ENABLE(ASSERT) | 101 #if ENABLE(ASSERT) |
| 103 unsigned saveCount() const; | 102 unsigned saveCount() const; |
| 104 void disableDestructionChecks() { m_disableDestructionChecks = true; } | 103 void disableDestructionChecks() { m_disableDestructionChecks = true; } |
| 105 #endif | 104 #endif |
| 106 | 105 |
| 107 bool hasStroke() const { return strokeStyle() != NoStroke && strokeThickness
() > 0; } | 106 bool hasStroke() const { return strokeStyle() != NoStroke && strokeThickness
() > 0; } |
| 108 | 107 |
| 109 // Returns true if the clip is anything more than an intersection of rectang
les | |
| 110 bool hasComplexClip() const { return immutableState()->hasComplexClip(); } | |
| 111 void setHasComplexClip() { mutableState()->setHasComplexClip(); } | |
| 112 | |
| 113 float strokeThickness() const { return immutableState()->strokeData().thickn
ess(); } | 108 float strokeThickness() const { return immutableState()->strokeData().thickn
ess(); } |
| 114 void setStrokeThickness(float thickness) { mutableState()->setStrokeThicknes
s(thickness); } | 109 void setStrokeThickness(float thickness) { mutableState()->setStrokeThicknes
s(thickness); } |
| 115 | 110 |
| 116 StrokeStyle strokeStyle() const { return immutableState()->strokeData().styl
e(); } | 111 StrokeStyle strokeStyle() const { return immutableState()->strokeData().styl
e(); } |
| 117 void setStrokeStyle(StrokeStyle style) { mutableState()->setStrokeStyle(styl
e); } | 112 void setStrokeStyle(StrokeStyle style) { mutableState()->setStrokeStyle(styl
e); } |
| 118 | 113 |
| 119 Color strokeColor() const { return immutableState()->strokeColor(); } | 114 Color strokeColor() const { return immutableState()->strokeColor(); } |
| 120 void setStrokeColor(const Color& color) { mutableState()->setStrokeColor(col
or); } | 115 void setStrokeColor(const Color& color) { mutableState()->setStrokeColor(col
or); } |
| 121 SkColor effectiveStrokeColor() const { return immutableState()->effectiveStr
okeColor(); } | 116 SkColor effectiveStrokeColor() const { return immutableState()->effectiveStr
okeColor(); } |
| 122 | 117 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 | 192 |
| 198 // Returns if the context is a printing context instead of a display | 193 // Returns if the context is a printing context instead of a display |
| 199 // context. Bitmap shouldn't be resampled when printing to keep the best | 194 // context. Bitmap shouldn't be resampled when printing to keep the best |
| 200 // possible quality. | 195 // possible quality. |
| 201 bool printing() const { return m_printing; } | 196 bool printing() const { return m_printing; } |
| 202 void setPrinting(bool printing) { m_printing = printing; } | 197 void setPrinting(bool printing) { m_printing = printing; } |
| 203 | 198 |
| 204 bool isAccelerated() const { return m_accelerated; } | 199 bool isAccelerated() const { return m_accelerated; } |
| 205 void setAccelerated(bool accelerated) { m_accelerated = accelerated; } | 200 void setAccelerated(bool accelerated) { m_accelerated = accelerated; } |
| 206 | 201 |
| 207 void setClient(GraphicsContextClient*); | |
| 208 | |
| 209 // The text region is empty until tracking is turned on. | 202 // The text region is empty until tracking is turned on. |
| 210 // It is never clerared by the context. | 203 // It is never clerared by the context. |
| 211 void setTrackTextRegion(bool track) { m_trackTextRegion = track; } | 204 void setTrackTextRegion(bool track) { m_trackTextRegion = track; } |
| 212 const SkRect& textRegion() const { return m_textRegion; } | 205 const SkRect& textRegion() const { return m_textRegion; } |
| 213 | 206 |
| 214 AnnotationModeFlags annotationMode() const { return m_annotationMode; } | 207 AnnotationModeFlags annotationMode() const { return m_annotationMode; } |
| 215 void setAnnotationMode(const AnnotationModeFlags mode) { m_annotationMode =
mode; } | 208 void setAnnotationMode(const AnnotationModeFlags mode) { m_annotationMode =
mode; } |
| 216 | 209 |
| 217 SkColorFilter* colorFilter() const; | 210 SkColorFilter* colorFilter() const; |
| 218 void setColorFilter(ColorFilter); | 211 void setColorFilter(ColorFilter); |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 | 456 |
| 464 void didDrawTextInRect(const SkRect& textRect); | 457 void didDrawTextInRect(const SkRect& textRect); |
| 465 | 458 |
| 466 void fillRectWithRoundedHole(const FloatRect&, const FloatRoundedRect& round
edHoleRect, const Color&); | 459 void fillRectWithRoundedHole(const FloatRect&, const FloatRoundedRect& round
edHoleRect, const Color&); |
| 467 | 460 |
| 468 bool isRecording() const; | 461 bool isRecording() const; |
| 469 | 462 |
| 470 // null indicates painting is contextDisabled. Never delete this object. | 463 // null indicates painting is contextDisabled. Never delete this object. |
| 471 SkCanvas* m_canvas; | 464 SkCanvas* m_canvas; |
| 472 | 465 |
| 473 GraphicsContextClient* m_client; | |
| 474 | |
| 475 // This being null indicates not to paint into a DisplayItemList, and instea
d directly into the canvas. | 466 // This being null indicates not to paint into a DisplayItemList, and instea
d directly into the canvas. |
| 476 DisplayItemList* m_displayItemList; | 467 DisplayItemList* m_displayItemList; |
| 477 | 468 |
| 478 ClipRecorderStack* m_clipRecorderStack; | 469 ClipRecorderStack* m_clipRecorderStack; |
| 479 | 470 |
| 480 // Paint states stack. Enables local drawing state change with save()/restor
e() calls. | 471 // Paint states stack. Enables local drawing state change with save()/restor
e() calls. |
| 481 // This state controls the appearance of drawn content. | 472 // This state controls the appearance of drawn content. |
| 482 // We do not delete from this stack to avoid memory churn. | 473 // We do not delete from this stack to avoid memory churn. |
| 483 Vector<OwnPtr<GraphicsContextState>> m_paintStateStack; | 474 Vector<OwnPtr<GraphicsContextState>> m_paintStateStack; |
| 484 // Current index on the stack. May not be the last thing on the stack. | 475 // Current index on the stack. May not be the last thing on the stack. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 509 | 500 |
| 510 unsigned m_accelerated : 1; | 501 unsigned m_accelerated : 1; |
| 511 unsigned m_isCertainlyOpaque : 1; | 502 unsigned m_isCertainlyOpaque : 1; |
| 512 unsigned m_printing : 1; | 503 unsigned m_printing : 1; |
| 513 unsigned m_antialiasHairlineImages : 1; | 504 unsigned m_antialiasHairlineImages : 1; |
| 514 }; | 505 }; |
| 515 | 506 |
| 516 } // namespace blink | 507 } // namespace blink |
| 517 | 508 |
| 518 #endif // GraphicsContext_h | 509 #endif // GraphicsContext_h |
| OLD | NEW |