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

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

Issue 488353003: Specify clip rects when drawing Mac native widgets (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Incorporate review feedbac Created 6 years, 4 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
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/Geometry/IntRect.h"
20 #include "platform/PlatformExport.h" 21 #include "platform/PlatformExport.h"
21 #include "skia/ext/skia_utils_mac.h" 22 #include "skia/ext/skia_utils_mac.h"
22 #include "wtf/Noncopyable.h" 23 #include "wtf/Noncopyable.h"
23 24
24 OBJC_CLASS NSGraphicsContext; 25 OBJC_CLASS NSGraphicsContext;
25 26
26 namespace blink { 27 namespace blink {
27 28
28 class GraphicsContext; 29 class GraphicsContext;
29 30
30 // This class automatically saves and restores the current NSGraphicsContext for 31 // This class automatically saves and restores the current NSGraphicsContext for
31 // functions which call out into AppKit and rely on the currentContext being set 32 // functions which call out into AppKit and rely on the currentContext being set
32 class PLATFORM_EXPORT LocalCurrentGraphicsContext { 33 class PLATFORM_EXPORT LocalCurrentGraphicsContext {
33 WTF_MAKE_NONCOPYABLE(LocalCurrentGraphicsContext); 34 WTF_MAKE_NONCOPYABLE(LocalCurrentGraphicsContext);
34 public: 35 public:
35 LocalCurrentGraphicsContext(GraphicsContext* graphicsContext); 36 LocalCurrentGraphicsContext(GraphicsContext*, IntRect clipRect);
36 ~LocalCurrentGraphicsContext(); 37 ~LocalCurrentGraphicsContext();
37 CGContextRef cgContext(); 38 CGContextRef cgContext();
38 private: 39 private:
40
39 GraphicsContext* m_savedGraphicsContext; 41 GraphicsContext* m_savedGraphicsContext;
40 NSGraphicsContext* m_savedNSGraphicsContext; 42 NSGraphicsContext* m_savedNSGraphicsContext;
41 bool m_didSetGraphicsContext; 43 bool m_didSetGraphicsContext;
42 gfx::SkiaBitLocker m_skiaBitLocker; 44 gfx::SkiaBitLocker m_skiaBitLocker;
43 }; 45 };
44 46
45 class PLATFORM_EXPORT ContextContainer { 47 class PLATFORM_EXPORT ContextContainer {
46 WTF_MAKE_NONCOPYABLE(ContextContainer); 48 WTF_MAKE_NONCOPYABLE(ContextContainer);
47 public: 49 public:
48 ContextContainer(GraphicsContext*); 50 ContextContainer(GraphicsContext*);
49 51
50 // This synchronizes the CGContext to reflect the current SkCanvas state. 52 // This synchronizes the CGContext to reflect the current SkCanvas state.
51 // The implementation may not return the same CGContext each time. 53 // The implementation may not return the same CGContext each time.
52 CGContextRef context() { return m_skiaBitLocker.cgContext(); } 54 CGContextRef context() { return m_skiaBitLocker.cgContext(); }
53 55
54 private: 56 private:
55 gfx::SkiaBitLocker m_skiaBitLocker; 57 gfx::SkiaBitLocker m_skiaBitLocker;
56 }; 58 };
57 59
58 } 60 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698