| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 * On failure, returns false and ignores the pixmap parameter. | 105 * On failure, returns false and ignores the pixmap parameter. |
| 106 */ | 106 */ |
| 107 bool peekPixels(SkPixmap*); | 107 bool peekPixels(SkPixmap*); |
| 108 | 108 |
| 109 /** | 109 /** |
| 110 * Return the device's origin: its offset in device coordinates from | 110 * Return the device's origin: its offset in device coordinates from |
| 111 * the default origin in its canvas' matrix/clip | 111 * the default origin in its canvas' matrix/clip |
| 112 */ | 112 */ |
| 113 const SkIPoint& getOrigin() const { return fOrigin; } | 113 const SkIPoint& getOrigin() const { return fOrigin; } |
| 114 | 114 |
| 115 /** | |
| 116 * onAttachToCanvas is invoked whenever a device is installed in a canvas | |
| 117 * (i.e., setDevice, saveLayer (for the new device created by the save), | |
| 118 * and SkCanvas' SkBaseDevice & SkBitmap -taking ctors). It allows the | |
| 119 * devices to prepare for drawing (e.g., locking their pixels, etc.) | |
| 120 */ | |
| 121 virtual void onAttachToCanvas(SkCanvas*) { | |
| 122 SkASSERT(!fAttachedToCanvas); | |
| 123 #ifdef SK_DEBUG | |
| 124 fAttachedToCanvas = true; | |
| 125 #endif | |
| 126 }; | |
| 127 | |
| 128 /** | |
| 129 * onDetachFromCanvas notifies a device that it will no longer be drawn to. | |
| 130 * It gives the device a chance to clean up (e.g., unlock its pixels). It | |
| 131 * is invoked from setDevice (for the displaced device), restore and | |
| 132 * possibly from SkCanvas' dtor. | |
| 133 */ | |
| 134 virtual void onDetachFromCanvas() { | |
| 135 SkASSERT(fAttachedToCanvas); | |
| 136 #ifdef SK_DEBUG | |
| 137 fAttachedToCanvas = false; | |
| 138 #endif | |
| 139 }; | |
| 140 | |
| 141 protected: | 115 protected: |
| 142 enum TileUsage { | 116 enum TileUsage { |
| 143 kPossible_TileUsage, //!< the created device may be drawn tiled | 117 kPossible_TileUsage, //!< the created device may be drawn tiled |
| 144 kNever_TileUsage, //!< the created device will never be drawn tile
d | 118 kNever_TileUsage, //!< the created device will never be drawn tile
d |
| 145 }; | 119 }; |
| 146 | 120 |
| 147 struct TextFlags { | 121 struct TextFlags { |
| 148 uint32_t fFlags; // SkPaint::getFlags() | 122 uint32_t fFlags; // SkPaint::getFlags() |
| 149 }; | 123 }; |
| 150 | 124 |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 virtual SkImageFilterCache* getImageFilterCache() { return NULL; } | 365 virtual SkImageFilterCache* getImageFilterCache() { return NULL; } |
| 392 | 366 |
| 393 SkIPoint fOrigin; | 367 SkIPoint fOrigin; |
| 394 SkMetaData* fMetaData; | 368 SkMetaData* fMetaData; |
| 395 SkSurfaceProps fSurfaceProps; | 369 SkSurfaceProps fSurfaceProps; |
| 396 | 370 |
| 397 #ifdef SK_SUPPORT_LEGACY_ACCESSBITMAP | 371 #ifdef SK_SUPPORT_LEGACY_ACCESSBITMAP |
| 398 SkBitmap fLegacyBitmap; | 372 SkBitmap fLegacyBitmap; |
| 399 #endif | 373 #endif |
| 400 | 374 |
| 401 #ifdef SK_DEBUG | |
| 402 bool fAttachedToCanvas; | |
| 403 #endif | |
| 404 | |
| 405 typedef SkRefCnt INHERITED; | 375 typedef SkRefCnt INHERITED; |
| 406 }; | 376 }; |
| 407 | 377 |
| 408 #endif | 378 #endif |
| OLD | NEW |