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

Side by Side Diff: include/core/SkBitmapDevice.h

Issue 354133002: change gpudevice and pdfdevice to inherit from basedevice (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: pdfdevice needs to override newSurface Created 6 years, 5 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
« no previous file with comments | « no previous file | include/core/SkDevice.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2013 Google Inc. 3 * Copyright 2013 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #ifndef SkBitmapDevice_DEFINED 9 #ifndef SkBitmapDevice_DEFINED
10 #define SkBitmapDevice_DEFINED 10 #define SkBitmapDevice_DEFINED
(...skipping 17 matching lines...) Expand all
28 * valid for the bitmap to have no pixels associated with it. In that case, 28 * valid for the bitmap to have no pixels associated with it. In that case,
29 * any drawing to this device will have no effect. 29 * any drawing to this device will have no effect.
30 */ 30 */
31 SkBitmapDevice(const SkBitmap& bitmap, const SkDeviceProperties& devicePrope rties); 31 SkBitmapDevice(const SkBitmap& bitmap, const SkDeviceProperties& devicePrope rties);
32 32
33 static SkBitmapDevice* Create(const SkImageInfo&, 33 static SkBitmapDevice* Create(const SkImageInfo&,
34 const SkDeviceProperties* = NULL); 34 const SkDeviceProperties* = NULL);
35 35
36 virtual SkImageInfo imageInfo() const SK_OVERRIDE; 36 virtual SkImageInfo imageInfo() const SK_OVERRIDE;
37 37
38 /**
39 * Return the device's associated gpu render target, or NULL.
40 */
41 virtual GrRenderTarget* accessRenderTarget() SK_OVERRIDE { return NULL; }
42
43 protected: 38 protected:
44 /**
45 * Device may filter the text flags for drawing text here. If it wants to
46 * make a change to the specified values, it should write them into the
47 * textflags parameter (output) and return true. If the paint is fine as
48 * is, then ignore the textflags parameter and return false.
49 *
50 * The baseclass SkDevice filters based on its depth and blitters.
51 */
52 virtual bool filterTextFlags(const SkPaint& paint, TextFlags*) SK_OVERRIDE; 39 virtual bool filterTextFlags(const SkPaint& paint, TextFlags*) SK_OVERRIDE;
53 40
54 /** Clears the entire device to the specified color (including alpha). 41 /** Clears the entire device to the specified color (including alpha).
55 * Ignores the clip. 42 * Ignores the clip.
56 */ 43 */
57 virtual void clear(SkColor color) SK_OVERRIDE; 44 virtual void clear(SkColor color) SK_OVERRIDE;
58 45
59 /** These are called inside the per-device-layer loop for each draw call. 46 /** These are called inside the per-device-layer loop for each draw call.
60 When these are called, we have already applied any saveLayer operations, 47 When these are called, we have already applied any saveLayer operations,
61 and are handling any looping from the paint, and any effects from the 48 and are handling any looping from the paint, and any effects from the
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 virtual bool onReadPixels(const SkImageInfo&, void*, size_t, int x, int y) S K_OVERRIDE; 129 virtual bool onReadPixels(const SkImageInfo&, void*, size_t, int x, int y) S K_OVERRIDE;
143 virtual bool onWritePixels(const SkImageInfo&, const void*, size_t, int, int ) SK_OVERRIDE; 130 virtual bool onWritePixels(const SkImageInfo&, const void*, size_t, int, int ) SK_OVERRIDE;
144 virtual void* onAccessPixels(SkImageInfo* info, size_t* rowBytes) SK_OVERRID E; 131 virtual void* onAccessPixels(SkImageInfo* info, size_t* rowBytes) SK_OVERRID E;
145 132
146 /** Called when this device is installed into a Canvas. Balanced by a call 133 /** Called when this device is installed into a Canvas. Balanced by a call
147 to unlockPixels() when the device is removed from a Canvas. 134 to unlockPixels() when the device is removed from a Canvas.
148 */ 135 */
149 virtual void lockPixels() SK_OVERRIDE; 136 virtual void lockPixels() SK_OVERRIDE;
150 virtual void unlockPixels() SK_OVERRIDE; 137 virtual void unlockPixels() SK_OVERRIDE;
151 138
152 /**
153 * Returns true if the device allows processing of this imagefilter. If
154 * false is returned, then the filter is ignored. This may happen for
155 * some subclasses that do not support pixel manipulations after drawing
156 * has occurred (e.g. printing). The default implementation returns true.
157 */
158 virtual bool allowImageFilter(const SkImageFilter*) SK_OVERRIDE;
159
160 /**
161 * Override and return true for filters that the device can handle
162 * intrinsically. Doing so means that SkCanvas will pass-through this
163 * filter to drawSprite and drawDevice (and potentially filterImage).
164 * Returning false means the SkCanvas will have apply the filter itself,
165 * and just pass the resulting image to the device.
166 */
167 virtual bool canHandleImageFilter(const SkImageFilter*) SK_OVERRIDE;
168
169 /**
170 * Related (but not required) to canHandleImageFilter, this method returns
171 * true if the device could apply the filter to the src bitmap and return
172 * the result (and updates offset as needed).
173 * If the device does not recognize or support this filter,
174 * it just returns false and leaves result and offset unchanged.
175 */
176 virtual bool filterImage(const SkImageFilter*, const SkBitmap&, const SkImag eFilter::Context&,
177 SkBitmap* result, SkIPoint* offset) SK_OVERRIDE;
178
179 private: 139 private:
180 friend class SkCanvas; 140 friend class SkCanvas;
181 friend struct DeviceCM; //for setMatrixClip 141 friend struct DeviceCM; //for setMatrixClip
182 friend class SkDraw; 142 friend class SkDraw;
183 friend class SkDrawIter; 143 friend class SkDrawIter;
184 friend class SkDeviceFilteredPaint; 144 friend class SkDeviceFilteredPaint;
185 friend class SkDeviceImageFilterProxy; 145 friend class SkDeviceImageFilterProxy;
186 146
187 friend class SkSurface_Raster; 147 friend class SkSurface_Raster;
188 148
189 // used to change the backend's pixels (and possibly config/rowbytes) 149 // used to change the backend's pixels (and possibly config/rowbytes)
190 // but cannot change the width/height, so there should be no change to 150 // but cannot change the width/height, so there should be no change to
191 // any clip information. 151 // any clip information.
192 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) SK_OVERRI DE; 152 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) SK_OVERRI DE;
193 153
194 virtual SkBaseDevice* onCreateDevice(const SkImageInfo&, Usage) SK_OVERRIDE; 154 virtual SkBaseDevice* onCreateDevice(const SkImageInfo&, Usage) SK_OVERRIDE;
195 155
196 /** Causes any deferred drawing to the device to be completed.
197 */
198 virtual void flush() SK_OVERRIDE {}
199
200 virtual SkSurface* newSurface(const SkImageInfo&) SK_OVERRIDE; 156 virtual SkSurface* newSurface(const SkImageInfo&) SK_OVERRIDE;
201 virtual const void* peekPixels(SkImageInfo*, size_t* rowBytes) SK_OVERRIDE; 157 virtual const void* peekPixels(SkImageInfo*, size_t* rowBytes) SK_OVERRIDE;
202 158
203 SkBitmap fBitmap; 159 SkBitmap fBitmap;
204 160
205 typedef SkBaseDevice INHERITED; 161 typedef SkBaseDevice INHERITED;
206 }; 162 };
207 163
208 #endif // SkBitmapDevice_DEFINED 164 #endif // SkBitmapDevice_DEFINED
OLDNEW
« no previous file with comments | « no previous file | include/core/SkDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698