Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
| 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 SkError_DEFINED | 8 #ifndef SkError_DEFINED |
| 9 #define SkError_DEFINED | 9 #define SkError_DEFINED |
| 10 | 10 |
| 11 | 11 |
| 12 /** \file SkError.h | 12 /** \file SkError.h |
| 13 */ | 13 */ |
| 14 | 14 |
| 15 enum SkError { | 15 enum SkError { |
| 16 /** All is well | 16 /** All is well |
| 17 */ | 17 */ |
| 18 kNoError_SkError=0, | 18 kNoError_SkError = 0x00, |
|
sugoi1
2013/08/21 15:33:41
Changed these values so that they can be used as f
scroggo
2013/08/21 23:56:00
If we're going to change this, should we change th
scroggo
2013/08/21 23:57:16
nvm
| |
| 19 | 19 |
| 20 /** User argument passed to Skia function was invalid: NULL when that’s | 20 /** User argument passed to Skia function was invalid: NULL when that’s |
| 21 * not allowed, out of numeric range, bad enum, or violating some | 21 * not allowed, out of numeric range, bad enum, or violating some |
| 22 * other general precondition. | 22 * other general precondition. |
| 23 */ | 23 */ |
| 24 kInvalidArgument_SkError, | 24 kInvalidArgument_SkError = 0x01, |
|
scroggo
2013/08/21 23:56:00
Typically we make these line up horizontally. i.e.
scroggo
2013/08/21 23:57:16
nvm
| |
| 25 | 25 |
| 26 /** User tried to perform some operation in a state when the operation | 26 /** User tried to perform some operation in a state when the operation |
| 27 * was not legal, or the operands make no sense (e.g., asking for | 27 * was not legal, or the operands make no sense (e.g., asking for |
| 28 * pixels from an SkPictureCanvas). Other examples might be | 28 * pixels from an SkPictureCanvas). Other examples might be |
| 29 * inset()’ing a rectangle to make it degenerate (negative width/height). | 29 * inset()’ing a rectangle to make it degenerate (negative width/height). |
| 30 */ | 30 */ |
| 31 kInvalidOperation_SkError, | 31 kInvalidOperation_SkError = 0x02, |
| 32 | 32 |
| 33 /** Probably not needed right now, but in the future we could have opaque | 33 /** Probably not needed right now, but in the future we could have opaque |
| 34 * handles for SkPictures floating around, and it would be a good idea | 34 * handles for SkPictures floating around, and it would be a good idea |
| 35 * to anticipate this kind of issue. | 35 * to anticipate this kind of issue. |
| 36 */ | 36 */ |
| 37 kInvalidHandle_SkError, | 37 kInvalidHandle_SkError = 0x04, |
| 38 | 38 |
| 39 /** This is probably not possible because paint surely has defaults for | 39 /** This is probably not possible because paint surely has defaults for |
| 40 * everything, but perhaps a paint can get into a bad state somehow. | 40 * everything, but perhaps a paint can get into a bad state somehow. |
| 41 */ | 41 */ |
| 42 kInvalidPaint_SkError, | 42 kInvalidPaint_SkError = 0x08, |
| 43 | 43 |
| 44 /** Skia was unable to allocate memory to perform some task. | 44 /** Skia was unable to allocate memory to perform some task. |
| 45 */ | 45 */ |
| 46 kOutOfMemory_SkError, | 46 kOutOfMemory_SkError = 0x10, |
| 47 | 47 |
| 48 /** Skia failed while trying to consume some external resource. | 48 /** Skia failed while trying to consume some external resource. |
| 49 */ | 49 */ |
| 50 kParseError_SkError | 50 kParseError_SkError = 0x20 |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 /** Return the current per-thread error code. Error codes are "sticky"; they | 53 /** Return the current per-thread error code. Error codes are "sticky"; they |
| 54 * are not not reset by subsequent successful operations. | 54 * are not not reset by subsequent successful operations. |
| 55 */ | 55 */ |
| 56 SkError SkGetLastError(); | 56 SkError SkGetLastError(); |
| 57 | 57 |
| 58 /** Clear the current per-thread error code back to kNoError_SkError. | 58 /** Clear the current per-thread error code back to kNoError_SkError. |
| 59 */ | 59 */ |
| 60 void SkClearLastError(); | 60 void SkClearLastError(); |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 77 void SkSetErrorCallback(SkErrorCallbackFunction cb, void *context); | 77 void SkSetErrorCallback(SkErrorCallbackFunction cb, void *context); |
| 78 | 78 |
| 79 /** Get a human-readable description of the last (per-thread) error that | 79 /** Get a human-readable description of the last (per-thread) error that |
| 80 * occurred. The returned error message will include not only a human | 80 * occurred. The returned error message will include not only a human |
| 81 * readable version of the error code, but also information about the | 81 * readable version of the error code, but also information about the |
| 82 * conditions that led to the error itself. | 82 * conditions that led to the error itself. |
| 83 */ | 83 */ |
| 84 const char *SkGetLastErrorString(); | 84 const char *SkGetLastErrorString(); |
| 85 | 85 |
| 86 #endif /* SkError_DEFINED */ | 86 #endif /* SkError_DEFINED */ |
| OLD | NEW |