Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/ports/SkFontHost_FreeType_common.cpp

Issue 892453002: neon code for bgra to rgba conversion for copyFTBitmap Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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) && !defined(S K_CPU_BENDIAN)
233 if (sk_cpu_arm_has_neon())
234 {
reed1 2015/01/29 15:47:20 SkPMColor (which is the desired output swizzle) ca
frederic.ma 2015/01/29 18:33:09 My bad. I added compile flag to handle SkPMColor f
235 BGRA2RGBA_Neon(src, dst, height, width, dstRowBytes, srcPitch);
236 return;
237 }
238 #endif
229 // FT_PIXEL_MODE_BGRA is pre-multiplied. 239 // FT_PIXEL_MODE_BGRA is pre-multiplied.
230 for (size_t y = height; y --> 0;) { 240 for (size_t y = height; y --> 0;) {
231 const uint8_t* src_row = src; 241 const uint8_t* src_row = src;
232 SkPMColor* dst_row = reinterpret_cast<SkPMColor*>(dst); 242 SkPMColor* dst_row = reinterpret_cast<SkPMColor*>(dst);
233 for (size_t x = 0; x < width; ++x) { 243 for (size_t x = 0; x < width; ++x) {
234 uint8_t b = *src_row++; 244 uint8_t b = *src_row++;
235 uint8_t g = *src_row++; 245 uint8_t g = *src_row++;
236 uint8_t r = *src_row++; 246 uint8_t r = *src_row++;
237 uint8_t a = *src_row++; 247 uint8_t a = *src_row++;
238 *dst_row++ = SkPackARGB32(a, r, g, b); 248 *dst_row++ = SkPackARGB32(a, r, g, b);
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 566
557 FT_Error err = FT_Outline_Decompose(&face->glyph->outline, &funcs, path); 567 FT_Error err = FT_Outline_Decompose(&face->glyph->outline, &funcs, path);
558 568
559 if (err != 0) { 569 if (err != 0) {
560 path->reset(); 570 path->reset();
561 return; 571 return;
562 } 572 }
563 573
564 path->close(); 574 path->close();
565 } 575 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698