OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 The Android Open Source Project | 3 * Copyright 2010 The Android Open Source Project |
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 | 9 |
10 #ifndef SkDevice_DEFINED | 10 #ifndef SkDevice_DEFINED |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 virtual SkBitmap::Config config() const = 0; | 109 virtual SkBitmap::Config config() const = 0; |
110 | 110 |
111 /** Return the bitmap associated with this device. Call this each time you n
eed | 111 /** Return the bitmap associated with this device. Call this each time you n
eed |
112 to access the bitmap, as it notifies the subclass to perform any flushin
g | 112 to access the bitmap, as it notifies the subclass to perform any flushin
g |
113 etc. before you examine the pixels. | 113 etc. before you examine the pixels. |
114 @param changePixels set to true if the caller plans to change the pixels | 114 @param changePixels set to true if the caller plans to change the pixels |
115 @return the device's bitmap | 115 @return the device's bitmap |
116 */ | 116 */ |
117 const SkBitmap& accessBitmap(bool changePixels); | 117 const SkBitmap& accessBitmap(bool changePixels); |
118 | 118 |
| 119 #ifdef SK_SUPPORT_LEGACY_WRITEPIXELSCONFIG |
119 /** | 120 /** |
120 * DEPRECATED: This will be made protected once WebKit stops using it. | 121 * DEPRECATED: This will be made protected once WebKit stops using it. |
121 * Instead use Canvas' writePixels method. | 122 * Instead use Canvas' writePixels method. |
122 * | 123 * |
123 * Similar to draw sprite, this method will copy the pixels in bitmap onto | 124 * Similar to draw sprite, this method will copy the pixels in bitmap onto |
124 * the device, with the top/left corner specified by (x, y). The pixel | 125 * the device, with the top/left corner specified by (x, y). The pixel |
125 * values in the device are completely replaced: there is no blending. | 126 * values in the device are completely replaced: there is no blending. |
126 * | 127 * |
127 * Currently if bitmap is backed by a texture this is a no-op. This may be | 128 * Currently if bitmap is backed by a texture this is a no-op. This may be |
128 * relaxed in the future. | 129 * relaxed in the future. |
129 * | 130 * |
130 * If the bitmap has config kARGB_8888_Config then the config8888 param | 131 * If the bitmap has config kARGB_8888_Config then the config8888 param |
131 * will determines how the pixel valuess are intepreted. If the bitmap is | 132 * will determines how the pixel valuess are intepreted. If the bitmap is |
132 * not kARGB_8888_Config then this parameter is ignored. | 133 * not kARGB_8888_Config then this parameter is ignored. |
133 */ | 134 */ |
134 virtual void writePixels(const SkBitmap& bitmap, int x, int y, | 135 virtual void writePixels(const SkBitmap& bitmap, int x, int y, |
135 SkCanvas::Config8888 config8888 = SkCanvas::kNative
_Premul_Config8888) = 0; | 136 SkCanvas::Config8888 config8888 = SkCanvas::kNative
_Premul_Config8888); |
| 137 #endif |
| 138 |
| 139 bool writePixelsDirect(const SkImageInfo&, const void*, size_t rowBytes, int
x, int y); |
136 | 140 |
137 /** | 141 /** |
138 * Return the device's associated gpu render target, or NULL. | 142 * Return the device's associated gpu render target, or NULL. |
139 */ | 143 */ |
140 virtual GrRenderTarget* accessRenderTarget() = 0; | 144 virtual GrRenderTarget* accessRenderTarget() = 0; |
141 | 145 |
142 | 146 |
143 /** | 147 /** |
144 * Return the device's origin: its offset in device coordinates from | 148 * Return the device's origin: its offset in device coordinates from |
145 * the default origin in its canvas' matrix/clip | 149 * the default origin in its canvas' matrix/clip |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 static const SkCanvas::Config8888 kPMColorAlias; | 385 static const SkCanvas::Config8888 kPMColorAlias; |
382 | 386 |
383 protected: | 387 protected: |
384 // default impl returns NULL | 388 // default impl returns NULL |
385 virtual SkSurface* newSurface(const SkImageInfo&); | 389 virtual SkSurface* newSurface(const SkImageInfo&); |
386 | 390 |
387 // default impl returns NULL | 391 // default impl returns NULL |
388 virtual const void* peekPixels(SkImageInfo*, size_t* rowBytes); | 392 virtual const void* peekPixels(SkImageInfo*, size_t* rowBytes); |
389 | 393 |
390 /** | 394 /** |
| 395 * The caller is responsible for "pre-clipping" the src. The impl can assum
e that the src |
| 396 * image at the specified x,y offset will fit within the device's bounds. |
| 397 * |
| 398 * This is explicitly asserted in writePixelsDirect(), the public way to ca
ll this. |
| 399 */ |
| 400 virtual bool onWritePixels(const SkImageInfo&, const void*, size_t, int x, i
nt y); |
| 401 |
| 402 /** |
391 * Leaky properties are those which the device should be applying but it is
n't. | 403 * Leaky properties are those which the device should be applying but it is
n't. |
392 * These properties will be applied by the draw, when and as it can. | 404 * These properties will be applied by the draw, when and as it can. |
393 * If the device does handle a property, that property should be set to the
identity value | 405 * If the device does handle a property, that property should be set to the
identity value |
394 * for that property, effectively making it non-leaky. | 406 * for that property, effectively making it non-leaky. |
395 */ | 407 */ |
396 SkDeviceProperties fLeakyProperties; | 408 SkDeviceProperties fLeakyProperties; |
397 | 409 |
398 private: | 410 private: |
399 friend class SkCanvas; | 411 friend class SkCanvas; |
400 friend struct DeviceCM; //for setMatrixClip | 412 friend struct DeviceCM; //for setMatrixClip |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 SkMetaData* fMetaData; | 453 SkMetaData* fMetaData; |
442 | 454 |
443 #ifdef SK_DEBUG | 455 #ifdef SK_DEBUG |
444 bool fAttachedToCanvas; | 456 bool fAttachedToCanvas; |
445 #endif | 457 #endif |
446 | 458 |
447 typedef SkRefCnt INHERITED; | 459 typedef SkRefCnt INHERITED; |
448 }; | 460 }; |
449 | 461 |
450 #endif | 462 #endif |
OLD | NEW |