Chromium Code Reviews| 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 <limits> | 7 #include <limits> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "core/fxcodec/include/fx_codec.h" | 10 #include "core/fxcodec/include/fx_codec.h" |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 357 return false; | 357 return false; |
| 358 | 358 |
| 359 if (bsPsName == "CNAAJI+cmex10") | 359 if (bsPsName == "CNAAJI+cmex10") |
| 360 return false; | 360 return false; |
| 361 #endif | 361 #endif |
| 362 return true; | 362 return true; |
| 363 } | 363 } |
| 364 | 364 |
| 365 } // namespace | 365 } // namespace |
| 366 | 366 |
| 367 void Color2Argb(FX_ARGB& argb, | |
| 368 uint32_t color, | |
| 369 int alpha_flag, | |
| 370 void* pIccTransform) { | |
| 371 if (!pIccTransform && !FXGETFLAG_COLORTYPE(alpha_flag)) { | |
|
Lei Zhang
2016/06/20 16:20:38
The two possible values of |alpha_flag| are 0 and
| |
| 372 argb = color; | |
| 373 return; | |
| 374 } | |
| 375 if (!CFX_GEModule::Get()->GetCodecModule() || | |
| 376 !CFX_GEModule::Get()->GetCodecModule()->GetIccModule()) { | |
| 377 pIccTransform = nullptr; | |
| 378 } | |
| 379 uint8_t bgra[4]; | |
| 380 if (pIccTransform) { | |
| 381 CCodec_IccModule* pIccModule = | |
| 382 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | |
| 383 color = FXGETFLAG_COLORTYPE(alpha_flag) ? FXCMYK_TODIB(color) | |
| 384 : FXARGB_TODIB(color); | |
| 385 pIccModule->TranslateScanline(pIccTransform, bgra, (const uint8_t*)&color, | |
| 386 1); | |
| 387 bgra[3] = FXGETFLAG_COLORTYPE(alpha_flag) | |
| 388 ? (alpha_flag >> 24) ? FXGETFLAG_ALPHA_FILL(alpha_flag) | |
| 389 : FXGETFLAG_ALPHA_STROKE(alpha_flag) | |
| 390 : FXARGB_A(color); | |
| 391 argb = FXARGB_MAKE(bgra[3], bgra[2], bgra[1], bgra[0]); | |
| 392 return; | |
| 393 } | |
| 394 AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color), | |
| 395 FXSYS_GetYValue(color), FXSYS_GetKValue(color), bgra[2], | |
| 396 bgra[1], bgra[0]); | |
| 397 bgra[3] = (alpha_flag >> 24) ? FXGETFLAG_ALPHA_FILL(alpha_flag) | |
| 398 : FXGETFLAG_ALPHA_STROKE(alpha_flag); | |
| 399 argb = FXARGB_MAKE(bgra[3], bgra[2], bgra[1], bgra[0]); | |
| 400 } | |
| 401 | |
| 402 FX_RECT FXGE_GetGlyphsBBox(const std::vector<FXTEXT_GLYPHPOS>& glyphs, | 367 FX_RECT FXGE_GetGlyphsBBox(const std::vector<FXTEXT_GLYPHPOS>& glyphs, |
| 403 int anti_alias, | 368 int anti_alias, |
| 404 FX_FLOAT retinaScaleX, | 369 FX_FLOAT retinaScaleX, |
| 405 FX_FLOAT retinaScaleY) { | 370 FX_FLOAT retinaScaleY) { |
| 406 FX_RECT rect(0, 0, 0, 0); | 371 FX_RECT rect(0, 0, 0, 0); |
| 407 bool bStarted = false; | 372 bool bStarted = false; |
| 408 for (const FXTEXT_GLYPHPOS& glyph : glyphs) { | 373 for (const FXTEXT_GLYPHPOS& glyph : glyphs) { |
| 409 const CFX_GlyphBitmap* pGlyph = glyph.m_pGlyph; | 374 const CFX_GlyphBitmap* pGlyph = glyph.m_pGlyph; |
| 410 if (!pGlyph) | 375 if (!pGlyph) |
| 411 continue; | 376 continue; |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 605 if (bitmap.m_pAlphaMask) { | 570 if (bitmap.m_pAlphaMask) { |
| 606 bitmap.m_pAlphaMask->Clear(0); | 571 bitmap.m_pAlphaMask->Clear(0); |
| 607 } | 572 } |
| 608 } | 573 } |
| 609 | 574 |
| 610 int dest_width = pixel_width; | 575 int dest_width = pixel_width; |
| 611 int a = 0; | 576 int a = 0; |
| 612 int r = 0; | 577 int r = 0; |
| 613 int g = 0; | 578 int g = 0; |
| 614 int b = 0; | 579 int b = 0; |
| 615 if (anti_alias == FXFT_RENDER_MODE_LCD) { | 580 if (anti_alias == FXFT_RENDER_MODE_LCD) |
| 616 Color2Argb(fill_color, fill_color, (1 << 24), nullptr); | |
| 617 ArgbDecode(fill_color, a, r, g, b); | 581 ArgbDecode(fill_color, a, r, g, b); |
| 618 } | 582 |
| 619 for (const FXTEXT_GLYPHPOS& glyph : glyphs) { | 583 for (const FXTEXT_GLYPHPOS& glyph : glyphs) { |
| 620 if (!glyph.m_pGlyph) | 584 if (!glyph.m_pGlyph) |
| 621 continue; | 585 continue; |
| 622 | 586 |
| 623 const CFX_DIBitmap* pGlyph = &glyph.m_pGlyph->m_Bitmap; | 587 const CFX_DIBitmap* pGlyph = &glyph.m_pGlyph->m_Bitmap; |
| 624 int left = glyph.m_OriginX + glyph.m_pGlyph->m_Left - pixel_left; | 588 int left = glyph.m_OriginX + glyph.m_pGlyph->m_Left - pixel_left; |
| 625 int top = glyph.m_OriginY - glyph.m_pGlyph->m_Top - pixel_top; | 589 int top = glyph.m_OriginY - glyph.m_pGlyph->m_Top - pixel_top; |
| 626 int ncols = pGlyph->GetWidth(); | 590 int ncols = pGlyph->GetWidth(); |
| 627 int nrows = pGlyph->GetHeight(); | 591 int nrows = pGlyph->GetHeight(); |
| 628 if (anti_alias == FXFT_RENDER_MODE_NORMAL) { | 592 if (anti_alias == FXFT_RENDER_MODE_NORMAL) { |
| (...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1437 void _CFX_UniqueKeyGen::Generate(int count, ...) { | 1401 void _CFX_UniqueKeyGen::Generate(int count, ...) { |
| 1438 va_list argList; | 1402 va_list argList; |
| 1439 va_start(argList, count); | 1403 va_start(argList, count); |
| 1440 for (int i = 0; i < count; i++) { | 1404 for (int i = 0; i < count; i++) { |
| 1441 int p = va_arg(argList, int); | 1405 int p = va_arg(argList, int); |
| 1442 ((uint32_t*)m_Key)[i] = p; | 1406 ((uint32_t*)m_Key)[i] = p; |
| 1443 } | 1407 } |
| 1444 va_end(argList); | 1408 va_end(argList); |
| 1445 m_KeyLen = count * sizeof(uint32_t); | 1409 m_KeyLen = count * sizeof(uint32_t); |
| 1446 } | 1410 } |
| OLD | NEW |