| 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 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 } | 486 } |
| 487 | 487 |
| 488 /** | 488 /** |
| 489 * Fill the specified area of this bitmap with the specified color. | 489 * Fill the specified area of this bitmap with the specified color. |
| 490 * If the bitmap's colortype does not support alpha (e.g. 565) then the alp
ha | 490 * If the bitmap's colortype does not support alpha (e.g. 565) then the alp
ha |
| 491 * of the color is ignored (treated as opaque). If the colortype only suppo
rts | 491 * of the color is ignored (treated as opaque). If the colortype only suppo
rts |
| 492 * alpha (e.g. A1 or A8) then the color's r,g,b components are ignored. | 492 * alpha (e.g. A1 or A8) then the color's r,g,b components are ignored. |
| 493 */ | 493 */ |
| 494 void eraseArea(const SkIRect& area, SkColor c) const; | 494 void eraseArea(const SkIRect& area, SkColor c) const; |
| 495 | 495 |
| 496 /** Scroll (a subset of) the contents of this bitmap by dx/dy. If there are | |
| 497 no pixels allocated (i.e. getPixels() returns null) the method will | |
| 498 still update the inval region (if present). If the bitmap is immutable, | |
| 499 do nothing and return false. | |
| 500 | |
| 501 @param subset The subset of the bitmap to scroll/move. To scroll the | |
| 502 entire contents, specify [0, 0, width, height] or just | |
| 503 pass null. | |
| 504 @param dx The amount to scroll in X | |
| 505 @param dy The amount to scroll in Y | |
| 506 @param inval Optional (may be null). Returns the area of the bitmap that | |
| 507 was scrolled away. E.g. if dx = dy = 0, then inval would | |
| 508 be set to empty. If dx >= width or dy >= height, then | |
| 509 inval would be set to the entire bounds of the bitmap. | |
| 510 @return true if the scroll was doable. Will return false if the colortyp
e is kUnkown or | |
| 511 if the bitmap is immutable. | |
| 512 If no pixels are present (i.e. getPixels() returns false) | |
| 513 inval will still be updated, and true will be returned. | |
| 514 */ | |
| 515 bool scrollRect(const SkIRect* subset, int dx, int dy, | |
| 516 SkRegion* inval = NULL) const; | |
| 517 | |
| 518 /** | 496 /** |
| 519 * Return the SkColor of the specified pixel. In most cases this will | 497 * Return the SkColor of the specified pixel. In most cases this will |
| 520 * require un-premultiplying the color. Alpha only colortypes (e.g. kAlpha
_8_SkColorType) | 498 * require un-premultiplying the color. Alpha only colortypes (e.g. kAlpha
_8_SkColorType) |
| 521 * return black with the appropriate alpha set. The value is undefined | 499 * return black with the appropriate alpha set. The value is undefined |
| 522 * for kUnknown_SkColorType or if x or y are out of bounds, or if the bitma
p | 500 * for kUnknown_SkColorType or if x or y are out of bounds, or if the bitma
p |
| 523 * does not have any pixels (or has not be locked with lockPixels()). | 501 * does not have any pixels (or has not be locked with lockPixels()). |
| 524 */ | 502 */ |
| 525 SkColor getColor(int x, int y) const; | 503 SkColor getColor(int x, int y) const; |
| 526 | 504 |
| 527 /** Returns the address of the specified pixel. This performs a runtime | 505 /** Returns the address of the specified pixel. This performs a runtime |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 808 | 786 |
| 809 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { | 787 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { |
| 810 SkASSERT(fPixels); | 788 SkASSERT(fPixels); |
| 811 SkASSERT(kIndex_8_SkColorType == this->colorType()); | 789 SkASSERT(kIndex_8_SkColorType == this->colorType()); |
| 812 SkASSERT((unsigned)x < (unsigned)this->width() && (unsigned)y < (unsigned)th
is->height()); | 790 SkASSERT((unsigned)x < (unsigned)this->width() && (unsigned)y < (unsigned)th
is->height()); |
| 813 SkASSERT(fColorTable); | 791 SkASSERT(fColorTable); |
| 814 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; | 792 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; |
| 815 } | 793 } |
| 816 | 794 |
| 817 #endif | 795 #endif |
| OLD | NEW |