| OLD | NEW |
| 1 // Copyright (C) 2013 Google Inc. All rights reserved. | 1 // Copyright (C) 2013 Google Inc. All rights reserved. |
| 2 // | 2 // |
| 3 // Redistribution and use in source and binary forms, with or without | 3 // Redistribution and use in source and binary forms, with or without |
| 4 // modification, are permitted provided that the following conditions are | 4 // modification, are permitted provided that the following conditions are |
| 5 // met: | 5 // met: |
| 6 // | 6 // |
| 7 // * Redistributions of source code must retain the above copyright | 7 // * Redistributions of source code must retain the above copyright |
| 8 // notice, this list of conditions and the following disclaimer. | 8 // notice, this list of conditions and the following disclaimer. |
| 9 // * Redistributions in binary form must reproduce the above | 9 // * Redistributions in binary form must reproduce the above |
| 10 // copyright notice, this list of conditions and the following disclaimer | 10 // copyright notice, this list of conditions and the following disclaimer |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 } | 73 } |
| 74 | 74 |
| 75 GraphicsContext* context() const { return &m_context; } | 75 GraphicsContext* context() const { return &m_context; } |
| 76 bool saved() const { return m_saveAndRestore; } | 76 bool saved() const { return m_saveAndRestore; } |
| 77 | 77 |
| 78 private: | 78 private: |
| 79 GraphicsContext& m_context; | 79 GraphicsContext& m_context; |
| 80 bool m_saveAndRestore; | 80 bool m_saveAndRestore; |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 class GraphicsContextCTMSaver { |
| 84 public: |
| 85 GraphicsContextCTMSaver(GraphicsContext& context) |
| 86 : m_canvas(context.contextDisabled() ? nullptr : context.canvas()) |
| 87 { |
| 88 if (m_canvas) |
| 89 m_savedMatrix = m_canvas->getTotalMatrix(); |
| 90 } |
| 91 |
| 92 ~GraphicsContextCTMSaver() |
| 93 { |
| 94 if (m_canvas) |
| 95 m_canvas->setMatrix(m_savedMatrix); |
| 96 } |
| 97 |
| 98 private: |
| 99 SkMatrix m_savedMatrix; |
| 100 SkCanvas* m_canvas; |
| 101 }; |
| 102 |
| 83 } // namespace blink | 103 } // namespace blink |
| 84 | 104 |
| 85 #endif // GraphicsContextStateSaver_h | 105 #endif // GraphicsContextStateSaver_h |
| OLD | NEW |