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

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

Issue 99103006: Moving GraphicsContext and dependencies from core to platform. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Final patch - fixes Android Created 7 years 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
(Empty)
1 /*
2 * Copyright (C) 2006 Apple Computer, Inc.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
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
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20 #include "core/platform/graphics/GraphicsContext.h"
21 #include "wtf/Noncopyable.h"
22
23 #include "skia/ext/skia_utils_mac.h"
24
25 OBJC_CLASS NSGraphicsContext;
26
27 namespace WebCore {
28
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
31 class LocalCurrentGraphicsContext {
32 WTF_MAKE_NONCOPYABLE(LocalCurrentGraphicsContext);
33 public:
34 LocalCurrentGraphicsContext(GraphicsContext* graphicsContext);
35 ~LocalCurrentGraphicsContext();
36 CGContextRef cgContext();
37 private:
38 GraphicsContext* m_savedGraphicsContext;
39 NSGraphicsContext* m_savedNSGraphicsContext;
40 bool m_didSetGraphicsContext;
41 gfx::SkiaBitLocker m_skiaBitLocker;
42 };
43
44 class ContextContainer {
45 WTF_MAKE_NONCOPYABLE(ContextContainer);
46 public:
47 ContextContainer(GraphicsContext*);
48
49 // This synchronizes the CGContext to reflect the current SkCanvas state.
50 // The implementation may not return the same CGContext each time.
51 CGContextRef context() { return m_skiaBitLocker.cgContext(); }
52
53 private:
54 gfx::SkiaBitLocker m_skiaBitLocker;
55 };
56
57 }
OLDNEW
« no previous file with comments | « Source/core/platform/mac/EmptyProtocolDefinitions.h ('k') | Source/core/platform/mac/LocalCurrentGraphicsContext.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698