| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2008 The Android Open Source Project | 2 * Copyright 2008 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 #include "SkAtomics.h" | 8 #include "SkAtomics.h" |
| 9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
| 10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 } | 528 } |
| 529 | 529 |
| 530 void* SkBitmap::getAddr(int x, int y) const { | 530 void* SkBitmap::getAddr(int x, int y) const { |
| 531 SkASSERT((unsigned)x < (unsigned)this->width()); | 531 SkASSERT((unsigned)x < (unsigned)this->width()); |
| 532 SkASSERT((unsigned)y < (unsigned)this->height()); | 532 SkASSERT((unsigned)y < (unsigned)this->height()); |
| 533 | 533 |
| 534 char* base = (char*)this->getPixels(); | 534 char* base = (char*)this->getPixels(); |
| 535 if (base) { | 535 if (base) { |
| 536 base += y * this->rowBytes(); | 536 base += y * this->rowBytes(); |
| 537 switch (this->colorType()) { | 537 switch (this->colorType()) { |
| 538 case kRGBA_F16_SkColorType: |
| 539 base += x << 3; |
| 540 break; |
| 538 case kRGBA_8888_SkColorType: | 541 case kRGBA_8888_SkColorType: |
| 539 case kBGRA_8888_SkColorType: | 542 case kBGRA_8888_SkColorType: |
| 540 base += x << 2; | 543 base += x << 2; |
| 541 break; | 544 break; |
| 542 case kARGB_4444_SkColorType: | 545 case kARGB_4444_SkColorType: |
| 543 case kRGB_565_SkColorType: | 546 case kRGB_565_SkColorType: |
| 544 base += x << 1; | 547 base += x << 1; |
| 545 break; | 548 break; |
| 546 case kAlpha_8_SkColorType: | 549 case kAlpha_8_SkColorType: |
| 547 case kIndex_8_SkColorType: | 550 case kIndex_8_SkColorType: |
| (...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1299 /////////////////////////////////////////////////////////////////////////////// | 1302 /////////////////////////////////////////////////////////////////////////////// |
| 1300 | 1303 |
| 1301 #ifdef SK_DEBUG | 1304 #ifdef SK_DEBUG |
| 1302 void SkImageInfo::validate() const { | 1305 void SkImageInfo::validate() const { |
| 1303 SkASSERT(fWidth >= 0); | 1306 SkASSERT(fWidth >= 0); |
| 1304 SkASSERT(fHeight >= 0); | 1307 SkASSERT(fHeight >= 0); |
| 1305 SkASSERT(SkColorTypeIsValid(fColorType)); | 1308 SkASSERT(SkColorTypeIsValid(fColorType)); |
| 1306 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); | 1309 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); |
| 1307 } | 1310 } |
| 1308 #endif | 1311 #endif |
| OLD | NEW |