OLD | NEW |
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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 implicitly opaque. | 79 implicitly opaque. |
80 */ | 80 */ |
81 virtual bool isOpaque() const SK_OVERRIDE { return fBitmap.isOpaque(); } | 81 virtual bool isOpaque() const SK_OVERRIDE { return fBitmap.isOpaque(); } |
82 | 82 |
83 /** Return the bitmap config of the device's pixels | 83 /** Return the bitmap config of the device's pixels |
84 */ | 84 */ |
85 virtual SkBitmap::Config config() const SK_OVERRIDE { return fBitmap.config(
); } | 85 virtual SkBitmap::Config config() const SK_OVERRIDE { return fBitmap.config(
); } |
86 | 86 |
87 virtual SkImageInfo imageInfo() const SK_OVERRIDE; | 87 virtual SkImageInfo imageInfo() const SK_OVERRIDE; |
88 | 88 |
| 89 #ifdef SK_SUPPORT_LEGACY_WRITEPIXELSCONFIG |
89 /** | 90 /** |
90 * DEPRECATED: This will be made protected once WebKit stops using it. | 91 * DEPRECATED: This will be made protected once WebKit stops using it. |
91 * Instead use Canvas' writePixels method. | 92 * Instead use Canvas' writePixels method. |
92 * | 93 * |
93 * Similar to draw sprite, this method will copy the pixels in bitmap onto | 94 * Similar to draw sprite, this method will copy the pixels in bitmap onto |
94 * the device, with the top/left corner specified by (x, y). The pixel | 95 * the device, with the top/left corner specified by (x, y). The pixel |
95 * values in the device are completely replaced: there is no blending. | 96 * values in the device are completely replaced: there is no blending. |
96 * | 97 * |
97 * Currently if bitmap is backed by a texture this is a no-op. This may be | 98 * Currently if bitmap is backed by a texture this is a no-op. This may be |
98 * relaxed in the future. | 99 * relaxed in the future. |
99 * | 100 * |
100 * If the bitmap has config kARGB_8888_Config then the config8888 param | 101 * If the bitmap has config kARGB_8888_Config then the config8888 param |
101 * will determines how the pixel valuess are intepreted. If the bitmap is | 102 * will determines how the pixel valuess are intepreted. If the bitmap is |
102 * not kARGB_8888_Config then this parameter is ignored. | 103 * not kARGB_8888_Config then this parameter is ignored. |
103 */ | 104 */ |
104 virtual void writePixels(const SkBitmap& bitmap, int x, int y, | 105 virtual void writePixels(const SkBitmap& bitmap, int x, int y, |
105 SkCanvas::Config8888 config8888) SK_OVERRIDE; | 106 SkCanvas::Config8888 config8888) SK_OVERRIDE; |
106 | 107 #endif |
107 /** | 108 /** |
108 * Return the device's associated gpu render target, or NULL. | 109 * Return the device's associated gpu render target, or NULL. |
109 */ | 110 */ |
110 virtual GrRenderTarget* accessRenderTarget() SK_OVERRIDE { return NULL; } | 111 virtual GrRenderTarget* accessRenderTarget() SK_OVERRIDE { return NULL; } |
111 | 112 |
112 protected: | 113 protected: |
113 /** | 114 /** |
114 * Device may filter the text flags for drawing text here. If it wants to | 115 * Device may filter the text flags for drawing text here. If it wants to |
115 * make a change to the specified values, it should write them into the | 116 * make a change to the specified values, it should write them into the |
116 * textflags parameter (output) and return true. If the paint is fine as | 117 * textflags parameter (output) and return true. If the paint is fine as |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 return pr; | 209 return pr; |
209 } | 210 } |
210 | 211 |
211 /** | 212 /** |
212 * Implements readPixels API. The caller will ensure that: | 213 * Implements readPixels API. The caller will ensure that: |
213 * 1. bitmap has pixel config kARGB_8888_Config. | 214 * 1. bitmap has pixel config kARGB_8888_Config. |
214 * 2. bitmap has pixels. | 215 * 2. bitmap has pixels. |
215 * 3. The rectangle (x, y, x + bitmap->width(), y + bitmap->height()) is | 216 * 3. The rectangle (x, y, x + bitmap->width(), y + bitmap->height()) is |
216 * contained in the device bounds. | 217 * contained in the device bounds. |
217 */ | 218 */ |
218 virtual bool onReadPixels(const SkBitmap& bitmap, | 219 virtual bool onReadPixels(const SkBitmap&, int x, int y, SkCanvas::Config888
8) SK_OVERRIDE; |
219 int x, int y, | 220 virtual bool onWritePixels(const SkImageInfo&, const void*, size_t, int, int
) SK_OVERRIDE; |
220 SkCanvas::Config8888 config8888) SK_OVERRIDE; | |
221 | 221 |
222 /** Called when this device is installed into a Canvas. Balanced by a call | 222 /** Called when this device is installed into a Canvas. Balanced by a call |
223 to unlockPixels() when the device is removed from a Canvas. | 223 to unlockPixels() when the device is removed from a Canvas. |
224 */ | 224 */ |
225 virtual void lockPixels() SK_OVERRIDE; | 225 virtual void lockPixels() SK_OVERRIDE; |
226 virtual void unlockPixels() SK_OVERRIDE; | 226 virtual void unlockPixels() SK_OVERRIDE; |
227 | 227 |
228 /** | 228 /** |
229 * Returns true if the device allows processing of this imagefilter. If | 229 * Returns true if the device allows processing of this imagefilter. If |
230 * false is returned, then the filter is ignored. This may happen for | 230 * false is returned, then the filter is ignored. This may happen for |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 | 280 |
281 virtual SkSurface* newSurface(const SkImageInfo&) SK_OVERRIDE; | 281 virtual SkSurface* newSurface(const SkImageInfo&) SK_OVERRIDE; |
282 virtual const void* peekPixels(SkImageInfo*, size_t* rowBytes) SK_OVERRIDE; | 282 virtual const void* peekPixels(SkImageInfo*, size_t* rowBytes) SK_OVERRIDE; |
283 | 283 |
284 SkBitmap fBitmap; | 284 SkBitmap fBitmap; |
285 | 285 |
286 typedef SkBaseDevice INHERITED; | 286 typedef SkBaseDevice INHERITED; |
287 }; | 287 }; |
288 | 288 |
289 #endif // SkBitmapDevice_DEFINED | 289 #endif // SkBitmapDevice_DEFINED |
OLD | NEW |