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 "xfa/fde/fde_gedevice.h" | 7 #include "xfa/fde/fde_gedevice.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
11 #include "xfa/fde/fde_brush.h" | 11 #include "xfa/fde/fde_brush.h" |
12 #include "xfa/fde/fde_devbasic.h" | 12 #include "xfa/fde/fde_devbasic.h" |
13 #include "xfa/fde/fde_geobject.h" | 13 #include "xfa/fde/fde_geobject.h" |
14 #include "xfa/fde/fde_image.h" | |
15 #include "xfa/fde/fde_pen.h" | 14 #include "xfa/fde/fde_pen.h" |
16 | 15 |
17 FX_BOOL FDE_GetStockHatchMask(int32_t iHatchStyle, CFX_DIBitmap& hatchMask) { | 16 FX_BOOL FDE_GetStockHatchMask(int32_t iHatchStyle, CFX_DIBitmap& hatchMask) { |
18 FDE_LPCHATCHDATA pData = FDE_DEVGetHatchData(iHatchStyle); | 17 FDE_LPCHATCHDATA pData = FDE_DEVGetHatchData(iHatchStyle); |
19 if (!pData) { | 18 if (!pData) { |
20 return FALSE; | 19 return FALSE; |
21 } | 20 } |
22 hatchMask.Create(pData->iWidth, pData->iHeight, FXDIB_1bppMask); | 21 hatchMask.Create(pData->iWidth, pData->iHeight, FXDIB_1bppMask); |
23 FXSYS_memcpy(hatchMask.GetBuffer(), pData->MaskBits, | 22 FXSYS_memcpy(hatchMask.GetBuffer(), pData->MaskBits, |
24 hatchMask.GetPitch() * pData->iHeight); | 23 hatchMask.GetPitch() * pData->iHeight); |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
436 FXFILL_WINDING); | 435 FXFILL_WINDING); |
437 m_pDevice->FillRect(&rect, dwBackColor); | 436 m_pDevice->FillRect(&rect, dwBackColor); |
438 for (int32_t j = rect.bottom; j < rect.top; j += mask.GetHeight()) | 437 for (int32_t j = rect.bottom; j < rect.top; j += mask.GetHeight()) |
439 for (int32_t i = rect.left; i < rect.right; i += mask.GetWidth()) { | 438 for (int32_t i = rect.left; i < rect.right; i += mask.GetWidth()) { |
440 m_pDevice->SetBitMask(&mask, i, j, dwForeColor); | 439 m_pDevice->SetBitMask(&mask, i, j, dwForeColor); |
441 } | 440 } |
442 m_pDevice->EndRendering(); | 441 m_pDevice->EndRendering(); |
443 m_pDevice->RestoreState(); | 442 m_pDevice->RestoreState(); |
444 return TRUE; | 443 return TRUE; |
445 } | 444 } |
446 FX_BOOL CFDE_FxgeDevice::FillTexturePath(IFDE_Brush* pBrush, | 445 FX_BOOL CFDE_FxgeDevice::FillTexturePath(IFDE_Brush* pBrush, |
Tom Sepez
2016/04/12 16:50:42
can this be removed entirely?
dsinclair
2016/04/12 16:57:49
Was removed by Brush cleanup CL.
| |
447 const CFX_PathData* pPath, | 446 const CFX_PathData* pPath, |
448 const CFX_Matrix* pMatrix) { | 447 const CFX_Matrix* pMatrix) { |
449 FXSYS_assert(pPath && pBrush && pBrush->GetType() == FDE_BRUSHTYPE_Texture); | 448 return FALSE; |
450 IFDE_TextureBrush* pTextureBrush = static_cast<IFDE_TextureBrush*>(pBrush); | |
451 IFDE_Image* pImage = pTextureBrush->GetImage(); | |
452 if (!pImage) | |
453 return FALSE; | |
454 | |
455 CFX_Size size(pImage->GetImageWidth(), pImage->GetImageHeight()); | |
456 CFX_DIBitmap bmp; | |
457 bmp.Create(size.x, size.y, FXDIB_Argb); | |
458 if (!pImage->StartLoadImage(&bmp, 0, 0, size.x, size.y, 0, 0, size.x, | |
459 size.y)) { | |
460 return FALSE; | |
461 } | |
462 if (pImage->DoLoadImage() < 100) { | |
463 return FALSE; | |
464 } | |
465 pImage->StopLoadImage(); | |
466 return WrapTexture(pTextureBrush->GetWrapMode(), &bmp, pPath, pMatrix); | |
467 } | 449 } |
468 FX_BOOL CFDE_FxgeDevice::WrapTexture(int32_t iWrapMode, | 450 FX_BOOL CFDE_FxgeDevice::WrapTexture(int32_t iWrapMode, |
469 const CFX_DIBitmap* pBitmap, | 451 const CFX_DIBitmap* pBitmap, |
470 const CFX_PathData* pPath, | 452 const CFX_PathData* pPath, |
471 const CFX_Matrix* pMatrix) { | 453 const CFX_Matrix* pMatrix) { |
472 CFX_FloatRect rectf = pPath->GetBoundingBox(); | 454 CFX_FloatRect rectf = pPath->GetBoundingBox(); |
473 if (pMatrix) { | 455 if (pMatrix) { |
474 rectf.Transform((const CFX_Matrix*)pMatrix); | 456 rectf.Transform((const CFX_Matrix*)pMatrix); |
475 } | 457 } |
476 FX_RECT rect(FXSYS_round(rectf.left), FXSYS_round(rectf.top), | 458 FX_RECT rect(FXSYS_round(rectf.left), FXSYS_round(rectf.top), |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
564 dev.DrawCosmeticLine(pt0.x, pt0.y, pt1.x, pt1.y, cr0); | 546 dev.DrawCosmeticLine(pt0.x, pt0.y, pt1.x, pt1.y, cr0); |
565 pt1.x += dx; | 547 pt1.x += dx; |
566 pt0.y += dy; | 548 pt0.y += dy; |
567 a0 += da; | 549 a0 += da; |
568 r0 += dr; | 550 r0 += dr; |
569 g0 += dg; | 551 g0 += dg; |
570 b0 += db; | 552 b0 += db; |
571 } | 553 } |
572 return WrapTexture(pLinearBrush->GetWrapMode(), &bmp, pPath, pMatrix); | 554 return WrapTexture(pLinearBrush->GetWrapMode(), &bmp, pPath, pMatrix); |
573 } | 555 } |
OLD | NEW |