| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "core/include/fxge/fx_ge.h" | 7 #include "core/include/fxge/fx_ge.h" |
| 8 #include "core/include/fxge/fx_freetype.h" | 8 #include "core/include/fxge/fx_freetype.h" |
| 9 #include "core/include/fxcodec/fx_codec.h" | 9 #include "core/include/fxcodec/fx_codec.h" |
| 10 #include "text_int.h" | 10 #include "text_int.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 FX_RECT FXGE_GetGlyphsBBox(FXTEXT_GLYPHPOS* pGlyphAndPos, | 44 FX_RECT FXGE_GetGlyphsBBox(FXTEXT_GLYPHPOS* pGlyphAndPos, |
| 45 int nChars, | 45 int nChars, |
| 46 int anti_alias, | 46 int anti_alias, |
| 47 FX_FLOAT retinaScaleX, | 47 FX_FLOAT retinaScaleX, |
| 48 FX_FLOAT retinaScaleY) { | 48 FX_FLOAT retinaScaleY) { |
| 49 FX_RECT rect(0, 0, 0, 0); | 49 FX_RECT rect(0, 0, 0, 0); |
| 50 FX_BOOL bStarted = FALSE; | 50 FX_BOOL bStarted = FALSE; |
| 51 for (int iChar = 0; iChar < nChars; iChar++) { | 51 for (int iChar = 0; iChar < nChars; iChar++) { |
| 52 FXTEXT_GLYPHPOS& glyph = pGlyphAndPos[iChar]; | 52 FXTEXT_GLYPHPOS& glyph = pGlyphAndPos[iChar]; |
| 53 const CFX_GlyphBitmap* pGlyph = glyph.m_pGlyph; | 53 const CFX_GlyphBitmap* pGlyph = glyph.m_pGlyph; |
| 54 if (pGlyph == NULL) { | 54 if (!pGlyph) { |
| 55 continue; | 55 continue; |
| 56 } | 56 } |
| 57 int char_left = glyph.m_OriginX + pGlyph->m_Left; | 57 int char_left = glyph.m_OriginX + pGlyph->m_Left; |
| 58 int char_width = (int)(pGlyph->m_Bitmap.GetWidth() / retinaScaleX); | 58 int char_width = (int)(pGlyph->m_Bitmap.GetWidth() / retinaScaleX); |
| 59 if (anti_alias == FXFT_RENDER_MODE_LCD) { | 59 if (anti_alias == FXFT_RENDER_MODE_LCD) { |
| 60 char_width /= 3; | 60 char_width /= 3; |
| 61 } | 61 } |
| 62 int char_right = char_left + char_width; | 62 int char_right = char_left + char_width; |
| 63 int char_top = glyph.m_OriginY - pGlyph->m_Top; | 63 int char_top = glyph.m_OriginY - pGlyph->m_Top; |
| 64 int char_bottom = | 64 int char_bottom = |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 228, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 239, 240, | 134 228, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 239, 240, |
| 135 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 250, 251, 252, 253, 254, | 135 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 250, 251, 252, 253, 254, |
| 136 255, | 136 255, |
| 137 }; | 137 }; |
| 138 #define ADJUST_ALPHA(background, foreground, src_alpha, text_flags, a) \ | 138 #define ADJUST_ALPHA(background, foreground, src_alpha, text_flags, a) \ |
| 139 src_alpha = g_TextGammaAdjust[(uint8_t)src_alpha]; | 139 src_alpha = g_TextGammaAdjust[(uint8_t)src_alpha]; |
| 140 void _Color2Argb(FX_ARGB& argb, | 140 void _Color2Argb(FX_ARGB& argb, |
| 141 FX_DWORD color, | 141 FX_DWORD color, |
| 142 int alpha_flag, | 142 int alpha_flag, |
| 143 void* pIccTransform) { | 143 void* pIccTransform) { |
| 144 if (pIccTransform == NULL && !FXGETFLAG_COLORTYPE(alpha_flag)) { | 144 if (!pIccTransform && !FXGETFLAG_COLORTYPE(alpha_flag)) { |
| 145 argb = color; | 145 argb = color; |
| 146 return; | 146 return; |
| 147 } | 147 } |
| 148 if (!CFX_GEModule::Get()->GetCodecModule() || | 148 if (!CFX_GEModule::Get()->GetCodecModule() || |
| 149 !CFX_GEModule::Get()->GetCodecModule()->GetIccModule()) { | 149 !CFX_GEModule::Get()->GetCodecModule()->GetIccModule()) { |
| 150 pIccTransform = NULL; | 150 pIccTransform = NULL; |
| 151 } | 151 } |
| 152 uint8_t bgra[4]; | 152 uint8_t bgra[4]; |
| 153 if (pIccTransform) { | 153 if (pIccTransform) { |
| 154 ICodec_IccModule* pIccModule = | 154 ICodec_IccModule* pIccModule = |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 return DrawTextPath(nChars, pCharPos, pFont, pCache, font_size, | 236 return DrawTextPath(nChars, pCharPos, pFont, pCache, font_size, |
| 237 pText2Device, NULL, NULL, fill_color, 0, NULL, | 237 pText2Device, NULL, NULL, fill_color, 0, NULL, |
| 238 nPathFlags, alpha_flag, pIccTransform); | 238 nPathFlags, alpha_flag, pIccTransform); |
| 239 } | 239 } |
| 240 } | 240 } |
| 241 int anti_alias = FXFT_RENDER_MODE_MONO; | 241 int anti_alias = FXFT_RENDER_MODE_MONO; |
| 242 FX_BOOL bNormal = FALSE; | 242 FX_BOOL bNormal = FALSE; |
| 243 if ((text_flags & FXTEXT_NOSMOOTH) == 0) { | 243 if ((text_flags & FXTEXT_NOSMOOTH) == 0) { |
| 244 if (m_DeviceClass == FXDC_DISPLAY && m_bpp > 1) { | 244 if (m_DeviceClass == FXDC_DISPLAY && m_bpp > 1) { |
| 245 FX_BOOL bClearType; | 245 FX_BOOL bClearType; |
| 246 if (pFont->GetFace() == NULL && | 246 if (!pFont->GetFace() && |
| 247 !(pFont->GetSubstFont()->m_SubstFlags & FXFONT_SUBST_CLEARTYPE)) { | 247 !(pFont->GetSubstFont()->m_SubstFlags & FXFONT_SUBST_CLEARTYPE)) { |
| 248 bClearType = FALSE; | 248 bClearType = FALSE; |
| 249 } else { | 249 } else { |
| 250 bClearType = text_flags & FXTEXT_CLEARTYPE; | 250 bClearType = text_flags & FXTEXT_CLEARTYPE; |
| 251 } | 251 } |
| 252 if ((m_RenderCaps & (FXRC_ALPHA_OUTPUT | FXRC_CMYK_OUTPUT))) { | 252 if ((m_RenderCaps & (FXRC_ALPHA_OUTPUT | FXRC_CMYK_OUTPUT))) { |
| 253 anti_alias = FXFT_RENDER_MODE_LCD; | 253 anti_alias = FXFT_RENDER_MODE_LCD; |
| 254 bNormal = TRUE; | 254 bNormal = TRUE; |
| 255 } else if (m_bpp < 16) { | 255 } else if (m_bpp < 16) { |
| 256 anti_alias = FXFT_RENDER_MODE_NORMAL; | 256 anti_alias = FXFT_RENDER_MODE_NORMAL; |
| 257 } else { | 257 } else { |
| 258 if (bClearType == FALSE) { | 258 if (bClearType == FALSE) { |
| 259 anti_alias = FXFT_RENDER_MODE_LCD; | 259 anti_alias = FXFT_RENDER_MODE_LCD; |
| 260 bNormal = TRUE; | 260 bNormal = TRUE; |
| 261 } else { | 261 } else { |
| 262 anti_alias = FXFT_RENDER_MODE_LCD; | 262 anti_alias = FXFT_RENDER_MODE_LCD; |
| 263 } | 263 } |
| 264 } | 264 } |
| 265 } | 265 } |
| 266 } | 266 } |
| 267 if (pCache == NULL) { | 267 if (!pCache) { |
| 268 pCache = CFX_GEModule::Get()->GetFontCache(); | 268 pCache = CFX_GEModule::Get()->GetFontCache(); |
| 269 } | 269 } |
| 270 CFX_FaceCache* pFaceCache = pCache->GetCachedFace(pFont); | 270 CFX_FaceCache* pFaceCache = pCache->GetCachedFace(pFont); |
| 271 FX_FONTCACHE_DEFINE(pCache, pFont); | 271 FX_FONTCACHE_DEFINE(pCache, pFont); |
| 272 FXTEXT_GLYPHPOS* pGlyphAndPos = FX_Alloc(FXTEXT_GLYPHPOS, nChars); | 272 FXTEXT_GLYPHPOS* pGlyphAndPos = FX_Alloc(FXTEXT_GLYPHPOS, nChars); |
| 273 int iChar; | 273 int iChar; |
| 274 deviceCtm = char2device; | 274 deviceCtm = char2device; |
| 275 CFX_AffineMatrix matrixCTM = GetCTM(); | 275 CFX_AffineMatrix matrixCTM = GetCTM(); |
| 276 FX_FLOAT scale_x = FXSYS_fabs(matrixCTM.a); | 276 FX_FLOAT scale_x = FXSYS_fabs(matrixCTM.a); |
| 277 FX_FLOAT scale_y = FXSYS_fabs(matrixCTM.d); | 277 FX_FLOAT scale_y = FXSYS_fabs(matrixCTM.d); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 int pixel_top = FXSYS_round(bmp_rect.top * scale_y); | 328 int pixel_top = FXSYS_round(bmp_rect.top * scale_y); |
| 329 if (anti_alias == FXFT_RENDER_MODE_MONO) { | 329 if (anti_alias == FXFT_RENDER_MODE_MONO) { |
| 330 CFX_DIBitmap bitmap; | 330 CFX_DIBitmap bitmap; |
| 331 if (!bitmap.Create(pixel_width, pixel_height, FXDIB_1bppMask)) { | 331 if (!bitmap.Create(pixel_width, pixel_height, FXDIB_1bppMask)) { |
| 332 FX_Free(pGlyphAndPos); | 332 FX_Free(pGlyphAndPos); |
| 333 return FALSE; | 333 return FALSE; |
| 334 } | 334 } |
| 335 bitmap.Clear(0); | 335 bitmap.Clear(0); |
| 336 for (iChar = 0; iChar < nChars; iChar++) { | 336 for (iChar = 0; iChar < nChars; iChar++) { |
| 337 FXTEXT_GLYPHPOS& glyph = pGlyphAndPos[iChar]; | 337 FXTEXT_GLYPHPOS& glyph = pGlyphAndPos[iChar]; |
| 338 if (glyph.m_pGlyph == NULL) { | 338 if (!glyph.m_pGlyph) { |
| 339 continue; | 339 continue; |
| 340 } | 340 } |
| 341 const CFX_DIBitmap* pGlyph = &glyph.m_pGlyph->m_Bitmap; | 341 const CFX_DIBitmap* pGlyph = &glyph.m_pGlyph->m_Bitmap; |
| 342 bitmap.TransferBitmap( | 342 bitmap.TransferBitmap( |
| 343 glyph.m_OriginX + glyph.m_pGlyph->m_Left - pixel_left, | 343 glyph.m_OriginX + glyph.m_pGlyph->m_Left - pixel_left, |
| 344 glyph.m_OriginY - glyph.m_pGlyph->m_Top - pixel_top, | 344 glyph.m_OriginY - glyph.m_pGlyph->m_Top - pixel_top, |
| 345 pGlyph->GetWidth(), pGlyph->GetHeight(), pGlyph, 0, 0); | 345 pGlyph->GetWidth(), pGlyph->GetHeight(), pGlyph, 0, 0); |
| 346 } | 346 } |
| 347 FX_Free(pGlyphAndPos); | 347 FX_Free(pGlyphAndPos); |
| 348 return SetBitMask(&bitmap, bmp_rect.left, bmp_rect.top, fill_color); | 348 return SetBitMask(&bitmap, bmp_rect.left, bmp_rect.top, fill_color); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 378 int a, r, g, b; | 378 int a, r, g, b; |
| 379 if (anti_alias == FXFT_RENDER_MODE_LCD) { | 379 if (anti_alias == FXFT_RENDER_MODE_LCD) { |
| 380 _Color2Argb(fill_color, fill_color, alpha_flag | (1 << 24), pIccTransform); | 380 _Color2Argb(fill_color, fill_color, alpha_flag | (1 << 24), pIccTransform); |
| 381 ArgbDecode(fill_color, a, r, g, b); | 381 ArgbDecode(fill_color, a, r, g, b); |
| 382 r = FX_GAMMA(r); | 382 r = FX_GAMMA(r); |
| 383 g = FX_GAMMA(g); | 383 g = FX_GAMMA(g); |
| 384 b = FX_GAMMA(b); | 384 b = FX_GAMMA(b); |
| 385 } | 385 } |
| 386 for (iChar = 0; iChar < nChars; iChar++) { | 386 for (iChar = 0; iChar < nChars; iChar++) { |
| 387 FXTEXT_GLYPHPOS& glyph = pGlyphAndPos[iChar]; | 387 FXTEXT_GLYPHPOS& glyph = pGlyphAndPos[iChar]; |
| 388 if (glyph.m_pGlyph == NULL) { | 388 if (!glyph.m_pGlyph) { |
| 389 continue; | 389 continue; |
| 390 } | 390 } |
| 391 const CFX_DIBitmap* pGlyph = &glyph.m_pGlyph->m_Bitmap; | 391 const CFX_DIBitmap* pGlyph = &glyph.m_pGlyph->m_Bitmap; |
| 392 int left = glyph.m_OriginX + glyph.m_pGlyph->m_Left - pixel_left; | 392 int left = glyph.m_OriginX + glyph.m_pGlyph->m_Left - pixel_left; |
| 393 int top = glyph.m_OriginY - glyph.m_pGlyph->m_Top - pixel_top; | 393 int top = glyph.m_OriginY - glyph.m_pGlyph->m_Top - pixel_top; |
| 394 int ncols = pGlyph->GetWidth(); | 394 int ncols = pGlyph->GetWidth(); |
| 395 int nrows = pGlyph->GetHeight(); | 395 int nrows = pGlyph->GetHeight(); |
| 396 if (anti_alias == FXFT_RENDER_MODE_NORMAL) { | 396 if (anti_alias == FXFT_RENDER_MODE_NORMAL) { |
| 397 if (!bitmap.CompositeMask(left, top, ncols, nrows, pGlyph, fill_color, 0, | 397 if (!bitmap.CompositeMask(left, top, ncols, nrows, pGlyph, fill_color, 0, |
| 398 0, FXDIB_BLEND_NORMAL, NULL, FALSE, alpha_flag, | 398 0, FXDIB_BLEND_NORMAL, NULL, FALSE, alpha_flag, |
| (...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1111 const CFX_AffineMatrix* pText2User, | 1111 const CFX_AffineMatrix* pText2User, |
| 1112 const CFX_AffineMatrix* pUser2Device, | 1112 const CFX_AffineMatrix* pUser2Device, |
| 1113 const CFX_GraphStateData* pGraphState, | 1113 const CFX_GraphStateData* pGraphState, |
| 1114 FX_DWORD fill_color, | 1114 FX_DWORD fill_color, |
| 1115 FX_ARGB stroke_color, | 1115 FX_ARGB stroke_color, |
| 1116 CFX_PathData* pClippingPath, | 1116 CFX_PathData* pClippingPath, |
| 1117 int nFlag, | 1117 int nFlag, |
| 1118 int alpha_flag, | 1118 int alpha_flag, |
| 1119 void* pIccTransform, | 1119 void* pIccTransform, |
| 1120 int blend_type) { | 1120 int blend_type) { |
| 1121 if (pCache == NULL) { | 1121 if (!pCache) { |
| 1122 pCache = CFX_GEModule::Get()->GetFontCache(); | 1122 pCache = CFX_GEModule::Get()->GetFontCache(); |
| 1123 } | 1123 } |
| 1124 CFX_FaceCache* pFaceCache = pCache->GetCachedFace(pFont); | 1124 CFX_FaceCache* pFaceCache = pCache->GetCachedFace(pFont); |
| 1125 FX_FONTCACHE_DEFINE(pCache, pFont); | 1125 FX_FONTCACHE_DEFINE(pCache, pFont); |
| 1126 for (int iChar = 0; iChar < nChars; iChar++) { | 1126 for (int iChar = 0; iChar < nChars; iChar++) { |
| 1127 const FXTEXT_CHARPOS& charpos = pCharPos[iChar]; | 1127 const FXTEXT_CHARPOS& charpos = pCharPos[iChar]; |
| 1128 CFX_AffineMatrix matrix; | 1128 CFX_AffineMatrix matrix; |
| 1129 if (charpos.m_bGlyphAdjust) | 1129 if (charpos.m_bGlyphAdjust) |
| 1130 matrix.Set(charpos.m_AdjustMatrix[0], charpos.m_AdjustMatrix[1], | 1130 matrix.Set(charpos.m_AdjustMatrix[0], charpos.m_AdjustMatrix[1], |
| 1131 charpos.m_AdjustMatrix[2], charpos.m_AdjustMatrix[3], 0, 0); | 1131 charpos.m_AdjustMatrix[2], charpos.m_AdjustMatrix[3], 0, 0); |
| 1132 matrix.Concat(font_size, 0, 0, font_size, charpos.m_OriginX, | 1132 matrix.Concat(font_size, 0, 0, font_size, charpos.m_OriginX, |
| 1133 charpos.m_OriginY); | 1133 charpos.m_OriginY); |
| 1134 const CFX_PathData* pPath = pFaceCache->LoadGlyphPath( | 1134 const CFX_PathData* pPath = pFaceCache->LoadGlyphPath( |
| 1135 pFont, charpos.m_GlyphIndex, charpos.m_FontCharWidth); | 1135 pFont, charpos.m_GlyphIndex, charpos.m_FontCharWidth); |
| 1136 if (pPath == NULL) { | 1136 if (!pPath) { |
| 1137 continue; | 1137 continue; |
| 1138 } | 1138 } |
| 1139 matrix.Concat(*pText2User); | 1139 matrix.Concat(*pText2User); |
| 1140 CFX_PathData TransformedPath(*pPath); | 1140 CFX_PathData TransformedPath(*pPath); |
| 1141 TransformedPath.Transform(&matrix); | 1141 TransformedPath.Transform(&matrix); |
| 1142 FX_BOOL bHasAlpha = FXGETFLAG_COLORTYPE(alpha_flag) | 1142 FX_BOOL bHasAlpha = FXGETFLAG_COLORTYPE(alpha_flag) |
| 1143 ? (FXGETFLAG_ALPHA_FILL(alpha_flag) || | 1143 ? (FXGETFLAG_ALPHA_FILL(alpha_flag) || |
| 1144 FXGETFLAG_ALPHA_STROKE(alpha_flag)) | 1144 FXGETFLAG_ALPHA_STROKE(alpha_flag)) |
| 1145 : (fill_color || stroke_color); | 1145 : (fill_color || stroke_color); |
| 1146 if (bHasAlpha) { | 1146 if (bHasAlpha) { |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1266 } else { | 1266 } else { |
| 1267 pSizeCache = it->second; | 1267 pSizeCache = it->second; |
| 1268 } | 1268 } |
| 1269 CFX_GlyphBitmap* pGlyphBitmap = NULL; | 1269 CFX_GlyphBitmap* pGlyphBitmap = NULL; |
| 1270 if (pSizeCache->m_GlyphMap.Lookup((void*)(uintptr_t)glyph_index, | 1270 if (pSizeCache->m_GlyphMap.Lookup((void*)(uintptr_t)glyph_index, |
| 1271 (void*&)pGlyphBitmap)) { | 1271 (void*&)pGlyphBitmap)) { |
| 1272 return pGlyphBitmap; | 1272 return pGlyphBitmap; |
| 1273 } | 1273 } |
| 1274 pGlyphBitmap = RenderGlyph(pFont, glyph_index, bFontStyle, pMatrix, | 1274 pGlyphBitmap = RenderGlyph(pFont, glyph_index, bFontStyle, pMatrix, |
| 1275 dest_width, anti_alias); | 1275 dest_width, anti_alias); |
| 1276 if (pGlyphBitmap == NULL) { | 1276 if (!pGlyphBitmap) { |
| 1277 return NULL; | 1277 return NULL; |
| 1278 } | 1278 } |
| 1279 pSizeCache->m_GlyphMap.SetAt((void*)(uintptr_t)glyph_index, pGlyphBitmap); | 1279 pSizeCache->m_GlyphMap.SetAt((void*)(uintptr_t)glyph_index, pGlyphBitmap); |
| 1280 return pGlyphBitmap; | 1280 return pGlyphBitmap; |
| 1281 } | 1281 } |
| 1282 const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap( | 1282 const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap( |
| 1283 CFX_Font* pFont, | 1283 CFX_Font* pFont, |
| 1284 FX_DWORD glyph_index, | 1284 FX_DWORD glyph_index, |
| 1285 FX_BOOL bFontStyle, | 1285 FX_BOOL bFontStyle, |
| 1286 const CFX_AffineMatrix* pMatrix, | 1286 const CFX_AffineMatrix* pMatrix, |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1381 while (pos) { | 1381 while (pos) { |
| 1382 m_GlyphMap.GetNextAssoc(pos, Key, (void*&)pGlyphBitmap); | 1382 m_GlyphMap.GetNextAssoc(pos, Key, (void*&)pGlyphBitmap); |
| 1383 delete pGlyphBitmap; | 1383 delete pGlyphBitmap; |
| 1384 } | 1384 } |
| 1385 m_GlyphMap.RemoveAll(); | 1385 m_GlyphMap.RemoveAll(); |
| 1386 } | 1386 } |
| 1387 #define CONTRAST_RAMP_STEP 1 | 1387 #define CONTRAST_RAMP_STEP 1 |
| 1388 void CFX_Font::AdjustMMParams(int glyph_index, int dest_width, int weight) { | 1388 void CFX_Font::AdjustMMParams(int glyph_index, int dest_width, int weight) { |
| 1389 FXFT_MM_Var pMasters = NULL; | 1389 FXFT_MM_Var pMasters = NULL; |
| 1390 FXFT_Get_MM_Var(m_Face, &pMasters); | 1390 FXFT_Get_MM_Var(m_Face, &pMasters); |
| 1391 if (pMasters == NULL) { | 1391 if (!pMasters) { |
| 1392 return; | 1392 return; |
| 1393 } | 1393 } |
| 1394 long coords[2]; | 1394 long coords[2]; |
| 1395 if (weight == 0) { | 1395 if (weight == 0) { |
| 1396 coords[0] = FXFT_Get_MM_Axis_Def(FXFT_Get_MM_Axis(pMasters, 0)) / 65536; | 1396 coords[0] = FXFT_Get_MM_Axis_Def(FXFT_Get_MM_Axis(pMasters, 0)) / 65536; |
| 1397 } else { | 1397 } else { |
| 1398 coords[0] = weight; | 1398 coords[0] = weight; |
| 1399 } | 1399 } |
| 1400 if (dest_width == 0) { | 1400 if (dest_width == 0) { |
| 1401 coords[1] = FXFT_Get_MM_Axis_Def(FXFT_Get_MM_Axis(pMasters, 1)) / 65536; | 1401 coords[1] = FXFT_Get_MM_Axis_Def(FXFT_Get_MM_Axis(pMasters, 1)) / 65536; |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1514 *pDstRow++ = (uint8_t)temp; | 1514 *pDstRow++ = (uint8_t)temp; |
| 1515 } | 1515 } |
| 1516 } | 1516 } |
| 1517 } | 1517 } |
| 1518 CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(CFX_Font* pFont, | 1518 CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(CFX_Font* pFont, |
| 1519 FX_DWORD glyph_index, | 1519 FX_DWORD glyph_index, |
| 1520 FX_BOOL bFontStyle, | 1520 FX_BOOL bFontStyle, |
| 1521 const CFX_AffineMatrix* pMatrix, | 1521 const CFX_AffineMatrix* pMatrix, |
| 1522 int dest_width, | 1522 int dest_width, |
| 1523 int anti_alias) { | 1523 int anti_alias) { |
| 1524 if (m_Face == NULL) { | 1524 if (!m_Face) { |
| 1525 return NULL; | 1525 return NULL; |
| 1526 } | 1526 } |
| 1527 FXFT_Matrix ft_matrix; | 1527 FXFT_Matrix ft_matrix; |
| 1528 ft_matrix.xx = (signed long)(pMatrix->GetA() / 64 * 65536); | 1528 ft_matrix.xx = (signed long)(pMatrix->GetA() / 64 * 65536); |
| 1529 ft_matrix.xy = (signed long)(pMatrix->GetC() / 64 * 65536); | 1529 ft_matrix.xy = (signed long)(pMatrix->GetC() / 64 * 65536); |
| 1530 ft_matrix.yx = (signed long)(pMatrix->GetB() / 64 * 65536); | 1530 ft_matrix.yx = (signed long)(pMatrix->GetB() / 64 * 65536); |
| 1531 ft_matrix.yy = (signed long)(pMatrix->GetD() / 64 * 65536); | 1531 ft_matrix.yy = (signed long)(pMatrix->GetD() / 64 * 65536); |
| 1532 FX_BOOL bUseCJKSubFont = FALSE; | 1532 FX_BOOL bUseCJKSubFont = FALSE; |
| 1533 const CFX_SubstFont* pSubstFont = pFont->GetSubstFont(); | 1533 const CFX_SubstFont* pSubstFont = pFont->GetSubstFont(); |
| 1534 if (pSubstFont) { | 1534 if (pSubstFont) { |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1646 dest_pitch); | 1646 dest_pitch); |
| 1647 _GammaAdjust(pDestBuf, bmwidth, bmheight, dest_pitch, | 1647 _GammaAdjust(pDestBuf, bmwidth, bmheight, dest_pitch, |
| 1648 CFX_GEModule::Get()->GetTextGammaTable()); | 1648 CFX_GEModule::Get()->GetTextGammaTable()); |
| 1649 } | 1649 } |
| 1650 } | 1650 } |
| 1651 return pGlyphBitmap; | 1651 return pGlyphBitmap; |
| 1652 } | 1652 } |
| 1653 const CFX_PathData* CFX_FaceCache::LoadGlyphPath(CFX_Font* pFont, | 1653 const CFX_PathData* CFX_FaceCache::LoadGlyphPath(CFX_Font* pFont, |
| 1654 FX_DWORD glyph_index, | 1654 FX_DWORD glyph_index, |
| 1655 int dest_width) { | 1655 int dest_width) { |
| 1656 if (m_Face == NULL || glyph_index == (FX_DWORD)-1) { | 1656 if (!m_Face || glyph_index == (FX_DWORD)-1) { |
| 1657 return NULL; | 1657 return NULL; |
| 1658 } | 1658 } |
| 1659 CFX_PathData* pGlyphPath = NULL; | 1659 CFX_PathData* pGlyphPath = NULL; |
| 1660 void* key; | 1660 void* key; |
| 1661 if (pFont->GetSubstFont()) { | 1661 if (pFont->GetSubstFont()) { |
| 1662 key = (void*)(uintptr_t)( | 1662 key = (void*)(uintptr_t)( |
| 1663 glyph_index + ((pFont->GetSubstFont()->m_Weight / 16) << 15) + | 1663 glyph_index + ((pFont->GetSubstFont()->m_Weight / 16) << 15) + |
| 1664 ((pFont->GetSubstFont()->m_ItalicAngle / 2) << 21) + | 1664 ((pFont->GetSubstFont()->m_ItalicAngle / 2) << 21) + |
| 1665 ((dest_width / 16) << 25) + (pFont->IsVertical() << 31)); | 1665 ((dest_width / 16) << 25) + (pFont->IsVertical() << 31)); |
| 1666 } else { | 1666 } else { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1793 to->y / param->m_CoordUnit; | 1793 to->y / param->m_CoordUnit; |
| 1794 param->m_pPoints[param->m_PointCount + 2].m_Flag = FXPT_BEZIERTO; | 1794 param->m_pPoints[param->m_PointCount + 2].m_Flag = FXPT_BEZIERTO; |
| 1795 param->m_CurX = to->x; | 1795 param->m_CurX = to->x; |
| 1796 param->m_CurY = to->y; | 1796 param->m_CurY = to->y; |
| 1797 } | 1797 } |
| 1798 param->m_PointCount += 3; | 1798 param->m_PointCount += 3; |
| 1799 return 0; | 1799 return 0; |
| 1800 } | 1800 } |
| 1801 }; | 1801 }; |
| 1802 CFX_PathData* CFX_Font::LoadGlyphPath(FX_DWORD glyph_index, int dest_width) { | 1802 CFX_PathData* CFX_Font::LoadGlyphPath(FX_DWORD glyph_index, int dest_width) { |
| 1803 if (m_Face == NULL) { | 1803 if (!m_Face) { |
| 1804 return NULL; | 1804 return NULL; |
| 1805 } | 1805 } |
| 1806 FXFT_Set_Pixel_Sizes(m_Face, 0, 64); | 1806 FXFT_Set_Pixel_Sizes(m_Face, 0, 64); |
| 1807 FXFT_Matrix ft_matrix = {65536, 0, 0, 65536}; | 1807 FXFT_Matrix ft_matrix = {65536, 0, 0, 65536}; |
| 1808 if (m_pSubstFont) { | 1808 if (m_pSubstFont) { |
| 1809 if (m_pSubstFont->m_ItalicAngle) { | 1809 if (m_pSubstFont->m_ItalicAngle) { |
| 1810 int skew = m_pSubstFont->m_ItalicAngle; | 1810 int skew = m_pSubstFont->m_ItalicAngle; |
| 1811 skew = skew <= -ANGLESKEW_ARRAY_SIZE ? -58 : -g_AngleSkew[-skew]; | 1811 skew = skew <= -ANGLESKEW_ARRAY_SIZE ? -58 : -g_AngleSkew[-skew]; |
| 1812 if (m_bVertical) { | 1812 if (m_bVertical) { |
| 1813 ft_matrix.yx += ft_matrix.yy * skew / 100; | 1813 ft_matrix.yx += ft_matrix.yy * skew / 100; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1873 void _CFX_UniqueKeyGen::Generate(int count, ...) { | 1873 void _CFX_UniqueKeyGen::Generate(int count, ...) { |
| 1874 va_list argList; | 1874 va_list argList; |
| 1875 va_start(argList, count); | 1875 va_start(argList, count); |
| 1876 for (int i = 0; i < count; i++) { | 1876 for (int i = 0; i < count; i++) { |
| 1877 int p = va_arg(argList, int); | 1877 int p = va_arg(argList, int); |
| 1878 ((FX_DWORD*)m_Key)[i] = p; | 1878 ((FX_DWORD*)m_Key)[i] = p; |
| 1879 } | 1879 } |
| 1880 va_end(argList); | 1880 va_end(argList); |
| 1881 m_KeyLen = count * sizeof(FX_DWORD); | 1881 m_KeyLen = count * sizeof(FX_DWORD); |
| 1882 } | 1882 } |
| OLD | NEW |