| 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 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 ~SkAutoLockPixels() { | 723 ~SkAutoLockPixels() { |
| 724 if (fDidLock) { | 724 if (fDidLock) { |
| 725 fBitmap.unlockPixels(); | 725 fBitmap.unlockPixels(); |
| 726 } | 726 } |
| 727 } | 727 } |
| 728 | 728 |
| 729 private: | 729 private: |
| 730 const SkBitmap& fBitmap; | 730 const SkBitmap& fBitmap; |
| 731 bool fDidLock; | 731 bool fDidLock; |
| 732 }; | 732 }; |
| 733 #define SkAutoLockPixels(...) SK_REQUIRE_LOCAL_VAR(SkAutoLockPixels) | 733 //TODO(mtklein): uncomment when 71713004 lands and Chromium's fixed. |
| 734 //#define SkAutoLockPixels(...) SK_REQUIRE_LOCAL_VAR(SkAutoLockPixels) |
| 734 | 735 |
| 735 /** Helper class that performs the lock/unlockColors calls on a colortable. | 736 /** Helper class that performs the lock/unlockColors calls on a colortable. |
| 736 The destructor will call unlockColors(false) if it has a bitmap's colortable | 737 The destructor will call unlockColors(false) if it has a bitmap's colortable |
| 737 */ | 738 */ |
| 738 class SkAutoLockColors : public SkNoncopyable { | 739 class SkAutoLockColors : public SkNoncopyable { |
| 739 public: | 740 public: |
| 740 /** Initialize with no bitmap. Call lockColors(bitmap) to lock bitmap's | 741 /** Initialize with no bitmap. Call lockColors(bitmap) to lock bitmap's |
| 741 colortable | 742 colortable |
| 742 */ | 743 */ |
| 743 SkAutoLockColors() : fCTable(NULL), fColors(NULL) {} | 744 SkAutoLockColors() : fCTable(NULL), fColors(NULL) {} |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 | 820 |
| 820 // returns the address of the byte that contains the x coordinate | 821 // returns the address of the byte that contains the x coordinate |
| 821 inline uint8_t* SkBitmap::getAddr1(int x, int y) const { | 822 inline uint8_t* SkBitmap::getAddr1(int x, int y) const { |
| 822 SkASSERT(fPixels); | 823 SkASSERT(fPixels); |
| 823 SkASSERT(fConfig == kA1_Config); | 824 SkASSERT(fConfig == kA1_Config); |
| 824 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); | 825 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); |
| 825 return (uint8_t*)fPixels + y * fRowBytes + (x >> 3); | 826 return (uint8_t*)fPixels + y * fRowBytes + (x >> 3); |
| 826 } | 827 } |
| 827 | 828 |
| 828 #endif | 829 #endif |
| OLD | NEW |