| 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 "SkPixmap.h" |
| 14 #include "SkPoint.h" | 15 #include "SkPoint.h" |
| 15 #include "SkRefCnt.h" | 16 #include "SkRefCnt.h" |
| 16 | 17 |
| 17 struct SkMask; | 18 struct SkMask; |
| 18 struct SkIRect; | 19 struct SkIRect; |
| 19 struct SkRect; | 20 struct SkRect; |
| 20 class SkPaint; | 21 class SkPaint; |
| 21 class SkPixelRef; | 22 class SkPixelRef; |
| 22 class SkPixelRefFactory; | 23 class SkPixelRefFactory; |
| 23 class SkRegion; | 24 class SkRegion; |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 void unlockPixels() const; | 422 void unlockPixels() const; |
| 422 | 423 |
| 423 /** | 424 /** |
| 424 * Some bitmaps can return a copy of their pixels for lockPixels(), but | 425 * Some bitmaps can return a copy of their pixels for lockPixels(), but |
| 425 * that copy, if modified, will not be pushed back. These bitmaps should | 426 * that copy, if modified, will not be pushed back. These bitmaps should |
| 426 * not be used as targets for a raster device/canvas (since all pixels | 427 * not be used as targets for a raster device/canvas (since all pixels |
| 427 * modifications will be lost when unlockPixels() is called.) | 428 * modifications will be lost when unlockPixels() is called.) |
| 428 */ | 429 */ |
| 429 bool lockPixelsAreWritable() const; | 430 bool lockPixelsAreWritable() const; |
| 430 | 431 |
| 432 bool requestLock(SkAutoPixmapUnlock* result) const; |
| 433 |
| 431 /** Call this to be sure that the bitmap is valid enough to be drawn (i.e. | 434 /** Call this to be sure that the bitmap is valid enough to be drawn (i.e. |
| 432 it has non-null pixels, and if required by its colortype, it has a | 435 it has non-null pixels, and if required by its colortype, it has a |
| 433 non-null colortable. Returns true if all of the above are met. | 436 non-null colortable. Returns true if all of the above are met. |
| 434 */ | 437 */ |
| 435 bool readyToDraw() const { | 438 bool readyToDraw() const { |
| 436 return this->getPixels() != NULL && | 439 return this->getPixels() != NULL && |
| 437 (this->colorType() != kIndex_8_SkColorType || fColorTable); | 440 (this->colorType() != kIndex_8_SkColorType || fColorTable); |
| 438 } | 441 } |
| 439 | 442 |
| 440 /** Returns the pixelRef's texture, or NULL | 443 /** Returns the pixelRef's texture, or NULL |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 | 789 |
| 787 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { | 790 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { |
| 788 SkASSERT(fPixels); | 791 SkASSERT(fPixels); |
| 789 SkASSERT(kIndex_8_SkColorType == this->colorType()); | 792 SkASSERT(kIndex_8_SkColorType == this->colorType()); |
| 790 SkASSERT((unsigned)x < (unsigned)this->width() && (unsigned)y < (unsigned)th
is->height()); | 793 SkASSERT((unsigned)x < (unsigned)this->width() && (unsigned)y < (unsigned)th
is->height()); |
| 791 SkASSERT(fColorTable); | 794 SkASSERT(fColorTable); |
| 792 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; | 795 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; |
| 793 } | 796 } |
| 794 | 797 |
| 795 #endif | 798 #endif |
| OLD | NEW |