| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #ifndef SkBitmap_DEFINED | 10 #ifndef SkBitmap_DEFINED |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 that share the same pixelref. | 182 that share the same pixelref. |
| 183 */ | 183 */ |
| 184 void setImmutable(); | 184 void setImmutable(); |
| 185 | 185 |
| 186 /** Returns true if the bitmap is opaque (has no translucent/transparent pix
els). | 186 /** Returns true if the bitmap is opaque (has no translucent/transparent pix
els). |
| 187 */ | 187 */ |
| 188 bool isOpaque() const { | 188 bool isOpaque() const { |
| 189 return SkAlphaTypeIsOpaque(this->alphaType()); | 189 return SkAlphaTypeIsOpaque(this->alphaType()); |
| 190 } | 190 } |
| 191 | 191 |
| 192 SK_ATTR_DEPRECATED("use setAlphaType") | |
| 193 void setIsOpaque(bool opaque) { | |
| 194 this->setAlphaType(opaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType); | |
| 195 } | |
| 196 | |
| 197 /** Returns true if the bitmap is volatile (i.e. should not be cached by dev
ices.) | 192 /** Returns true if the bitmap is volatile (i.e. should not be cached by dev
ices.) |
| 198 */ | 193 */ |
| 199 bool isVolatile() const; | 194 bool isVolatile() const; |
| 200 | 195 |
| 201 /** Specify whether this bitmap is volatile. Bitmaps are not volatile by | 196 /** Specify whether this bitmap is volatile. Bitmaps are not volatile by |
| 202 default. Temporary bitmaps that are discarded after use should be | 197 default. Temporary bitmaps that are discarded after use should be |
| 203 marked as volatile. This provides a hint to the device that the bitmap | 198 marked as volatile. This provides a hint to the device that the bitmap |
| 204 should not be cached. Providing this hint when appropriate can | 199 should not be cached. Providing this hint when appropriate can |
| 205 improve performance by avoiding unnecessary overhead and resource | 200 improve performance by avoiding unnecessary overhead and resource |
| 206 consumption on the device. | 201 consumption on the device. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 231 | 226 |
| 232 static Sk64 ComputeSize64(Config, int width, int height); | 227 static Sk64 ComputeSize64(Config, int width, int height); |
| 233 static size_t ComputeSize(Config, int width, int height); | 228 static size_t ComputeSize(Config, int width, int height); |
| 234 | 229 |
| 235 /** | 230 /** |
| 236 * This will brute-force return true if all of the pixels in the bitmap | 231 * This will brute-force return true if all of the pixels in the bitmap |
| 237 * are opaque. If it fails to read the pixels, or encounters an error, | 232 * are opaque. If it fails to read the pixels, or encounters an error, |
| 238 * it will return false. | 233 * it will return false. |
| 239 * | 234 * |
| 240 * Since this can be an expensive operation, the bitmap stores a flag for | 235 * Since this can be an expensive operation, the bitmap stores a flag for |
| 241 * this (isOpaque, setIsOpaque). Only call this if you need to compute this | 236 * this (isOpaque). Only call this if you need to compute this value from |
| 242 * value from "unknown" pixels. | 237 * "unknown" pixels. |
| 243 */ | 238 */ |
| 244 static bool ComputeIsOpaque(const SkBitmap&); | 239 static bool ComputeIsOpaque(const SkBitmap&); |
| 245 | 240 |
| 246 /** | 241 /** |
| 247 * Return the bitmap's bounds [0, 0, width, height] as an SkRect | 242 * Return the bitmap's bounds [0, 0, width, height] as an SkRect |
| 248 */ | 243 */ |
| 249 void getBounds(SkRect* bounds) const; | 244 void getBounds(SkRect* bounds) const; |
| 250 void getBounds(SkIRect* bounds) const; | 245 void getBounds(SkIRect* bounds) const; |
| 251 | 246 |
| 252 /** Set the bitmap's config and dimensions. If rowBytes is 0, then | 247 /** Set the bitmap's config and dimensions. If rowBytes is 0, then |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 823 | 818 |
| 824 // returns the address of the byte that contains the x coordinate | 819 // returns the address of the byte that contains the x coordinate |
| 825 inline uint8_t* SkBitmap::getAddr1(int x, int y) const { | 820 inline uint8_t* SkBitmap::getAddr1(int x, int y) const { |
| 826 SkASSERT(fPixels); | 821 SkASSERT(fPixels); |
| 827 SkASSERT(fConfig == kA1_Config); | 822 SkASSERT(fConfig == kA1_Config); |
| 828 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); | 823 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); |
| 829 return (uint8_t*)fPixels + y * fRowBytes + (x >> 3); | 824 return (uint8_t*)fPixels + y * fRowBytes + (x >> 3); |
| 830 } | 825 } |
| 831 | 826 |
| 832 #endif | 827 #endif |
| OLD | NEW |