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

Side by Side Diff: core/src/fxge/skia/fx_skia_blitter_new.cpp

Issue 1252613002: FX_BOOL considered harmful. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Manual edits. Created 5 years, 5 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
« no previous file with comments | « core/src/fxge/skia/fx_skia_blitter_new.h ('k') | core/src/fxge/skia/fx_skia_device.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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* pOri Device, const CFX_ClipRgn* pClipRgn, FX_DWORD color, FX_BOOL bFullCover, FX_BOOL bRgbByteOrder, 1301 » bool CFX_SkiaRenderer::Init(CFX_DIBitmap* pDevice, CFX_DIBitmap* pOriDev ice, const CFX_ClipRgn* pClipRgn, FX_DWORD color, bool bFullCover, bool bRgbByte Order,
1302 int alpha_flag, void* pIccTransform) //The alpha flag must be fi ll_flag if exist. 1302 int alpha_flag, void* pIccTransform) //The alpha flag must be fi ll_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
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->GetBuff er(); 1327 m_pDestExtraAlphaScan = m_pDevice->m_pAlphaMask->GetBuff er();
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) : FXARG B_A(color); 1337 m_Alpha = bObjectCMYK ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXARG B_A(color);
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 ()->GetCodecModule()->GetIccModule()) 1341 if (!CFX_GEModule::Get()->GetCodecModule() || !CFX_GEModule::Get ()->GetCodecModule()->GetIccModule())
1342 pIccTransform = NULL; 1342 pIccTransform = NULL;
1343 else 1343 else
1344 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetI ccModule(); 1344 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetI ccModule();
1345 1345
(...skipping 24 matching lines...) Expand all
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::CompositeSpa nCMYK; 1373 composite_span = &CFX_SkiaRenderer::CompositeSpa nCMYK;
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(pI ccTransform, (uint8_t*)&m_Color, (const uint8_t*)&m_Color, 1); 1377 pIccModule->TranslateScanline(pI ccTransform, (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(pIccTransf orm, (uint8_t*)&m_Color, (const uint8_t*)&color, 1); 1382 pIccModule->TranslateScanline(pIccTransf orm, (uint8_t*)&m_Color, (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 } else { 1389 } else {
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(pIccTransf orm, (uint8_t*)&m_Color, (const uint8_t*)&color, 1); 1392 pIccModule->TranslateScanline(pIccTransf orm, (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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1490 //TODO... 1490 //TODO...
1491 break; 1491 break;
1492 case 10: 1492 case 10:
1493 composite_span = &CFX_SkiaRenderer::CompositeSpa nRGB24_10; 1493 composite_span = &CFX_SkiaRenderer::CompositeSpa nRGB24_10;
1494 break; 1494 break;
1495 case 14: 1495 case 14:
1496 composite_span = &CFX_SkiaRenderer::CompositeSpa nRGB24_14; 1496 composite_span = &CFX_SkiaRenderer::CompositeSpa nRGB24_14;
1497 break; 1497 break;
1498 } 1498 }
1499 if (composite_span == NULL) 1499 if (composite_span == NULL)
1500 » » » return FALSE; 1500 » » » return false;
1501 » » return TRUE; 1501 » » return true;
1502 } 1502 }
1503 1503
1504 /*---------------------------------------------------------------------- ------------------------------*/ 1504 /*---------------------------------------------------------------------- ------------------------------*/
1505 void CFX_SkiaA8Renderer::blitAntiH(int x, int y, const SkAlpha antialias [], const int16_t runs[]) 1505 void CFX_SkiaA8Renderer::blitAntiH(int x, int y, const SkAlpha antialias [], const int16_t runs[])
1506 { 1506 {
1507 FXSYS_assert(m_pDevice); 1507 FXSYS_assert(m_pDevice);
1508 int dst_y = y - m_Top; 1508 int dst_y = y - m_Top;
1509 if (dst_y < 0 || dst_y >= m_pDevice->GetHeight()) 1509 if (dst_y < 0 || dst_y >= m_pDevice->GetHeight())
1510 return; 1510 return;
1511 1511
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1589 SkAlpha leftAlpha, SkAlpha rightAlpha) 1589 SkAlpha leftAlpha, SkAlpha rightAlpha)
1590 { 1590 {
1591 blitV(x++, y, height, leftAlpha); 1591 blitV(x++, y, height, leftAlpha);
1592 if (width > 0) { 1592 if (width > 0) {
1593 blitRect(x, y, width, height); 1593 blitRect(x, y, width, height);
1594 x += width; 1594 x += width;
1595 } 1595 }
1596 blitV(x, y, height, rightAlpha); 1596 blitV(x, y, height, rightAlpha);
1597 } 1597 }
1598 1598
1599 » FX_BOOL CFX_SkiaA8Renderer::Init(CFX_DIBitmap* pDevice, int Left, int To p) 1599 » bool CFX_SkiaA8Renderer::Init(CFX_DIBitmap* pDevice, int Left, int Top)
1600 { 1600 {
1601 m_pDevice = pDevice; 1601 m_pDevice = pDevice;
1602 m_Left = Left; 1602 m_Left = Left;
1603 m_Top = Top; 1603 m_Top = Top;
1604 if (pDevice){ 1604 if (pDevice){
1605 m_dstWidth = m_Left + pDevice->GetWidth(); 1605 m_dstWidth = m_Left + pDevice->GetWidth();
1606 m_dstHeight = m_Top + pDevice->GetHeight(); 1606 m_dstHeight = m_Top + pDevice->GetHeight();
1607 } 1607 }
1608 » » return TRUE; 1608 » » return true;
1609 } 1609 }
1610 #endif 1610 #endif
OLDNEW
« no previous file with comments | « core/src/fxge/skia/fx_skia_blitter_new.h ('k') | core/src/fxge/skia/fx_skia_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698