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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 | 345 |
346 if (ir.isEmpty() || !ir.is16Bit()) { | 346 if (ir.isEmpty() || !ir.is16Bit()) { |
347 goto SK_ERROR; | 347 goto SK_ERROR; |
348 } | 348 } |
349 glyph->fLeft = ir.fLeft; | 349 glyph->fLeft = ir.fLeft; |
350 glyph->fTop = ir.fTop; | 350 glyph->fTop = ir.fTop; |
351 glyph->fWidth = SkToU16(ir.width()); | 351 glyph->fWidth = SkToU16(ir.width()); |
352 glyph->fHeight = SkToU16(ir.height()); | 352 glyph->fHeight = SkToU16(ir.height()); |
353 | 353 |
354 if (glyph->fWidth > 0) { | 354 if (glyph->fWidth > 0) { |
355 switch (fRec.fMaskFormat) { | 355 switch (fRec.fMaskFormat) { |
356 case SkMask::kLCD16_Format: | 356 case SkMask::kLCD16_Format: |
357 case SkMask::kLCD32_Format: | 357 case SkMask::kLCD32_Format: |
358 glyph->fWidth += 2; | 358 glyph->fWidth += 2; |
359 glyph->fLeft -= 1; | 359 glyph->fLeft -= 1; |
360 break; | 360 break; |
361 default: | 361 default: |
362 break; | 362 break; |
| 363 } |
363 } | 364 } |
364 } | |
365 } | 365 } |
366 } | 366 } |
367 | 367 |
368 if (SkMask::kARGB32_Format != glyph->fMaskFormat) { | 368 if (SkMask::kARGB32_Format != glyph->fMaskFormat) { |
369 glyph->fMaskFormat = fRec.fMaskFormat; | 369 glyph->fMaskFormat = fRec.fMaskFormat; |
370 } | 370 } |
371 | 371 |
372 // If we are going to create the mask, then we cannot keep the color | 372 // If we are going to create the mask, then we cannot keep the color |
373 if ((fGenerateImageFromPath || fMaskFilter) && | 373 if ((fGenerateImageFromPath || fMaskFilter) && |
374 SkMask::kARGB32_Format == glyph->fMaskFormat) { | 374 SkMask::kARGB32_Format == glyph->fMaskFormat) { |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
980 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc, | 980 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc, |
981 bool allowFailure) const { | 981 bool allowFailure) const { |
982 SkScalerContext* c = this->onCreateScalerContext(desc); | 982 SkScalerContext* c = this->onCreateScalerContext(desc); |
983 | 983 |
984 if (!c && !allowFailure) { | 984 if (!c && !allowFailure) { |
985 c = SkNEW_ARGS(SkScalerContext_Empty, | 985 c = SkNEW_ARGS(SkScalerContext_Empty, |
986 (const_cast<SkTypeface*>(this), desc)); | 986 (const_cast<SkTypeface*>(this), desc)); |
987 } | 987 } |
988 return c; | 988 return c; |
989 } | 989 } |
OLD | NEW |