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

Side by Side Diff: webkit/port/platform/graphics/PlatformContextSkia.h

Issue 9757: Cache the GdkSkia object in PlatformContextSkia so that we aren't creating (Closed)
Patch Set: Moving files against Created 12 years, 1 month 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 // Copyright (c) 2008, Google Inc. All rights reserved. 1 // Copyright (c) 2008, Google Inc. All rights reserved.
2 // 2 //
3 // Redistribution and use in source and binary forms, with or without 3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are 4 // modification, are permitted provided that the following conditions are
5 // met: 5 // met:
6 // 6 //
7 // * Redistributions of source code must retain the above copyright 7 // * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer. 8 // notice, this list of conditions and the following disclaimer.
9 // * Redistributions in binary form must reproduce the above 9 // * Redistributions in binary form must reproduce the above
10 // copyright notice, this list of conditions and the following disclaimer 10 // copyright notice, this list of conditions and the following disclaimer
(...skipping 22 matching lines...) Expand all
33 33
34 #include "SkDashPathEffect.h" 34 #include "SkDashPathEffect.h"
35 #include "SkDrawLooper.h" 35 #include "SkDrawLooper.h"
36 #include "SkDeque.h" 36 #include "SkDeque.h"
37 #include "SkPaint.h" 37 #include "SkPaint.h"
38 #include "SkPath.h" 38 #include "SkPath.h"
39 39
40 #include "GraphicsContext.h" 40 #include "GraphicsContext.h"
41 #include "wtf/Vector.h" 41 #include "wtf/Vector.h"
42 42
43 typedef struct _GdkDrawable GdkSkia;
44
43 // This class holds the platform-specific state for GraphicsContext. We put 45 // This class holds the platform-specific state for GraphicsContext. We put
44 // most of our Skia wrappers on this class. In theory, a lot of this stuff could 46 // most of our Skia wrappers on this class. In theory, a lot of this stuff could
45 // be moved to GraphicsContext directly, except that some code external to this 47 // be moved to GraphicsContext directly, except that some code external to this
46 // would like to poke at our graphics layer as well (like the Image and Font 48 // would like to poke at our graphics layer as well (like the Image and Font
47 // stuff, which needs some amount of our wrappers and state around SkCanvas). 49 // stuff, which needs some amount of our wrappers and state around SkCanvas).
48 // 50 //
49 // So in general, this class uses just Skia types except when there's no easy 51 // So in general, this class uses just Skia types except when there's no easy
50 // conversion. GraphicsContext is responsible for converting the WebKit types to 52 // conversion. GraphicsContext is responsible for converting the WebKit types to
51 // Skia types and setting up the eventual call to the Skia functions. 53 // Skia types and setting up the eventual call to the Skia functions.
52 // 54 //
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 // Warning: This function is deprecated so the users are reminded that they 132 // Warning: This function is deprecated so the users are reminded that they
131 // should use this layer of indirection instead of using the canvas 133 // should use this layer of indirection instead of using the canvas
132 // directly. This is to help with the eventual serialization. 134 // directly. This is to help with the eventual serialization.
133 gfx::PlatformCanvas* canvas() const; 135 gfx::PlatformCanvas* canvas() const;
134 136
135 // Returns if the context is a printing context instead of a display 137 // Returns if the context is a printing context instead of a display
136 // context. Bitmap shouldn't be resampled when printing to keep the best 138 // context. Bitmap shouldn't be resampled when printing to keep the best
137 // possible quality. 139 // possible quality.
138 bool IsPrinting(); 140 bool IsPrinting();
139 141
142 #if defined(OS_LINUX)
143 GdkSkia* gdk_skia() const { return m_gdkskia; }
144 #endif
145
140 private: 146 private:
141 // Defines drawing style. 147 // Defines drawing style.
142 struct State; 148 struct State;
143 149
144 // NULL indicates painting is disabled. Never delete this object. 150 // NULL indicates painting is disabled. Never delete this object.
145 gfx::PlatformCanvas* m_canvas; 151 gfx::PlatformCanvas* m_canvas;
146 152
147 // States stack. Enables local drawing state change with save()/restore() 153 // States stack. Enables local drawing state change with save()/restore()
148 // calls. 154 // calls.
149 WTF::Vector<State> m_stateStack; 155 WTF::Vector<State> m_stateStack;
150 // Pointer to the current drawing state. This is a cached value of 156 // Pointer to the current drawing state. This is a cached value of
151 // mStateStack.back(). 157 // mStateStack.back().
152 State* m_state; 158 State* m_state;
153 159
154 // Current path. 160 // Current path.
155 SkPath m_path; 161 SkPath m_path;
156 162
157 // Disallow these. 163 // Disallow these.
158 PlatformContextSkia(const PlatformContextSkia&); 164 PlatformContextSkia(const PlatformContextSkia&);
159 void operator=(const PlatformContextSkia&); 165 void operator=(const PlatformContextSkia&);
166
167 #if defined(OS_LINUX)
168 // A pointer to a GDK Drawable wrapping of this Skia canvas
169 GdkSkia* m_gdkskia;
170 #endif
160 }; 171 };
161 172
162 #endif // PlatformContextSkia_h 173 #endif // PlatformContextSkia_h
OLDNEW
« no previous file with comments | « webkit/port/platform/chromium/gdkskiadrawable.cc ('k') | webkit/port/platform/graphics/PlatformContextSkia.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698