| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 The Android Open Source Project | 2 * Copyright 2010 The Android Open Source Project |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkDevice_DEFINED | 8 #ifndef SkDevice_DEFINED |
| 9 #define SkDevice_DEFINED | 9 #define SkDevice_DEFINED |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 SkMetaData& getMetaData(); | 35 SkMetaData& getMetaData(); |
| 36 | 36 |
| 37 /** | 37 /** |
| 38 * Return ImageInfo for this device. If the canvas is not backed by pixels | 38 * Return ImageInfo for this device. If the canvas is not backed by pixels |
| 39 * (cpu or gpu), then the info's ColorType will be kUnknown_SkColorType. | 39 * (cpu or gpu), then the info's ColorType will be kUnknown_SkColorType. |
| 40 */ | 40 */ |
| 41 virtual SkImageInfo imageInfo() const; | 41 virtual SkImageInfo imageInfo() const; |
| 42 | 42 |
| 43 /** | 43 /** |
| 44 * Return SurfaceProps for this device. |
| 45 */ |
| 46 const SkSurfaceProps& surfaceProps() const { |
| 47 return fSurfaceProps; |
| 48 } |
| 49 |
| 50 /** |
| 44 * Return the bounds of the device in the coordinate space of the root | 51 * Return the bounds of the device in the coordinate space of the root |
| 45 * canvas. The root device will have its top-left at 0,0, but other devices | 52 * canvas. The root device will have its top-left at 0,0, but other devices |
| 46 * such as those associated with saveLayer may have a non-zero origin. | 53 * such as those associated with saveLayer may have a non-zero origin. |
| 47 */ | 54 */ |
| 48 void getGlobalBounds(SkIRect* bounds) const { | 55 void getGlobalBounds(SkIRect* bounds) const { |
| 49 SkASSERT(bounds); | 56 SkASSERT(bounds); |
| 50 const SkIPoint& origin = this->getOrigin(); | 57 const SkIPoint& origin = this->getOrigin(); |
| 51 bounds->setXYWH(origin.x(), origin.y(), this->width(), this->height()); | 58 bounds->setXYWH(origin.x(), origin.y(), this->width(), this->height()); |
| 52 } | 59 } |
| 53 | 60 |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 /** | 317 /** |
| 311 * The caller is responsible for "pre-clipping" the src. The impl can assum
e that the src | 318 * The caller is responsible for "pre-clipping" the src. The impl can assum
e that the src |
| 312 * image at the specified x,y offset will fit within the device's bounds. | 319 * image at the specified x,y offset will fit within the device's bounds. |
| 313 * | 320 * |
| 314 * This is explicitly asserted in writePixelsDirect(), the public way to ca
ll this. | 321 * This is explicitly asserted in writePixelsDirect(), the public way to ca
ll this. |
| 315 */ | 322 */ |
| 316 virtual bool onWritePixels(const SkImageInfo&, const void*, size_t, int x, i
nt y); | 323 virtual bool onWritePixels(const SkImageInfo&, const void*, size_t, int x, i
nt y); |
| 317 | 324 |
| 318 virtual bool onAccessPixels(SkPixmap*) { return false; } | 325 virtual bool onAccessPixels(SkPixmap*) { return false; } |
| 319 | 326 |
| 320 const SkSurfaceProps& surfaceProps() const { | |
| 321 return fSurfaceProps; | |
| 322 } | |
| 323 | |
| 324 /** | 327 /** |
| 325 * PRIVATE / EXPERIMENTAL -- do not call | 328 * PRIVATE / EXPERIMENTAL -- do not call |
| 326 * This entry point gives the backend an opportunity to take over the rende
ring | 329 * This entry point gives the backend an opportunity to take over the rende
ring |
| 327 * of 'picture'. If optimization data is available (due to an earlier | 330 * of 'picture'. If optimization data is available (due to an earlier |
| 328 * 'optimize' call) this entry point should make use of it and return true | 331 * 'optimize' call) this entry point should make use of it and return true |
| 329 * if all rendering has been done. If false is returned, SkCanvas will | 332 * if all rendering has been done. If false is returned, SkCanvas will |
| 330 * perform its own rendering pass. It is acceptable for the backend | 333 * perform its own rendering pass. It is acceptable for the backend |
| 331 * to perform some device-specific warm up tasks and then let SkCanvas | 334 * to perform some device-specific warm up tasks and then let SkCanvas |
| 332 * perform the main rendering loop (by return false from here). | 335 * perform the main rendering loop (by return false from here). |
| 333 */ | 336 */ |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 SkSurfaceProps fSurfaceProps; | 419 SkSurfaceProps fSurfaceProps; |
| 417 | 420 |
| 418 #ifdef SK_DEBUG | 421 #ifdef SK_DEBUG |
| 419 bool fAttachedToCanvas; | 422 bool fAttachedToCanvas; |
| 420 #endif | 423 #endif |
| 421 | 424 |
| 422 typedef SkRefCnt INHERITED; | 425 typedef SkRefCnt INHERITED; |
| 423 }; | 426 }; |
| 424 | 427 |
| 425 #endif | 428 #endif |
| OLD | NEW |