| 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 #include "SkScalerContext.h" | 10 #include "SkScalerContext.h" |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 static void packA8ToA1(const SkMask& mask, const uint8_t* src, size_t srcRB) { | 541 static void packA8ToA1(const SkMask& mask, const uint8_t* src, size_t srcRB) { |
| 542 const int height = mask.fBounds.height(); | 542 const int height = mask.fBounds.height(); |
| 543 const int width = mask.fBounds.width(); | 543 const int width = mask.fBounds.width(); |
| 544 const int octs = width >> 3; | 544 const int octs = width >> 3; |
| 545 const int leftOverBits = width & 7; | 545 const int leftOverBits = width & 7; |
| 546 | 546 |
| 547 uint8_t* dst = mask.fImage; | 547 uint8_t* dst = mask.fImage; |
| 548 const int dstPad = mask.fRowBytes - SkAlign8(width)/8; | 548 const int dstPad = mask.fRowBytes - SkAlign8(width)/8; |
| 549 SkASSERT(dstPad >= 0); | 549 SkASSERT(dstPad >= 0); |
| 550 | 550 |
| 551 const int srcPad = srcRB - width; | 551 SkASSERT(width >= 0); |
| 552 SkASSERT(srcPad >= 0); | 552 SkASSERT(srcRB >= (size_t)width); |
| 553 const size_t srcPad = srcRB - width; |
| 553 | 554 |
| 554 for (int y = 0; y < height; ++y) { | 555 for (int y = 0; y < height; ++y) { |
| 555 for (int i = 0; i < octs; ++i) { | 556 for (int i = 0; i < octs; ++i) { |
| 556 *dst++ = pack_8_to_1(src); | 557 *dst++ = pack_8_to_1(src); |
| 557 src += 8; | 558 src += 8; |
| 558 } | 559 } |
| 559 if (leftOverBits > 0) { | 560 if (leftOverBits > 0) { |
| 560 unsigned bits = 0; | 561 unsigned bits = 0; |
| 561 int shift = 7; | 562 int shift = 7; |
| 562 for (int i = 0; i < leftOverBits; ++i, --shift) { | 563 for (int i = 0; i < leftOverBits; ++i, --shift) { |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 981 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc, | 982 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc, |
| 982 bool allowFailure) const { | 983 bool allowFailure) const { |
| 983 SkScalerContext* c = this->onCreateScalerContext(desc); | 984 SkScalerContext* c = this->onCreateScalerContext(desc); |
| 984 | 985 |
| 985 if (!c && !allowFailure) { | 986 if (!c && !allowFailure) { |
| 986 c = SkNEW_ARGS(SkScalerContext_Empty, | 987 c = SkNEW_ARGS(SkScalerContext_Empty, |
| 987 (const_cast<SkTypeface*>(this), desc)); | 988 (const_cast<SkTypeface*>(this), desc)); |
| 988 } | 989 } |
| 989 return c; | 990 return c; |
| 990 } | 991 } |
| OLD | NEW |