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 |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 * modifications will be lost when unlockPixels() is called.) | 437 * modifications will be lost when unlockPixels() is called.) |
438 */ | 438 */ |
439 bool lockPixelsAreWritable() const; | 439 bool lockPixelsAreWritable() const; |
440 | 440 |
441 /** Call this to be sure that the bitmap is valid enough to be drawn (i.e. | 441 /** Call this to be sure that the bitmap is valid enough to be drawn (i.e. |
442 it has non-null pixels, and if required by its colortype, it has a | 442 it has non-null pixels, and if required by its colortype, it has a |
443 non-null colortable. Returns true if all of the above are met. | 443 non-null colortable. Returns true if all of the above are met. |
444 */ | 444 */ |
445 bool readyToDraw() const { | 445 bool readyToDraw() const { |
446 return this->getPixels() != NULL && | 446 return this->getPixels() != NULL && |
447 (this->colorType() != kIndex_8_SkColorType || NULL != fColorTable
); | 447 (this->colorType() != kIndex_8_SkColorType || fColorTable); |
448 } | 448 } |
449 | 449 |
450 /** Returns the pixelRef's texture, or NULL | 450 /** Returns the pixelRef's texture, or NULL |
451 */ | 451 */ |
452 GrTexture* getTexture() const; | 452 GrTexture* getTexture() const; |
453 | 453 |
454 /** Return the bitmap's colortable, if it uses one (i.e. colorType is | 454 /** Return the bitmap's colortable, if it uses one (i.e. colorType is |
455 Index_8) and the pixels are locked. | 455 Index_8) and the pixels are locked. |
456 Otherwise returns NULL. Does not affect the colortable's | 456 Otherwise returns NULL. Does not affect the colortable's |
457 reference count. | 457 reference count. |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 | 874 |
875 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { | 875 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { |
876 SkASSERT(fPixels); | 876 SkASSERT(fPixels); |
877 SkASSERT(kIndex_8_SkColorType == this->colorType()); | 877 SkASSERT(kIndex_8_SkColorType == this->colorType()); |
878 SkASSERT((unsigned)x < (unsigned)this->width() && (unsigned)y < (unsigned)th
is->height()); | 878 SkASSERT((unsigned)x < (unsigned)this->width() && (unsigned)y < (unsigned)th
is->height()); |
879 SkASSERT(fColorTable); | 879 SkASSERT(fColorTable); |
880 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; | 880 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; |
881 } | 881 } |
882 | 882 |
883 #endif | 883 #endif |
OLD | NEW |