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 #include "../../../include/fxge/fx_ge.h" | 5 #include "../../../include/fxge/fx_ge.h" |
6 //#define _SKIA_SUPPORT_ | 6 //#define _SKIA_SUPPORT_ |
7 #if defined(_SKIA_SUPPORT_) | 7 #if defined(_SKIA_SUPPORT_) |
8 #include "../../../include/fxcodec/fx_codec.h" | 8 #include "../../../include/fxcodec/fx_codec.h" |
9 #include "SkBlitter.h" | 9 #include "SkBlitter.h" |
10 #include "fx_skia_blitter_new.h" | 10 #include "fx_skia_blitter_new.h" |
(...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1291 } | 1291 } |
1292 } | 1292 } |
1293 dest_scan += 4; | 1293 dest_scan += 4; |
1294 } | 1294 } |
1295 } | 1295 } |
1296 } | 1296 } |
1297 | 1297 |
1298 | 1298 |
1299 | 1299 |
1300 //-------------------------------------------------------------------- | 1300 //-------------------------------------------------------------------- |
1301 FX_BOOL CFX_SkiaRenderer::Init(CFX_DIBitmap* pDevice, CFX_DIBitmap* pOriDevi
ce, const CFX_ClipRgn* pClipRgn, FX_DWORD color, FX_BOOL bFullCover, FX_BOOL bRg
bByteOrder, | 1301 bool CFX_SkiaRenderer::Init(CFX_DIBitmap* pDevice, CFX_DIBitmap* pOriDevice,
const CFX_ClipRgn* pClipRgn, FX_DWORD color, bool bFullCover, bool bRgbByteOrde
r, |
1302 int alpha_flag, void* pIccTransform) //The alpha flag must be fill_flag
if exist. | 1302 int alpha_flag, void* pIccTransform) //The alpha flag must be fill_flag
if exist. |
1303 { | 1303 { |
1304 m_pDevice = pDevice; | 1304 m_pDevice = pDevice; |
1305 m_pClipRgn = pClipRgn; | 1305 m_pClipRgn = pClipRgn; |
1306 m_bRgbByteOrder = bRgbByteOrder; | 1306 m_bRgbByteOrder = bRgbByteOrder; |
1307 m_pOriDevice = pOriDevice; | 1307 m_pOriDevice = pOriDevice; |
1308 m_pDestScan = NULL; | 1308 m_pDestScan = NULL; |
1309 m_pDestExtraAlphaScan = NULL; | 1309 m_pDestExtraAlphaScan = NULL; |
1310 m_pOriScan = NULL; | 1310 m_pOriScan = NULL; |
1311 m_pClipScan = NULL; | 1311 m_pClipScan = NULL; |
(...skipping 12 matching lines...) Expand all Loading... |
1324 m_pClipScan = m_pClipMask->GetBuffer(); | 1324 m_pClipScan = m_pClipMask->GetBuffer(); |
1325 } | 1325 } |
1326 if (m_pDevice->m_pAlphaMask) | 1326 if (m_pDevice->m_pAlphaMask) |
1327 m_pDestExtraAlphaScan = m_pDevice->m_pAlphaMask->GetBuffer(); | 1327 m_pDestExtraAlphaScan = m_pDevice->m_pAlphaMask->GetBuffer(); |
1328 if (m_pOriDevice) | 1328 if (m_pOriDevice) |
1329 m_pOriScan = m_pOriDevice->GetBuffer(); | 1329 m_pOriScan = m_pOriDevice->GetBuffer(); |
1330 m_pDestScan = m_pDevice->GetBuffer(); | 1330 m_pDestScan = m_pDevice->GetBuffer(); |
1331 | 1331 |
1332 m_bFullCover = bFullCover; | 1332 m_bFullCover = bFullCover; |
1333 | 1333 |
1334 FX_BOOL bObjectCMYK = FXGETFLAG_COLORTYPE(alpha_flag); | 1334 bool bObjectCMYK = FXGETFLAG_COLORTYPE(alpha_flag); |
1335 FX_BOOL bDeviceCMYK = pDevice->IsCmykImage(); | 1335 bool bDeviceCMYK = pDevice->IsCmykImage(); |
1336 | 1336 |
1337 m_Alpha = bObjectCMYK ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXARGB_A(colo
r); | 1337 m_Alpha = bObjectCMYK ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXARGB_A(colo
r); |
1338 | 1338 |
1339 ICodec_IccModule* pIccModule = NULL; | 1339 ICodec_IccModule* pIccModule = NULL; |
1340 // No lcms engine, we skip the transform | 1340 // No lcms engine, we skip the transform |
1341 if (!CFX_GEModule::Get()->GetCodecModule() || !CFX_GEModule::Get()->GetC
odecModule()->GetIccModule()) | 1341 if (!CFX_GEModule::Get()->GetCodecModule() || !CFX_GEModule::Get()->GetC
odecModule()->GetIccModule()) |
1342 pIccTransform = NULL; | 1342 pIccTransform = NULL; |
1343 else | 1343 else |
1344 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 1344 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
1345 | 1345 |
(...skipping 24 matching lines...) Expand all Loading... |
1370 if (bDeviceCMYK) { // Cmyk(a) Device | 1370 if (bDeviceCMYK) { // Cmyk(a) Device |
1371 ASSERT(!m_bRgbByteOrder); | 1371 ASSERT(!m_bRgbByteOrder); |
1372 //TODO... opt for cmyk | 1372 //TODO... opt for cmyk |
1373 composite_span = &CFX_SkiaRenderer::CompositeSpanCMYK; | 1373 composite_span = &CFX_SkiaRenderer::CompositeSpanCMYK; |
1374 if (bObjectCMYK) { | 1374 if (bObjectCMYK) { |
1375 m_Color = FXCMYK_TODIB(color); | 1375 m_Color = FXCMYK_TODIB(color); |
1376 if (pIccTransform) | 1376 if (pIccTransform) |
1377 pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&
m_Color, (const uint8_t*)&m_Color, 1); | 1377 pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&
m_Color, (const uint8_t*)&m_Color, 1); |
1378 } else { // Object RGB | 1378 } else { // Object RGB |
1379 if (!pIccTransform) | 1379 if (!pIccTransform) |
1380 return FALSE; | 1380 return false; |
1381 color = FXARGB_TODIB(color); | 1381 color = FXARGB_TODIB(color); |
1382 pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&m_Co
lor, (const uint8_t*)&color, 1); | 1382 pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&m_Co
lor, (const uint8_t*)&color, 1); |
1383 } | 1383 } |
1384 m_Red = ((uint8_t*)&m_Color)[0]; | 1384 m_Red = ((uint8_t*)&m_Color)[0]; |
1385 m_Green = ((uint8_t*)&m_Color)[1]; | 1385 m_Green = ((uint8_t*)&m_Color)[1]; |
1386 m_Blue = ((uint8_t*)&m_Color)[2]; | 1386 m_Blue = ((uint8_t*)&m_Color)[2]; |
1387 m_Gray = ((uint8_t*)&m_Color)[3]; | 1387 m_Gray = ((uint8_t*)&m_Color)[3]; |
1388 return TRUE; | 1388 return true; |
1389 } | 1389 } |
1390 if (pIccTransform) { | 1390 if (pIccTransform) { |
1391 color = bObjectCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(color); | 1391 color = bObjectCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(color); |
1392 pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&m_Color,
(const uint8_t*)&color, 1); | 1392 pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&m_Color,
(const uint8_t*)&color, 1); |
1393 ((uint8_t*)&m_Color)[3] = m_Alpha; | 1393 ((uint8_t*)&m_Color)[3] = m_Alpha; |
1394 m_Red = ((uint8_t*)&m_Color)[2]; | 1394 m_Red = ((uint8_t*)&m_Color)[2]; |
1395 m_Green = ((uint8_t*)&m_Color)[1]; | 1395 m_Green = ((uint8_t*)&m_Color)[1]; |
1396 m_Blue = ((uint8_t*)&m_Color)[0]; | 1396 m_Blue = ((uint8_t*)&m_Color)[0]; |
1397 // Need Johnson to improvement it. | 1397 // Need Johnson to improvement it. |
1398 if (m_bRgbByteOrder) { | 1398 if (m_bRgbByteOrder) { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1489 //TODO... | 1489 //TODO... |
1490 break; | 1490 break; |
1491 case 10: | 1491 case 10: |
1492 composite_span = &CFX_SkiaRenderer::CompositeSpanRGB24_10; | 1492 composite_span = &CFX_SkiaRenderer::CompositeSpanRGB24_10; |
1493 break; | 1493 break; |
1494 case 14: | 1494 case 14: |
1495 composite_span = &CFX_SkiaRenderer::CompositeSpanRGB24_14; | 1495 composite_span = &CFX_SkiaRenderer::CompositeSpanRGB24_14; |
1496 break; | 1496 break; |
1497 } | 1497 } |
1498 if (composite_span == NULL) | 1498 if (composite_span == NULL) |
1499 return FALSE; | 1499 return false; |
1500 return TRUE; | 1500 return true; |
1501 } | 1501 } |
1502 | 1502 |
1503 /*--------------------------------------------------------------------------
--------------------------*/ | 1503 /*--------------------------------------------------------------------------
--------------------------*/ |
1504 void CFX_SkiaA8Renderer::blitAntiH(int x, int y, const SkAlpha antialias[],
const int16_t runs[]) | 1504 void CFX_SkiaA8Renderer::blitAntiH(int x, int y, const SkAlpha antialias[],
const int16_t runs[]) |
1505 { | 1505 { |
1506 FXSYS_assert(m_pDevice); | 1506 FXSYS_assert(m_pDevice); |
1507 int dst_y = y - m_Top; | 1507 int dst_y = y - m_Top; |
1508 if (dst_y < 0 || dst_y >= m_pDevice->GetHeight()) | 1508 if (dst_y < 0 || dst_y >= m_pDevice->GetHeight()) |
1509 return; | 1509 return; |
1510 | 1510 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1588 SkAlpha leftAlpha, SkAlpha rightAlpha) | 1588 SkAlpha leftAlpha, SkAlpha rightAlpha) |
1589 { | 1589 { |
1590 blitV(x++, y, height, leftAlpha); | 1590 blitV(x++, y, height, leftAlpha); |
1591 if (width > 0) { | 1591 if (width > 0) { |
1592 blitRect(x, y, width, height); | 1592 blitRect(x, y, width, height); |
1593 x += width; | 1593 x += width; |
1594 } | 1594 } |
1595 blitV(x, y, height, rightAlpha); | 1595 blitV(x, y, height, rightAlpha); |
1596 } | 1596 } |
1597 | 1597 |
1598 FX_BOOL CFX_SkiaA8Renderer::Init(CFX_DIBitmap* pDevice, int Left, int Top) | 1598 bool CFX_SkiaA8Renderer::Init(CFX_DIBitmap* pDevice, int Left, int Top) |
1599 { | 1599 { |
1600 m_pDevice = pDevice; | 1600 m_pDevice = pDevice; |
1601 m_Left = Left; | 1601 m_Left = Left; |
1602 m_Top = Top; | 1602 m_Top = Top; |
1603 if (pDevice){ | 1603 if (pDevice){ |
1604 m_dstWidth = m_Left + pDevice->GetWidth(); | 1604 m_dstWidth = m_Left + pDevice->GetWidth(); |
1605 m_dstHeight = m_Top + pDevice->GetHeight(); | 1605 m_dstHeight = m_Top + pDevice->GetHeight(); |
1606 } | 1606 } |
1607 return TRUE; | 1607 return true; |
1608 } | 1608 } |
1609 #endif | 1609 #endif |
OLD | NEW |