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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 class SkPaint; | 50 class SkPaint; |
51 class SkPath; | 51 class SkPath; |
52 class SkPicture; | 52 class SkPicture; |
53 class SkRRect; | 53 class SkRRect; |
54 class SkTextBlob; | 54 class SkTextBlob; |
55 struct SkImageInfo; | 55 struct SkImageInfo; |
56 struct SkRect; | 56 struct SkRect; |
57 | 57 |
58 namespace blink { | 58 namespace blink { |
59 | 59 |
60 class DisplayItemList; | |
61 class ImageBuffer; | 60 class ImageBuffer; |
62 class KURL; | 61 class KURL; |
| 62 class PaintController; |
63 | 63 |
64 class PLATFORM_EXPORT GraphicsContext { | 64 class PLATFORM_EXPORT GraphicsContext { |
65 WTF_MAKE_NONCOPYABLE(GraphicsContext); WTF_MAKE_FAST_ALLOCATED(GraphicsConte
xt); | 65 WTF_MAKE_NONCOPYABLE(GraphicsContext); WTF_MAKE_FAST_ALLOCATED(GraphicsConte
xt); |
66 public: | 66 public: |
67 enum DisabledMode { | 67 enum DisabledMode { |
68 NothingDisabled = 0, // Run as normal. | 68 NothingDisabled = 0, // Run as normal. |
69 FullyDisabled = 1 // Do absolutely minimal work to remove the cost of th
e context from performance tests. | 69 FullyDisabled = 1 // Do absolutely minimal work to remove the cost of th
e context from performance tests. |
70 }; | 70 }; |
71 | 71 |
72 explicit GraphicsContext(DisplayItemList*, DisabledMode = NothingDisabled, S
kMetaData* = 0); | 72 explicit GraphicsContext(PaintController*, DisabledMode = NothingDisabled, S
kMetaData* = 0); |
73 | 73 |
74 ~GraphicsContext(); | 74 ~GraphicsContext(); |
75 | 75 |
76 SkCanvas* canvas() { return m_canvas; } | 76 SkCanvas* canvas() { return m_canvas; } |
77 const SkCanvas* canvas() const { return m_canvas; } | 77 const SkCanvas* canvas() const { return m_canvas; } |
78 | 78 |
79 DisplayItemList* displayItemList() { return m_displayItemList; } | 79 PaintController* paintController() { return m_paintController; } |
80 | 80 |
81 bool contextDisabled() const { return m_disabledState; } | 81 bool contextDisabled() const { return m_disabledState; } |
82 | 82 |
83 // ---------- State management methods ----------------- | 83 // ---------- State management methods ----------------- |
84 void save(); | 84 void save(); |
85 void restore(); | 85 void restore(); |
86 | 86 |
87 #if ENABLE(ASSERT) | 87 #if ENABLE(ASSERT) |
88 unsigned saveCount() const; | 88 unsigned saveCount() const; |
89 #endif | 89 #endif |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 | 336 |
337 const SkMetaData& metaData() const { return m_metaData; } | 337 const SkMetaData& metaData() const { return m_metaData; } |
338 | 338 |
339 // null indicates painting is contextDisabled. Never delete this object. | 339 // null indicates painting is contextDisabled. Never delete this object. |
340 SkCanvas* m_canvas; | 340 SkCanvas* m_canvas; |
341 | 341 |
342 // This stores the canvas object used to construct the GraphicsContext, if a
ny. It is only | 342 // This stores the canvas object used to construct the GraphicsContext, if a
ny. It is only |
343 // used when Slimming Paint is active. | 343 // used when Slimming Paint is active. |
344 SkCanvas* m_originalCanvas; | 344 SkCanvas* m_originalCanvas; |
345 | 345 |
346 // This being null indicates not to paint into a DisplayItemList, and instea
d directly into the canvas. | 346 // This being null indicates not to paint using the PaintController, and ins
tead directly into the canvas. |
347 DisplayItemList* m_displayItemList; | 347 PaintController* m_paintController; |
348 | 348 |
349 // Paint states stack. Enables local drawing state change with save()/restor
e() calls. | 349 // Paint states stack. Enables local drawing state change with save()/restor
e() calls. |
350 // This state controls the appearance of drawn content. | 350 // This state controls the appearance of drawn content. |
351 // We do not delete from this stack to avoid memory churn. | 351 // We do not delete from this stack to avoid memory churn. |
352 Vector<OwnPtr<GraphicsContextState>> m_paintStateStack; | 352 Vector<OwnPtr<GraphicsContextState>> m_paintStateStack; |
353 // Current index on the stack. May not be the last thing on the stack. | 353 // Current index on the stack. May not be the last thing on the stack. |
354 unsigned m_paintStateIndex; | 354 unsigned m_paintStateIndex; |
355 // Raw pointer to the current state. | 355 // Raw pointer to the current state. |
356 GraphicsContextState* m_paintState; | 356 GraphicsContextState* m_paintState; |
357 | 357 |
(...skipping 11 matching lines...) Expand all Loading... |
369 | 369 |
370 float m_deviceScaleFactor; | 370 float m_deviceScaleFactor; |
371 | 371 |
372 unsigned m_printing : 1; | 372 unsigned m_printing : 1; |
373 unsigned m_hasMetaData : 1; | 373 unsigned m_hasMetaData : 1; |
374 }; | 374 }; |
375 | 375 |
376 } // namespace blink | 376 } // namespace blink |
377 | 377 |
378 #endif // GraphicsContext_h | 378 #endif // GraphicsContext_h |
OLD | NEW |