| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 WTF_MAKE_NONCOPYABLE(GraphicsContext); | 63 WTF_MAKE_NONCOPYABLE(GraphicsContext); |
| 64 USING_FAST_MALLOC(GraphicsContext); | 64 USING_FAST_MALLOC(GraphicsContext); |
| 65 | 65 |
| 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 | 69 FullyDisabled = 1 // Do absolutely minimal work to remove the cost of |
| 70 // the context from performance tests. | 70 // the context from performance tests. |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 explicit GraphicsContext( | 73 explicit GraphicsContext(PaintController&, |
| 74 PaintController&, | 74 DisabledMode = NothingDisabled, |
| 75 DisabledMode = NothingDisabled, | 75 SkMetaData* = 0); |
| 76 SkMetaData* = 0, | |
| 77 ColorBehavior = ColorBehavior::transformToGlobalTarget()); | |
| 78 | 76 |
| 79 ~GraphicsContext(); | 77 ~GraphicsContext(); |
| 80 | 78 |
| 81 PaintCanvas* canvas() { return m_canvas; } | 79 PaintCanvas* canvas() { return m_canvas; } |
| 82 const PaintCanvas* canvas() const { return m_canvas; } | 80 const PaintCanvas* canvas() const { return m_canvas; } |
| 83 | 81 |
| 84 PaintController& getPaintController() { return m_paintController; } | 82 PaintController& getPaintController() { return m_paintController; } |
| 85 const ColorBehavior& getColorBehavior() const { return m_colorBehavior; } | |
| 86 | 83 |
| 87 bool contextDisabled() const { return m_disabledState; } | 84 bool contextDisabled() const { return m_disabledState; } |
| 88 | 85 |
| 89 // ---------- State management methods ----------------- | 86 // ---------- State management methods ----------------- |
| 90 void save(); | 87 void save(); |
| 91 void restore(); | 88 void restore(); |
| 92 | 89 |
| 93 #if DCHECK_IS_ON() | 90 #if DCHECK_IS_ON() |
| 94 unsigned saveCount() const; | 91 unsigned saveCount() const; |
| 95 #endif | 92 #endif |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 // Current index on the stack. May not be the last thing on the stack. | 426 // Current index on the stack. May not be the last thing on the stack. |
| 430 unsigned m_paintStateIndex; | 427 unsigned m_paintStateIndex; |
| 431 | 428 |
| 432 // Raw pointer to the current state. | 429 // Raw pointer to the current state. |
| 433 GraphicsContextState* m_paintState; | 430 GraphicsContextState* m_paintState; |
| 434 | 431 |
| 435 PaintRecorder m_paintRecorder; | 432 PaintRecorder m_paintRecorder; |
| 436 | 433 |
| 437 SkMetaData m_metaData; | 434 SkMetaData m_metaData; |
| 438 | 435 |
| 439 const ColorBehavior m_colorBehavior; | |
| 440 | |
| 441 #if DCHECK_IS_ON() | 436 #if DCHECK_IS_ON() |
| 442 int m_layerCount; | 437 int m_layerCount; |
| 443 bool m_disableDestructionChecks; | 438 bool m_disableDestructionChecks; |
| 444 bool m_inDrawingRecorder; | 439 bool m_inDrawingRecorder; |
| 445 #endif | 440 #endif |
| 446 | 441 |
| 447 const DisabledMode m_disabledState; | 442 const DisabledMode m_disabledState; |
| 448 | 443 |
| 449 float m_deviceScaleFactor; | 444 float m_deviceScaleFactor; |
| 450 | 445 |
| 451 unsigned m_printing : 1; | 446 unsigned m_printing : 1; |
| 452 unsigned m_hasMetaData : 1; | 447 unsigned m_hasMetaData : 1; |
| 453 }; | 448 }; |
| 454 | 449 |
| 455 } // namespace blink | 450 } // namespace blink |
| 456 | 451 |
| 457 #endif // GraphicsContext_h | 452 #endif // GraphicsContext_h |
| OLD | NEW |