| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 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 SkBitmap_DEFINED | 8 #ifndef SkBitmap_DEFINED |
| 9 #define SkBitmap_DEFINED | 9 #define SkBitmap_DEFINED |
| 10 | 10 |
| 11 #include "SkColor.h" | 11 #include "SkColor.h" |
| 12 #include "SkColorTable.h" | 12 #include "SkColorTable.h" |
| 13 #include "SkImageInfo.h" | 13 #include "SkImageInfo.h" |
| 14 #include "SkPoint.h" | 14 #include "SkPoint.h" |
| 15 #include "SkRefCnt.h" | 15 #include "SkRefCnt.h" |
| 16 | 16 |
| 17 #ifdef SK_SUPPORT_LEGACY_SK64 | |
| 18 #include "Sk64.h" | |
| 19 #endif | |
| 20 | |
| 21 struct SkIRect; | 17 struct SkIRect; |
| 22 struct SkRect; | 18 struct SkRect; |
| 23 class SkPaint; | 19 class SkPaint; |
| 24 class SkPixelRef; | 20 class SkPixelRef; |
| 25 class SkRegion; | 21 class SkRegion; |
| 26 class SkString; | 22 class SkString; |
| 27 | 23 |
| 28 class GrTexture; | 24 class GrTexture; |
| 29 | 25 |
| 30 /** \class SkBitmap | 26 /** \class SkBitmap |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 | 155 |
| 160 /** | 156 /** |
| 161 * Return the number of bytes from the pointer returned by getPixels() | 157 * Return the number of bytes from the pointer returned by getPixels() |
| 162 * to the end of the allocated space in the buffer. This may be smaller | 158 * to the end of the allocated space in the buffer. This may be smaller |
| 163 * than computeSize64() if there is any rowbytes padding beyond the width. | 159 * than computeSize64() if there is any rowbytes padding beyond the width. |
| 164 */ | 160 */ |
| 165 int64_t computeSafeSize64() const { | 161 int64_t computeSafeSize64() const { |
| 166 return ComputeSafeSize64((Config)fConfig, fWidth, fHeight, fRowBytes); | 162 return ComputeSafeSize64((Config)fConfig, fWidth, fHeight, fRowBytes); |
| 167 } | 163 } |
| 168 | 164 |
| 169 #ifdef SK_SUPPORT_LEGACY_SK64 | |
| 170 SK_ATTR_DEPRECATED("use getSize64()") | |
| 171 Sk64 getSize64() const { | |
| 172 Sk64 size; | |
| 173 size.set64(this->computeSize64()); | |
| 174 return size; | |
| 175 } | |
| 176 | |
| 177 SK_ATTR_DEPRECATED("use getSafeSize64()") | |
| 178 Sk64 getSafeSize64() const { | |
| 179 Sk64 size; | |
| 180 size.set64(this->computeSafeSize64()); | |
| 181 return size; | |
| 182 } | |
| 183 #endif | |
| 184 | |
| 185 /** Returns true if this bitmap is marked as immutable, meaning that the | 165 /** Returns true if this bitmap is marked as immutable, meaning that the |
| 186 contents of its pixels will not change for the lifetime of the bitmap. | 166 contents of its pixels will not change for the lifetime of the bitmap. |
| 187 */ | 167 */ |
| 188 bool isImmutable() const; | 168 bool isImmutable() const; |
| 189 | 169 |
| 190 /** Marks this bitmap as immutable, meaning that the contents of its | 170 /** Marks this bitmap as immutable, meaning that the contents of its |
| 191 pixels will not change for the lifetime of the bitmap and of the | 171 pixels will not change for the lifetime of the bitmap and of the |
| 192 underlying pixelref. This state can be set, but it cannot be | 172 underlying pixelref. This state can be set, but it cannot be |
| 193 cleared once it is set. This state propagates to all other bitmaps | 173 cleared once it is set. This state propagates to all other bitmaps |
| 194 that share the same pixelref. | 174 that share the same pixelref. |
| (...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 848 | 828 |
| 849 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { | 829 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { |
| 850 SkASSERT(fPixels); | 830 SkASSERT(fPixels); |
| 851 SkASSERT(fConfig == kIndex8_Config); | 831 SkASSERT(fConfig == kIndex8_Config); |
| 852 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); | 832 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); |
| 853 SkASSERT(fColorTable); | 833 SkASSERT(fColorTable); |
| 854 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; | 834 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; |
| 855 } | 835 } |
| 856 | 836 |
| 857 #endif | 837 #endif |
| OLD | NEW |