OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006-2012 The Android Open Source Project | 2 * Copyright 2006-2012 The Android Open Source Project |
3 * Copyright 2012 Mozilla Foundation | 3 * Copyright 2012 Mozilla Foundation |
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 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 } else { | 456 } else { |
457 dstBitmap.setPixels(glyph.fImage); | 457 dstBitmap.setPixels(glyph.fImage); |
458 } | 458 } |
459 | 459 |
460 // Scale unscaledBitmap into dstBitmap. | 460 // Scale unscaledBitmap into dstBitmap. |
461 SkCanvas canvas(dstBitmap); | 461 SkCanvas canvas(dstBitmap); |
462 canvas.clear(SK_ColorTRANSPARENT); | 462 canvas.clear(SK_ColorTRANSPARENT); |
463 canvas.scale(SkIntToScalar(glyph.fWidth) / SkIntToScalar(face->glyph
->bitmap.width), | 463 canvas.scale(SkIntToScalar(glyph.fWidth) / SkIntToScalar(face->glyph
->bitmap.width), |
464 SkIntToScalar(glyph.fHeight) / SkIntToScalar(face->glyp
h->bitmap.rows)); | 464 SkIntToScalar(glyph.fHeight) / SkIntToScalar(face->glyp
h->bitmap.rows)); |
465 SkPaint paint; | 465 SkPaint paint; |
466 paint.setFilterLevel(SkPaint::kMedium_FilterLevel); | 466 paint.setFilterQuality(kMedium_SkFilterQuality); |
467 canvas.drawBitmap(unscaledBitmap, 0, 0, &paint); | 467 canvas.drawBitmap(unscaledBitmap, 0, 0, &paint); |
468 | 468 |
469 // If the destination is BW or LCD, convert from A8. | 469 // If the destination is BW or LCD, convert from A8. |
470 if (SkMask::kBW_Format == maskFormat) { | 470 if (SkMask::kBW_Format == maskFormat) { |
471 // Copy the A8 dstBitmap into the A1 glyph.fImage. | 471 // Copy the A8 dstBitmap into the A1 glyph.fImage. |
472 SkMask dstMask; | 472 SkMask dstMask; |
473 glyph.toMask(&dstMask); | 473 glyph.toMask(&dstMask); |
474 packA8ToA1(dstMask, dstBitmap.getAddr8(0, 0), dstBitmap.rowBytes
()); | 474 packA8ToA1(dstMask, dstBitmap.getAddr8(0, 0), dstBitmap.rowBytes
()); |
475 } else if (SkMask::kLCD16_Format == maskFormat) { | 475 } else if (SkMask::kLCD16_Format == maskFormat) { |
476 // Copy the A8 dstBitmap into the LCD16 glyph.fImage. | 476 // Copy the A8 dstBitmap into the LCD16 glyph.fImage. |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 | 556 |
557 FT_Error err = FT_Outline_Decompose(&face->glyph->outline, &funcs, path); | 557 FT_Error err = FT_Outline_Decompose(&face->glyph->outline, &funcs, path); |
558 | 558 |
559 if (err != 0) { | 559 if (err != 0) { |
560 path->reset(); | 560 path->reset(); |
561 return; | 561 return; |
562 } | 562 } |
563 | 563 |
564 path->close(); | 564 path->close(); |
565 } | 565 } |
OLD | NEW |