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 "platform/PlatformExport.h" | 20 #include "platform/PlatformExport.h" |
21 #include "platform/geometry/IntRect.h" | 21 #include "platform/geometry/IntRect.h" |
22 #include "platform/graphics/paint/PaintCanvas.h" | 22 #include "platform/graphics/paint/PaintCanvas.h" |
23 #include "platform/mac/GraphicsContextCanvas.h" | 23 #include "platform/mac/GraphicsContextCanvas.h" |
24 #include "wtf/Noncopyable.h" | 24 #include "platform/wtf/Noncopyable.h" |
25 | 25 |
26 OBJC_CLASS NSGraphicsContext; | 26 OBJC_CLASS NSGraphicsContext; |
27 | 27 |
28 namespace blink { | 28 namespace blink { |
29 | 29 |
30 class GraphicsContext; | 30 class GraphicsContext; |
31 | 31 |
32 // This class automatically saves and restores the current NSGraphicsContext for | 32 // This class automatically saves and restores the current NSGraphicsContext for |
33 // functions which call out into AppKit and rely on the currentContext being set | 33 // functions which call out into AppKit and rely on the currentContext being set |
34 class PLATFORM_EXPORT LocalCurrentGraphicsContext { | 34 class PLATFORM_EXPORT LocalCurrentGraphicsContext { |
35 WTF_MAKE_NONCOPYABLE(LocalCurrentGraphicsContext); | 35 WTF_MAKE_NONCOPYABLE(LocalCurrentGraphicsContext); |
36 | 36 |
37 public: | 37 public: |
38 LocalCurrentGraphicsContext(GraphicsContext&, const IntRect& dirty_rect); | 38 LocalCurrentGraphicsContext(GraphicsContext&, const IntRect& dirty_rect); |
39 LocalCurrentGraphicsContext(PaintCanvas*, | 39 LocalCurrentGraphicsContext(PaintCanvas*, |
40 float device_scale_factor, | 40 float device_scale_factor, |
41 const IntRect& dirty_rect); | 41 const IntRect& dirty_rect); |
42 ~LocalCurrentGraphicsContext(); | 42 ~LocalCurrentGraphicsContext(); |
43 CGContextRef CgContext(); | 43 CGContextRef CgContext(); |
44 | 44 |
45 private: | 45 private: |
46 PaintCanvas* saved_canvas_; | 46 PaintCanvas* saved_canvas_; |
47 NSGraphicsContext* saved_ns_graphics_context_; | 47 NSGraphicsContext* saved_ns_graphics_context_; |
48 bool did_set_graphics_context_; | 48 bool did_set_graphics_context_; |
49 IntRect inflated_dirty_rect_; | 49 IntRect inflated_dirty_rect_; |
50 GraphicsContextCanvas graphics_context_canvas_; | 50 GraphicsContextCanvas graphics_context_canvas_; |
51 }; | 51 }; |
52 } | 52 } |
OLD | NEW |