OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Apple Computer, Inc. | 2 * Copyright (C) 2006 Apple Computer, Inc. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 * Library General Public License for more details. | 12 * Library General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU Library General Public License | 14 * You should have received a copy of the GNU Library General Public License |
15 * along with this library; see the file COPYING.LIB. If not, write to | 15 * along with this library; see the file COPYING.LIB. If not, write to |
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
17 * Boston, MA 02110-1301, USA. | 17 * Boston, MA 02110-1301, USA. |
18 */ | 18 */ |
19 | 19 |
20 #include "core/platform/graphics/GraphicsContext.h" | 20 #include "platform/graphics/GraphicsContext.h" |
21 #include "wtf/Noncopyable.h" | 21 #include "wtf/Noncopyable.h" |
22 | 22 |
23 #include "skia/ext/skia_utils_mac.h" | 23 #include "skia/ext/skia_utils_mac.h" |
24 | 24 |
25 OBJC_CLASS NSGraphicsContext; | 25 OBJC_CLASS NSGraphicsContext; |
26 | 26 |
27 namespace WebCore { | 27 namespace WebCore { |
28 | 28 |
29 // This class automatically saves and restores the current NSGraphicsContext for | 29 // This class automatically saves and restores the current NSGraphicsContext for |
30 // functions which call out into AppKit and rely on the currentContext being set | 30 // functions which call out into AppKit and rely on the currentContext being set |
31 class LocalCurrentGraphicsContext { | 31 class PLATFORM_EXPORT LocalCurrentGraphicsContext { |
32 WTF_MAKE_NONCOPYABLE(LocalCurrentGraphicsContext); | 32 WTF_MAKE_NONCOPYABLE(LocalCurrentGraphicsContext); |
33 public: | 33 public: |
34 LocalCurrentGraphicsContext(GraphicsContext* graphicsContext); | 34 LocalCurrentGraphicsContext(GraphicsContext* graphicsContext); |
35 ~LocalCurrentGraphicsContext(); | 35 ~LocalCurrentGraphicsContext(); |
36 CGContextRef cgContext(); | 36 CGContextRef cgContext(); |
37 private: | 37 private: |
38 GraphicsContext* m_savedGraphicsContext; | 38 GraphicsContext* m_savedGraphicsContext; |
39 NSGraphicsContext* m_savedNSGraphicsContext; | 39 NSGraphicsContext* m_savedNSGraphicsContext; |
40 bool m_didSetGraphicsContext; | 40 bool m_didSetGraphicsContext; |
41 gfx::SkiaBitLocker m_skiaBitLocker; | 41 gfx::SkiaBitLocker m_skiaBitLocker; |
42 }; | 42 }; |
43 | 43 |
44 class ContextContainer { | 44 class PLATFORM_EXPORT ContextContainer { |
45 WTF_MAKE_NONCOPYABLE(ContextContainer); | 45 WTF_MAKE_NONCOPYABLE(ContextContainer); |
46 public: | 46 public: |
47 ContextContainer(GraphicsContext*); | 47 ContextContainer(GraphicsContext*); |
48 | 48 |
49 // This synchronizes the CGContext to reflect the current SkCanvas state. | 49 // This synchronizes the CGContext to reflect the current SkCanvas state. |
50 // The implementation may not return the same CGContext each time. | 50 // The implementation may not return the same CGContext each time. |
51 CGContextRef context() { return m_skiaBitLocker.cgContext(); } | 51 CGContextRef context() { return m_skiaBitLocker.cgContext(); } |
52 | 52 |
53 private: | 53 private: |
54 gfx::SkiaBitLocker m_skiaBitLocker; | 54 gfx::SkiaBitLocker m_skiaBitLocker; |
55 }; | 55 }; |
56 | 56 |
57 } | 57 } |
OLD | NEW |