Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: Source/platform/mac/LocalCurrentGraphicsContext.h

Issue 319183004: Prefer to forward-declare GraphicsContext in headers. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: schenney nit (pare down platform/geometry/ includes to *Rect.h) Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "platform/graphics/GraphicsContext.h" 20 #include "platform/PlatformExport.h"
21 #include "skia/ext/skia_utils_mac.h"
21 #include "wtf/Noncopyable.h" 22 #include "wtf/Noncopyable.h"
22 23
23 #include "skia/ext/skia_utils_mac.h"
24
25 OBJC_CLASS NSGraphicsContext; 24 OBJC_CLASS NSGraphicsContext;
26 25
27 namespace WebCore { 26 namespace WebCore {
28 27
28 class GraphicsContext;
29
29 // This class automatically saves and restores the current NSGraphicsContext for 30 // This class automatically saves and restores the current NSGraphicsContext for
30 // functions which call out into AppKit and rely on the currentContext being set 31 // functions which call out into AppKit and rely on the currentContext being set
31 class PLATFORM_EXPORT LocalCurrentGraphicsContext { 32 class PLATFORM_EXPORT LocalCurrentGraphicsContext {
32 WTF_MAKE_NONCOPYABLE(LocalCurrentGraphicsContext); 33 WTF_MAKE_NONCOPYABLE(LocalCurrentGraphicsContext);
33 public: 34 public:
34 LocalCurrentGraphicsContext(GraphicsContext* graphicsContext); 35 LocalCurrentGraphicsContext(GraphicsContext* graphicsContext);
35 ~LocalCurrentGraphicsContext(); 36 ~LocalCurrentGraphicsContext();
36 CGContextRef cgContext(); 37 CGContextRef cgContext();
37 private: 38 private:
38 GraphicsContext* m_savedGraphicsContext; 39 GraphicsContext* m_savedGraphicsContext;
39 NSGraphicsContext* m_savedNSGraphicsContext; 40 NSGraphicsContext* m_savedNSGraphicsContext;
40 bool m_didSetGraphicsContext; 41 bool m_didSetGraphicsContext;
41 gfx::SkiaBitLocker m_skiaBitLocker; 42 gfx::SkiaBitLocker m_skiaBitLocker;
42 }; 43 };
43 44
44 class PLATFORM_EXPORT ContextContainer { 45 class PLATFORM_EXPORT ContextContainer {
45 WTF_MAKE_NONCOPYABLE(ContextContainer); 46 WTF_MAKE_NONCOPYABLE(ContextContainer);
46 public: 47 public:
47 ContextContainer(GraphicsContext*); 48 ContextContainer(GraphicsContext*);
48 49
49 // This synchronizes the CGContext to reflect the current SkCanvas state. 50 // This synchronizes the CGContext to reflect the current SkCanvas state.
50 // The implementation may not return the same CGContext each time. 51 // The implementation may not return the same CGContext each time.
51 CGContextRef context() { return m_skiaBitLocker.cgContext(); } 52 CGContextRef context() { return m_skiaBitLocker.cgContext(); }
52 53
53 private: 54 private:
54 gfx::SkiaBitLocker m_skiaBitLocker; 55 gfx::SkiaBitLocker m_skiaBitLocker;
55 }; 56 };
56 57
57 } 58 }
OLDNEW
« no previous file with comments | « Source/platform/graphics/filters/SkiaImageFilterBuilder.cpp ('k') | Source/platform/mac/ScrollAnimatorMac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698