OLD | NEW |
---|---|
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2008 The Android Open Source Project | 3 * Copyright 2008 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 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
512 | 512 |
513 this->setPixelRef(pr)->unref(); | 513 this->setPixelRef(pr)->unref(); |
514 | 514 |
515 // since we're already allocated, we lockPixels right away | 515 // since we're already allocated, we lockPixels right away |
516 this->lockPixels(); | 516 this->lockPixels(); |
517 SkASSERT(this->getPixels()); | 517 SkASSERT(this->getPixels()); |
518 SkDEBUGCODE(this->validate();) | 518 SkDEBUGCODE(this->validate();) |
519 return true; | 519 return true; |
520 } | 520 } |
521 | 521 |
522 bool SkBitmap::installMaskPixels(const SkMask& mask) { | |
523 return this->installPixels(SkImageInfo::MakeA8(mask.fBounds.width(), | |
hal.canary
2014/02/17 20:11:31
You are assuming that (mask.fFormat == SkMask::kA8
| |
524 mask.fBounds.height()), | |
525 mask.fImage, mask.fRowBytes); | |
526 } | |
527 | |
522 bool SkBitmap::allocConfigPixels(Config config, int width, int height, | 528 bool SkBitmap::allocConfigPixels(Config config, int width, int height, |
523 bool isOpaque) { | 529 bool isOpaque) { |
524 SkColorType ct; | 530 SkColorType ct; |
525 if (!config_to_colorType(config, &ct)) { | 531 if (!config_to_colorType(config, &ct)) { |
526 return false; | 532 return false; |
527 } | 533 } |
528 | 534 |
529 SkAlphaType at = isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType; | 535 SkAlphaType at = isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType; |
530 return this->allocPixels(SkImageInfo::Make(width, height, ct, at)); | 536 return this->allocPixels(SkImageInfo::Make(width, height, ct, at)); |
531 } | 537 } |
(...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1705 /////////////////////////////////////////////////////////////////////////////// | 1711 /////////////////////////////////////////////////////////////////////////////// |
1706 | 1712 |
1707 #ifdef SK_DEBUG | 1713 #ifdef SK_DEBUG |
1708 void SkImageInfo::validate() const { | 1714 void SkImageInfo::validate() const { |
1709 SkASSERT(fWidth >= 0); | 1715 SkASSERT(fWidth >= 0); |
1710 SkASSERT(fHeight >= 0); | 1716 SkASSERT(fHeight >= 0); |
1711 SkASSERT(SkColorTypeIsValid(fColorType)); | 1717 SkASSERT(SkColorTypeIsValid(fColorType)); |
1712 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); | 1718 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); |
1713 } | 1719 } |
1714 #endif | 1720 #endif |
OLD | NEW |