| 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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 their is no pixelRef then zero is returned. | 379 their is no pixelRef then zero is returned. |
| 380 */ | 380 */ |
| 381 uint32_t getGenerationID() const; | 381 uint32_t getGenerationID() const; |
| 382 | 382 |
| 383 /** Call this if you have changed the contents of the pixels. This will in- | 383 /** Call this if you have changed the contents of the pixels. This will in- |
| 384 turn cause a different generation ID value to be returned from | 384 turn cause a different generation ID value to be returned from |
| 385 getGenerationID(). | 385 getGenerationID(). |
| 386 */ | 386 */ |
| 387 void notifyPixelsChanged() const; | 387 void notifyPixelsChanged() const; |
| 388 | 388 |
| 389 /** Initialize the bitmap's pixels with the specified color+alpha, automatic
ally converting into the correct format | 389 /** |
| 390 for the bitmap's config. If the config is kRGB_565_Config, then the alph
a value is ignored. | 390 * Fill the entire bitmap with the specified color. |
| 391 If the config is kA8_Config, then the r,g,b parameters are ignored. | 391 * If the bitmap's config does not support alpha (e.g. 565) then the alpha |
| 392 */ | 392 * of the color is ignored (treated as opaque). If the config only supports |
| 393 void eraseARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b) const; | 393 * alpha (e.g. A1 or A8) then the color's r,g,b components are ignored. |
| 394 /** Initialize the bitmap's pixels with the specified color+alpha, automatic
ally converting into the correct format | 394 */ |
| 395 for the bitmap's config. If the config is kRGB_565_Config, then the alph
a value is presumed | |
| 396 to be 0xFF. If the config is kA8_Config, then the r,g,b parameters are i
gnored and the | |
| 397 pixels are all set to 0xFF. | |
| 398 */ | |
| 399 void eraseRGB(U8CPU r, U8CPU g, U8CPU b) const { | |
| 400 this->eraseARGB(0xFF, r, g, b); | |
| 401 } | |
| 402 /** Initialize the bitmap's pixels with the specified color, automatically c
onverting into the correct format | |
| 403 for the bitmap's config. If the config is kRGB_565_Config, then the colo
r's alpha value is presumed | |
| 404 to be 0xFF. If the config is kA8_Config, then only the color's alpha val
ue is used. | |
| 405 */ | |
| 406 void eraseColor(SkColor c) const { | 395 void eraseColor(SkColor c) const { |
| 407 this->eraseARGB(SkColorGetA(c), SkColorGetR(c), SkColorGetG(c), | 396 this->eraseARGB(SkColorGetA(c), SkColorGetR(c), SkColorGetG(c), |
| 408 SkColorGetB(c)); | 397 SkColorGetB(c)); |
| 409 } | 398 } |
| 410 | 399 |
| 400 /** |
| 401 * Fill the entire bitmap with the specified color. |
| 402 * If the bitmap's config does not support alpha (e.g. 565) then the alpha |
| 403 * of the color is ignored (treated as opaque). If the config only supports |
| 404 * alpha (e.g. A1 or A8) then the color's r,g,b components are ignored. |
| 405 */ |
| 406 void eraseARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b) const; |
| 407 |
| 408 // DEPRECATED -- call eraseColor or eraseARGB |
| 409 void eraseRGB(U8CPU r, U8CPU g, U8CPU b) const { |
| 410 this->eraseARGB(0xFF, r, g, b); |
| 411 } |
| 412 |
| 413 /** |
| 414 * Fill the specified area of this bitmap with the specified color. |
| 415 * If the bitmap's config does not support alpha (e.g. 565) then the alpha |
| 416 * of the color is ignored (treated as opaque). If the config only supports |
| 417 * alpha (e.g. A1 or A8) then the color's r,g,b components are ignored. |
| 418 */ |
| 419 void eraseArea(const SkIRect& area, SkColor c) const; |
| 420 |
| 411 /** Scroll (a subset of) the contents of this bitmap by dx/dy. If there are | 421 /** Scroll (a subset of) the contents of this bitmap by dx/dy. If there are |
| 412 no pixels allocated (i.e. getPixels() returns null) the method will | 422 no pixels allocated (i.e. getPixels() returns null) the method will |
| 413 still update the inval region (if present). If the bitmap is immutable, | 423 still update the inval region (if present). If the bitmap is immutable, |
| 414 do nothing and return false. | 424 do nothing and return false. |
| 415 | 425 |
| 416 @param subset The subset of the bitmap to scroll/move. To scroll the | 426 @param subset The subset of the bitmap to scroll/move. To scroll the |
| 417 entire contents, specify [0, 0, width, height] or just | 427 entire contents, specify [0, 0, width, height] or just |
| 418 pass null. | 428 pass null. |
| 419 @param dx The amount to scroll in X | 429 @param dx The amount to scroll in X |
| 420 @param dy The amount to scroll in Y | 430 @param dy The amount to scroll in Y |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 #endif | 668 #endif |
| 659 }; | 669 }; |
| 660 | 670 |
| 661 uint32_t fRowBytes; | 671 uint32_t fRowBytes; |
| 662 uint32_t fWidth; | 672 uint32_t fWidth; |
| 663 uint32_t fHeight; | 673 uint32_t fHeight; |
| 664 uint8_t fConfig; | 674 uint8_t fConfig; |
| 665 uint8_t fFlags; | 675 uint8_t fFlags; |
| 666 uint8_t fBytesPerPixel; // based on config | 676 uint8_t fBytesPerPixel; // based on config |
| 667 | 677 |
| 678 void internalErase(const SkIRect&, U8CPU a, U8CPU r, U8CPU g, U8CPU b)const; |
| 679 |
| 668 /* Internal computations for safe size. | 680 /* Internal computations for safe size. |
| 669 */ | 681 */ |
| 670 static Sk64 ComputeSafeSize64(Config config, | 682 static Sk64 ComputeSafeSize64(Config config, |
| 671 uint32_t width, | 683 uint32_t width, |
| 672 uint32_t height, | 684 uint32_t height, |
| 673 size_t rowBytes); | 685 size_t rowBytes); |
| 674 static size_t ComputeSafeSize(Config config, | 686 static size_t ComputeSafeSize(Config config, |
| 675 uint32_t width, | 687 uint32_t width, |
| 676 uint32_t height, | 688 uint32_t height, |
| 677 size_t rowBytes); | 689 size_t rowBytes); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 799 | 811 |
| 800 // returns the address of the byte that contains the x coordinate | 812 // returns the address of the byte that contains the x coordinate |
| 801 inline uint8_t* SkBitmap::getAddr1(int x, int y) const { | 813 inline uint8_t* SkBitmap::getAddr1(int x, int y) const { |
| 802 SkASSERT(fPixels); | 814 SkASSERT(fPixels); |
| 803 SkASSERT(fConfig == kA1_Config); | 815 SkASSERT(fConfig == kA1_Config); |
| 804 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); | 816 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); |
| 805 return (uint8_t*)fPixels + y * fRowBytes + (x >> 3); | 817 return (uint8_t*)fPixels + y * fRowBytes + (x >> 3); |
| 806 } | 818 } |
| 807 | 819 |
| 808 #endif | 820 #endif |
| OLD | NEW |