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" |
11 #include "SkColor.h" | 11 #include "SkColor.h" |
12 #include "SkColorPriv.h" | 12 #include "SkColorPriv.h" |
13 #include "SkFDot6.h" | 13 #include "SkFDot6.h" |
14 #include "SkFontHost_FreeType_common.h" | 14 #include "SkFontHost_FreeType_common.h" |
15 #include "SkPath.h" | 15 #include "SkPath.h" |
16 | 16 |
| 17 #include "SkUtilsArm.h" |
| 18 #include "SkFontHost_FreeType_common_opts_neon.h" |
| 19 |
17 #include <ft2build.h> | 20 #include <ft2build.h> |
18 #include FT_FREETYPE_H | 21 #include FT_FREETYPE_H |
19 #include FT_BITMAP_H | 22 #include FT_BITMAP_H |
20 #include FT_IMAGE_H | 23 #include FT_IMAGE_H |
21 #include FT_OUTLINE_H | 24 #include FT_OUTLINE_H |
22 // In the past, FT_GlyphSlot_Own_Bitmap was defined in this header file. | 25 // In the past, FT_GlyphSlot_Own_Bitmap was defined in this header file. |
23 #include FT_SYNTHESIS_H | 26 #include FT_SYNTHESIS_H |
24 | 27 |
25 // FT_LOAD_COLOR and the corresponding FT_Pixel_Mode::FT_PIXEL_MODE_BGRA | 28 // FT_LOAD_COLOR and the corresponding FT_Pixel_Mode::FT_PIXEL_MODE_BGRA |
26 // were introduced in FreeType 2.5.0. | 29 // were introduced in FreeType 2.5.0. |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 bits = 8; | 222 bits = 8; |
220 } | 223 } |
221 *dst_row++ = byte & 0x80 ? 0xff : 0x00; | 224 *dst_row++ = byte & 0x80 ? 0xff : 0x00; |
222 bits--; | 225 bits--; |
223 byte <<= 1; | 226 byte <<= 1; |
224 } | 227 } |
225 src += srcPitch; | 228 src += srcPitch; |
226 dst += dstRowBytes; | 229 dst += dstRowBytes; |
227 } | 230 } |
228 } else if (FT_PIXEL_MODE_BGRA == srcFormat && SkMask::kARGB32_Format == dstF
ormat) { | 231 } else if (FT_PIXEL_MODE_BGRA == srcFormat && SkMask::kARGB32_Format == dstF
ormat) { |
| 232 #if !defined(SK_CPU_ARM64) && !defined(SK_SHOW_TEXT_BLIT_COVERAGE) |
| 233 if (sk_cpu_arm_has_neon()) { |
| 234 SkPackARGB32_neon(reinterpret_cast<const uint32_t*>(src), |
| 235 reinterpret_cast<SkPMColor*>(dst), height, width,
dstRowBytes, |
| 236 srcPitch); |
| 237 return; |
| 238 } |
| 239 #endif |
229 // FT_PIXEL_MODE_BGRA is pre-multiplied. | 240 // FT_PIXEL_MODE_BGRA is pre-multiplied. |
230 for (size_t y = height; y --> 0;) { | 241 for (size_t y = height; y --> 0;) { |
231 const uint8_t* src_row = src; | 242 const uint8_t* src_row = src; |
232 SkPMColor* dst_row = reinterpret_cast<SkPMColor*>(dst); | 243 SkPMColor* dst_row = reinterpret_cast<SkPMColor*>(dst); |
233 for (size_t x = 0; x < width; ++x) { | 244 for (size_t x = 0; x < width; ++x) { |
234 uint8_t b = *src_row++; | 245 uint8_t b = *src_row++; |
235 uint8_t g = *src_row++; | 246 uint8_t g = *src_row++; |
236 uint8_t r = *src_row++; | 247 uint8_t r = *src_row++; |
237 uint8_t a = *src_row++; | 248 uint8_t a = *src_row++; |
238 *dst_row++ = SkPackARGB32(a, r, g, b); | 249 *dst_row++ = SkPackARGB32(a, r, g, b); |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 | 567 |
557 FT_Error err = FT_Outline_Decompose(&face->glyph->outline, &funcs, path); | 568 FT_Error err = FT_Outline_Decompose(&face->glyph->outline, &funcs, path); |
558 | 569 |
559 if (err != 0) { | 570 if (err != 0) { |
560 path->reset(); | 571 path->reset(); |
561 return; | 572 return; |
562 } | 573 } |
563 | 574 |
564 path->close(); | 575 path->close(); |
565 } | 576 } |
OLD | NEW |