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

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

Issue 14110: Move the "platform" wrappers in skia/ext to the skia namespace. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 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
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 // that the graphics state that is pushed and popped by save() and restore() 56 // that the graphics state that is pushed and popped by save() and restore()
57 // includes things like colors and pen styles. Skia does this differently, where 57 // includes things like colors and pen styles. Skia does this differently, where
58 // push and pop only includes transforms and bitmaps, and the application is 58 // push and pop only includes transforms and bitmaps, and the application is
59 // responsible for managing the painting state which is store in separate 59 // responsible for managing the painting state which is store in separate
60 // SkPaint objects. This class provides the adaptor that allows the painting 60 // SkPaint objects. This class provides the adaptor that allows the painting
61 // state to be pushed and popped along with the bitmap. 61 // state to be pushed and popped along with the bitmap.
62 class PlatformContextSkia { 62 class PlatformContextSkia {
63 public: 63 public:
64 // For printing, there shouldn't be any canvas. canvas can be NULL. If you 64 // For printing, there shouldn't be any canvas. canvas can be NULL. If you
65 // supply a NULL canvas, you can also call setCanvas later. 65 // supply a NULL canvas, you can also call setCanvas later.
66 PlatformContextSkia(gfx::PlatformCanvas* canvas); 66 PlatformContextSkia(skia::PlatformCanvas* canvas);
67 ~PlatformContextSkia(); 67 ~PlatformContextSkia();
68 68
69 // Sets the canvas associated with this context. Use when supplying NULL 69 // Sets the canvas associated with this context. Use when supplying NULL
70 // to the constructor. 70 // to the constructor.
71 void setCanvas(gfx::PlatformCanvas* canvas); 71 void setCanvas(skia::PlatformCanvas* canvas);
72 72
73 void save(); 73 void save();
74 void restore(); 74 void restore();
75 75
76 // Sets up the common flags on a paint for antialiasing, effects, etc. 76 // Sets up the common flags on a paint for antialiasing, effects, etc.
77 // This is implicitly called by setupPaintFill and setupPaintStroke, but 77 // This is implicitly called by setupPaintFill and setupPaintStroke, but
78 // you may wish to call it directly sometimes if you don't want that other 78 // you may wish to call it directly sometimes if you don't want that other
79 // behavior. 79 // behavior.
80 void setupPaintCommon(SkPaint* paint) const; 80 void setupPaintCommon(SkPaint* paint) const;
81 81
(...skipping 28 matching lines...) Expand all
110 float getStrokeThickness() const; 110 float getStrokeThickness() const;
111 int getTextDrawingMode() const; 111 int getTextDrawingMode() const;
112 112
113 // Paths. 113 // Paths.
114 void beginPath(); 114 void beginPath();
115 void addPath(const SkPath& path); 115 void addPath(const SkPath& path);
116 const SkPath* currentPath() const { return &m_path; } 116 const SkPath* currentPath() const { return &m_path; }
117 117
118 SkColor fillColor() const; 118 SkColor fillColor() const;
119 119
120 gfx::PlatformCanvas* canvas() { return m_canvas; } 120 skia::PlatformCanvas* canvas() { return m_canvas; }
121 121
122 // TODO(brettw) why is this in this class? 122 // TODO(brettw) why is this in this class?
123 void drawRect(SkRect rect); 123 void drawRect(SkRect rect);
124 124
125 // TODO(maruel): I'm still unsure how I will serialize this call. 125 // TODO(maruel): I'm still unsure how I will serialize this call.
126 void paintSkPaint(const SkRect& rect, const SkPaint& paint); 126 void paintSkPaint(const SkRect& rect, const SkPaint& paint);
127 127
128 const SkBitmap* bitmap() const; 128 const SkBitmap* bitmap() const;
129 129
130 // Returns the canvas used for painting, NOT guaranteed to be non-NULL. 130 // Returns the canvas used for painting, NOT guaranteed to be non-NULL.
131 // 131 //
132 // 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
133 // should use this layer of indirection instead of using the canvas 133 // should use this layer of indirection instead of using the canvas
134 // directly. This is to help with the eventual serialization. 134 // directly. This is to help with the eventual serialization.
135 gfx::PlatformCanvas* canvas() const; 135 skia::PlatformCanvas* canvas() const;
136 136
137 // 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
138 // 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
139 // possible quality. 139 // possible quality.
140 bool IsPrinting(); 140 bool IsPrinting();
141 141
142 #if defined(__linux__) 142 #if defined(__linux__)
143 GdkSkia* gdk_skia() const { return m_gdkskia; } 143 GdkSkia* gdk_skia() const { return m_gdkskia; }
144 #endif 144 #endif
145 145
146 private: 146 private:
147 // Defines drawing style. 147 // Defines drawing style.
148 struct State; 148 struct State;
149 149
150 // NULL indicates painting is disabled. Never delete this object. 150 // NULL indicates painting is disabled. Never delete this object.
151 gfx::PlatformCanvas* m_canvas; 151 skia::PlatformCanvas* m_canvas;
152 152
153 // States stack. Enables local drawing state change with save()/restore() 153 // States stack. Enables local drawing state change with save()/restore()
154 // calls. 154 // calls.
155 WTF::Vector<State> m_stateStack; 155 WTF::Vector<State> m_stateStack;
156 // 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
157 // mStateStack.back(). 157 // mStateStack.back().
158 State* m_state; 158 State* m_state;
159 159
160 // Current path. 160 // Current path.
161 SkPath m_path; 161 SkPath m_path;
162 162
163 // Disallow these. 163 // Disallow these.
164 PlatformContextSkia(const PlatformContextSkia&); 164 PlatformContextSkia(const PlatformContextSkia&);
165 void operator=(const PlatformContextSkia&); 165 void operator=(const PlatformContextSkia&);
166 166
167 #if defined(__linux__) 167 #if defined(__linux__)
168 // A pointer to a GDK Drawable wrapping of this Skia canvas 168 // A pointer to a GDK Drawable wrapping of this Skia canvas
169 GdkSkia* m_gdkskia; 169 GdkSkia* m_gdkskia;
170 #endif 170 #endif
171 }; 171 };
172 172
173 #endif // PlatformContextSkia_h 173 #endif // PlatformContextSkia_h
OLDNEW
« no previous file with comments | « webkit/port/platform/graphics/skia/ImageSkia.cpp ('k') | webkit/port/platform/graphics/skia/PlatformContextSkia.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698