OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 The Android Open Source Project | 2 * Copyright (C) 2006 The Android Open Source Project |
3 * | 3 * |
4 * Licensed under the Apache License, Version 2.0 (the "License"); | 4 * Licensed under the Apache License, Version 2.0 (the "License"); |
5 * you may not use this file except in compliance with the License. | 5 * you may not use this file except in compliance with the License. |
6 * You may obtain a copy of the License at | 6 * You may obtain a copy of the License at |
7 * | 7 * |
8 * http://www.apache.org/licenses/LICENSE-2.0 | 8 * http://www.apache.org/licenses/LICENSE-2.0 |
9 * | 9 * |
10 * Unless required by applicable law or agreed to in writing, software | 10 * Unless required by applicable law or agreed to in writing, software |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 enum { | 34 enum { |
35 kCountMaskFormats = kLCD_Format + 1 | 35 kCountMaskFormats = kLCD_Format + 1 |
36 }; | 36 }; |
37 | 37 |
38 uint8_t* fImage; | 38 uint8_t* fImage; |
39 SkIRect fBounds; | 39 SkIRect fBounds; |
40 uint16_t fRowBytes; | 40 uint16_t fRowBytes; |
41 uint8_t fFormat; // Format | 41 uint8_t fFormat; // Format |
42 | 42 |
| 43 /** Returns true if the mask is empty: i.e. it has an empty bounds. |
| 44 */ |
| 45 bool isEmpty() const { return fBounds.isEmpty(); } |
| 46 |
43 /** Return the byte size of the mask, assuming only 1 plane. | 47 /** Return the byte size of the mask, assuming only 1 plane. |
44 Does not account for k3D_Format. For that, use computeFormatImageSize() | 48 Does not account for k3D_Format. For that, use computeTotalImageSize() |
| 49 If there is an overflow of 32bits, then returns 0. |
45 */ | 50 */ |
46 size_t computeImageSize() const; | 51 size_t computeImageSize() const; |
47 /** Return the byte size of the mask, taking into account | 52 /** Return the byte size of the mask, taking into account |
48 any extra planes (e.g. k3D_Format). | 53 any extra planes (e.g. k3D_Format). |
| 54 If there is an overflow of 32bits, then returns 0. |
49 */ | 55 */ |
50 size_t computeTotalImageSize() const; | 56 size_t computeTotalImageSize() const; |
51 | 57 |
52 /** Returns the address of the byte that holds the specified bit. | 58 /** Returns the address of the byte that holds the specified bit. |
53 Asserts that the mask is kBW_Format, and that x,y are in range. | 59 Asserts that the mask is kBW_Format, and that x,y are in range. |
54 x,y are in the same coordiate space as fBounds. | 60 x,y are in the same coordiate space as fBounds. |
55 */ | 61 */ |
56 uint8_t* getAddr1(int x, int y) const | 62 uint8_t* getAddr1(int x, int y) const |
57 { | 63 { |
58 SkASSERT(fFormat == kBW_Format); | 64 SkASSERT(fFormat == kBW_Format); |
(...skipping 18 matching lines...) Expand all Loading... |
77 | 83 |
78 enum CreateMode { | 84 enum CreateMode { |
79 kJustComputeBounds_CreateMode, //!< compute bounds and return | 85 kJustComputeBounds_CreateMode, //!< compute bounds and return |
80 kJustRenderImage_CreateMode, //!< render into preallocate mask | 86 kJustRenderImage_CreateMode, //!< render into preallocate mask |
81 kComputeBoundsAndRenderImage_CreateMode //!< compute bounds, alloc imag
e and render into it | 87 kComputeBoundsAndRenderImage_CreateMode //!< compute bounds, alloc imag
e and render into it |
82 }; | 88 }; |
83 }; | 89 }; |
84 | 90 |
85 #endif | 91 #endif |
86 | 92 |
OLD | NEW |