| 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/fxge/agg/fx_agg_driver.h" | 7 #include "core/fxge/agg/fx_agg_driver.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| 11 #include "core/fxcodec/include/fx_codec.h" | 11 #include "core/fxcodec/include/fx_codec.h" |
| 12 #include "core/fxcrt/include/fx_memory.h" |
| 12 #include "core/fxge/dib/dib_int.h" | 13 #include "core/fxge/dib/dib_int.h" |
| 13 #include "core/fxge/ge/fx_text_int.h" | 14 #include "core/fxge/ge/fx_text_int.h" |
| 14 #include "core/fxge/include/fx_ge.h" | 15 #include "core/fxge/include/fx_ge.h" |
| 15 #include "core/fxge/include/ifx_renderdevicedriver.h" | 16 #include "core/fxge/include/ifx_renderdevicedriver.h" |
| 16 #include "third_party/agg23/agg_conv_dash.h" | 17 #include "third_party/agg23/agg_conv_dash.h" |
| 17 #include "third_party/agg23/agg_conv_stroke.h" | 18 #include "third_party/agg23/agg_conv_stroke.h" |
| 18 #include "third_party/agg23/agg_curves.h" | 19 #include "third_party/agg23/agg_curves.h" |
| 19 #include "third_party/agg23/agg_path_storage.h" | 20 #include "third_party/agg23/agg_path_storage.h" |
| 20 #include "third_party/agg23/agg_pixfmt_gray.h" | 21 #include "third_party/agg23/agg_pixfmt_gray.h" |
| 21 #include "third_party/agg23/agg_rasterizer_scanline_aa.h" | 22 #include "third_party/agg23/agg_rasterizer_scanline_aa.h" |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 stroke.line_cap(cap); | 414 stroke.line_cap(cap); |
| 414 stroke.miter_limit(pGraphState->m_MiterLimit); | 415 stroke.miter_limit(pGraphState->m_MiterLimit); |
| 415 stroke.width(width); | 416 stroke.width(width); |
| 416 rasterizer.add_path_transformed(stroke, pObject2Device); | 417 rasterizer.add_path_transformed(stroke, pObject2Device); |
| 417 } | 418 } |
| 418 } | 419 } |
| 419 | 420 |
| 420 CFX_AggDeviceDriver::CFX_AggDeviceDriver(CFX_DIBitmap* pBitmap, | 421 CFX_AggDeviceDriver::CFX_AggDeviceDriver(CFX_DIBitmap* pBitmap, |
| 421 FX_BOOL bRgbByteOrder, | 422 FX_BOOL bRgbByteOrder, |
| 422 CFX_DIBitmap* pOriDevice, | 423 CFX_DIBitmap* pOriDevice, |
| 423 FX_BOOL bGroupKnockout) { | 424 FX_BOOL bGroupKnockout) |
| 424 m_pBitmap = pBitmap; | 425 : m_pBitmap(pBitmap), |
| 425 m_pClipRgn = nullptr; | 426 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ |
| 426 m_pPlatformBitmap = nullptr; | 427 m_pPlatformGraphics(nullptr), |
| 427 m_pPlatformGraphics = nullptr; | 428 #endif |
| 428 m_pDwRenderTartget = nullptr; | 429 m_FillFlags(0), |
| 429 m_bRgbByteOrder = bRgbByteOrder; | 430 m_bRgbByteOrder(bRgbByteOrder), |
| 430 m_pOriDevice = pOriDevice; | 431 m_pOriDevice(pOriDevice), |
| 431 m_bGroupKnockout = bGroupKnockout; | 432 m_bGroupKnockout(bGroupKnockout) { |
| 432 m_FillFlags = 0; | |
| 433 InitPlatform(); | 433 InitPlatform(); |
| 434 } | 434 } |
| 435 | 435 |
| 436 CFX_AggDeviceDriver::~CFX_AggDeviceDriver() { | 436 CFX_AggDeviceDriver::~CFX_AggDeviceDriver() { |
| 437 delete m_pClipRgn; | |
| 438 for (int i = 0; i < m_StateStack.GetSize(); i++) | |
| 439 delete m_StateStack[i]; | |
| 440 DestroyPlatform(); | 437 DestroyPlatform(); |
| 441 } | 438 } |
| 442 | 439 |
| 443 uint8_t* CFX_AggDeviceDriver::GetBuffer() const { | 440 uint8_t* CFX_AggDeviceDriver::GetBuffer() const { |
| 444 return m_pBitmap->GetBuffer(); | 441 return m_pBitmap->GetBuffer(); |
| 445 } | 442 } |
| 446 | 443 |
| 447 const CFX_DIBitmap* CFX_AggDeviceDriver::GetBitmap() const { | 444 const CFX_DIBitmap* CFX_AggDeviceDriver::GetBitmap() const { |
| 448 return m_pBitmap; | 445 return m_pBitmap; |
| 449 } | 446 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 if (m_pBitmap->IsCmykImage()) { | 489 if (m_pBitmap->IsCmykImage()) { |
| 493 flags |= FXRC_CMYK_OUTPUT; | 490 flags |= FXRC_CMYK_OUTPUT; |
| 494 } | 491 } |
| 495 return flags; | 492 return flags; |
| 496 } | 493 } |
| 497 } | 494 } |
| 498 return 0; | 495 return 0; |
| 499 } | 496 } |
| 500 | 497 |
| 501 void CFX_AggDeviceDriver::SaveState() { | 498 void CFX_AggDeviceDriver::SaveState() { |
| 502 CFX_ClipRgn* pClip = nullptr; | 499 std::unique_ptr<CFX_ClipRgn> pClip; |
| 503 if (m_pClipRgn) { | 500 if (m_pClipRgn) |
| 504 pClip = new CFX_ClipRgn(*m_pClipRgn); | 501 pClip.reset(new CFX_ClipRgn(*m_pClipRgn)); |
| 505 } | 502 m_StateStack.push_back(std::move(pClip)); |
| 506 m_StateStack.Add(pClip); | |
| 507 } | 503 } |
| 508 | 504 |
| 509 void CFX_AggDeviceDriver::RestoreState(bool bKeepSaved) { | 505 void CFX_AggDeviceDriver::RestoreState(bool bKeepSaved) { |
| 510 delete m_pClipRgn; | 506 m_pClipRgn.reset(); |
| 511 m_pClipRgn = nullptr; | |
| 512 | 507 |
| 513 int size = m_StateStack.GetSize(); | 508 if (m_StateStack.empty()) |
| 514 if (!size) | |
| 515 return; | 509 return; |
| 516 | 510 |
| 517 CFX_ClipRgn* pSavedClip = m_StateStack[size - 1]; | |
| 518 if (bKeepSaved) { | 511 if (bKeepSaved) { |
| 519 if (pSavedClip) { | 512 if (m_StateStack.back()) |
| 520 m_pClipRgn = new CFX_ClipRgn(*pSavedClip); | 513 m_pClipRgn.reset(new CFX_ClipRgn(*m_StateStack.back())); |
| 521 } | |
| 522 } else { | 514 } else { |
| 523 m_StateStack.RemoveAt(size - 1); | 515 m_pClipRgn = std::move(m_StateStack.back()); |
| 524 m_pClipRgn = pSavedClip; | 516 m_StateStack.pop_back(); |
| 525 } | 517 } |
| 526 } | 518 } |
| 527 | 519 |
| 528 void CFX_AggDeviceDriver::SetClipMask(agg::rasterizer_scanline_aa& rasterizer) { | 520 void CFX_AggDeviceDriver::SetClipMask(agg::rasterizer_scanline_aa& rasterizer) { |
| 529 FX_RECT path_rect(rasterizer.min_x(), rasterizer.min_y(), | 521 FX_RECT path_rect(rasterizer.min_x(), rasterizer.min_y(), |
| 530 rasterizer.max_x() + 1, rasterizer.max_y() + 1); | 522 rasterizer.max_x() + 1, rasterizer.max_y() + 1); |
| 531 path_rect.Intersect(m_pClipRgn->GetBox()); | 523 path_rect.Intersect(m_pClipRgn->GetBox()); |
| 532 CFX_DIBitmapRef mask; | 524 CFX_DIBitmapRef mask; |
| 533 CFX_DIBitmap* pThisLayer = mask.New(); | 525 CFX_DIBitmap* pThisLayer = mask.New(); |
| 534 if (!pThisLayer) { | 526 if (!pThisLayer) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 548 agg::render_scanlines(rasterizer, scanline, final_render, | 540 agg::render_scanlines(rasterizer, scanline, final_render, |
| 549 (m_FillFlags & FXFILL_NOPATHSMOOTH) != 0); | 541 (m_FillFlags & FXFILL_NOPATHSMOOTH) != 0); |
| 550 m_pClipRgn->IntersectMaskF(path_rect.left, path_rect.top, mask); | 542 m_pClipRgn->IntersectMaskF(path_rect.left, path_rect.top, mask); |
| 551 } | 543 } |
| 552 | 544 |
| 553 FX_BOOL CFX_AggDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData, | 545 FX_BOOL CFX_AggDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData, |
| 554 const CFX_Matrix* pObject2Device, | 546 const CFX_Matrix* pObject2Device, |
| 555 int fill_mode) { | 547 int fill_mode) { |
| 556 m_FillFlags = fill_mode; | 548 m_FillFlags = fill_mode; |
| 557 if (!m_pClipRgn) { | 549 if (!m_pClipRgn) { |
| 558 m_pClipRgn = new CFX_ClipRgn(GetDeviceCaps(FXDC_PIXEL_WIDTH), | 550 m_pClipRgn.reset(new CFX_ClipRgn(GetDeviceCaps(FXDC_PIXEL_WIDTH), |
| 559 GetDeviceCaps(FXDC_PIXEL_HEIGHT)); | 551 GetDeviceCaps(FXDC_PIXEL_HEIGHT))); |
| 560 } | 552 } |
| 561 if (pPathData->GetPointCount() == 5 || pPathData->GetPointCount() == 4) { | 553 if (pPathData->GetPointCount() == 5 || pPathData->GetPointCount() == 4) { |
| 562 CFX_FloatRect rectf; | 554 CFX_FloatRect rectf; |
| 563 if (pPathData->IsRect(pObject2Device, &rectf)) { | 555 if (pPathData->IsRect(pObject2Device, &rectf)) { |
| 564 rectf.Intersect( | 556 rectf.Intersect( |
| 565 CFX_FloatRect(0, 0, (FX_FLOAT)GetDeviceCaps(FXDC_PIXEL_WIDTH), | 557 CFX_FloatRect(0, 0, (FX_FLOAT)GetDeviceCaps(FXDC_PIXEL_WIDTH), |
| 566 (FX_FLOAT)GetDeviceCaps(FXDC_PIXEL_HEIGHT))); | 558 (FX_FLOAT)GetDeviceCaps(FXDC_PIXEL_HEIGHT))); |
| 567 FX_RECT rect = rectf.GetOutterRect(); | 559 FX_RECT rect = rectf.GetOutterRect(); |
| 568 m_pClipRgn->IntersectRect(rect); | 560 m_pClipRgn->IntersectRect(rect); |
| 569 return TRUE; | 561 return TRUE; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 581 : agg::fill_even_odd); | 573 : agg::fill_even_odd); |
| 582 SetClipMask(rasterizer); | 574 SetClipMask(rasterizer); |
| 583 return TRUE; | 575 return TRUE; |
| 584 } | 576 } |
| 585 | 577 |
| 586 FX_BOOL CFX_AggDeviceDriver::SetClip_PathStroke( | 578 FX_BOOL CFX_AggDeviceDriver::SetClip_PathStroke( |
| 587 const CFX_PathData* pPathData, | 579 const CFX_PathData* pPathData, |
| 588 const CFX_Matrix* pObject2Device, | 580 const CFX_Matrix* pObject2Device, |
| 589 const CFX_GraphStateData* pGraphState) { | 581 const CFX_GraphStateData* pGraphState) { |
| 590 if (!m_pClipRgn) { | 582 if (!m_pClipRgn) { |
| 591 m_pClipRgn = new CFX_ClipRgn(GetDeviceCaps(FXDC_PIXEL_WIDTH), | 583 m_pClipRgn.reset(new CFX_ClipRgn(GetDeviceCaps(FXDC_PIXEL_WIDTH), |
| 592 GetDeviceCaps(FXDC_PIXEL_HEIGHT)); | 584 GetDeviceCaps(FXDC_PIXEL_HEIGHT))); |
| 593 } | 585 } |
| 594 CAgg_PathData path_data; | 586 CAgg_PathData path_data; |
| 595 path_data.BuildPath(pPathData, nullptr); | 587 path_data.BuildPath(pPathData, nullptr); |
| 596 agg::rasterizer_scanline_aa rasterizer; | 588 agg::rasterizer_scanline_aa rasterizer; |
| 597 rasterizer.clip_box(0.0f, 0.0f, (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_WIDTH)), | 589 rasterizer.clip_box(0.0f, 0.0f, (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_WIDTH)), |
| 598 (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_HEIGHT))); | 590 (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_HEIGHT))); |
| 599 RasterizeStroke(rasterizer, path_data.m_PathData, pObject2Device, | 591 RasterizeStroke(rasterizer, path_data.m_PathData, pObject2Device, |
| 600 pGraphState); | 592 pGraphState); |
| 601 rasterizer.filling_rule(agg::fill_non_zero); | 593 rasterizer.filling_rule(agg::fill_non_zero); |
| 602 SetClipMask(rasterizer); | 594 SetClipMask(rasterizer); |
| (...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1437 | 1429 |
| 1438 FX_BOOL CFX_AggDeviceDriver::RenderRasterizer( | 1430 FX_BOOL CFX_AggDeviceDriver::RenderRasterizer( |
| 1439 agg::rasterizer_scanline_aa& rasterizer, | 1431 agg::rasterizer_scanline_aa& rasterizer, |
| 1440 uint32_t color, | 1432 uint32_t color, |
| 1441 FX_BOOL bFullCover, | 1433 FX_BOOL bFullCover, |
| 1442 FX_BOOL bGroupKnockout, | 1434 FX_BOOL bGroupKnockout, |
| 1443 int alpha_flag, | 1435 int alpha_flag, |
| 1444 void* pIccTransform) { | 1436 void* pIccTransform) { |
| 1445 CFX_DIBitmap* pt = bGroupKnockout ? m_pOriDevice : nullptr; | 1437 CFX_DIBitmap* pt = bGroupKnockout ? m_pOriDevice : nullptr; |
| 1446 CFX_Renderer render; | 1438 CFX_Renderer render; |
| 1447 if (!render.Init(m_pBitmap, pt, m_pClipRgn, color, bFullCover, | 1439 if (!render.Init(m_pBitmap, pt, m_pClipRgn.get(), color, bFullCover, |
| 1448 m_bRgbByteOrder, alpha_flag, pIccTransform)) { | 1440 m_bRgbByteOrder, alpha_flag, pIccTransform)) { |
| 1449 return FALSE; | 1441 return FALSE; |
| 1450 } | 1442 } |
| 1451 agg::scanline_u8 scanline; | 1443 agg::scanline_u8 scanline; |
| 1452 agg::render_scanlines(rasterizer, scanline, render, | 1444 agg::render_scanlines(rasterizer, scanline, render, |
| 1453 (m_FillFlags & FXFILL_NOPATHSMOOTH) != 0); | 1445 (m_FillFlags & FXFILL_NOPATHSMOOTH) != 0); |
| 1454 return TRUE; | 1446 return TRUE; |
| 1455 } | 1447 } |
| 1456 | 1448 |
| 1457 FX_BOOL CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData, | 1449 FX_BOOL CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData, |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1652 FX_BOOL CFX_AggDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, | 1644 FX_BOOL CFX_AggDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, |
| 1653 uint32_t argb, | 1645 uint32_t argb, |
| 1654 const FX_RECT* pSrcRect, | 1646 const FX_RECT* pSrcRect, |
| 1655 int left, | 1647 int left, |
| 1656 int top, | 1648 int top, |
| 1657 int blend_type) { | 1649 int blend_type) { |
| 1658 if (!m_pBitmap->GetBuffer()) | 1650 if (!m_pBitmap->GetBuffer()) |
| 1659 return TRUE; | 1651 return TRUE; |
| 1660 | 1652 |
| 1661 if (pBitmap->IsAlphaMask()) { | 1653 if (pBitmap->IsAlphaMask()) { |
| 1662 return m_pBitmap->CompositeMask(left, top, pSrcRect->Width(), | 1654 return m_pBitmap->CompositeMask( |
| 1663 pSrcRect->Height(), pBitmap, argb, | 1655 left, top, pSrcRect->Width(), pSrcRect->Height(), pBitmap, argb, |
| 1664 pSrcRect->left, pSrcRect->top, blend_type, | 1656 pSrcRect->left, pSrcRect->top, blend_type, m_pClipRgn.get(), |
| 1665 m_pClipRgn, m_bRgbByteOrder, 0, nullptr); | 1657 m_bRgbByteOrder, 0, nullptr); |
| 1666 } | 1658 } |
| 1667 return m_pBitmap->CompositeBitmap( | 1659 return m_pBitmap->CompositeBitmap( |
| 1668 left, top, pSrcRect->Width(), pSrcRect->Height(), pBitmap, pSrcRect->left, | 1660 left, top, pSrcRect->Width(), pSrcRect->Height(), pBitmap, pSrcRect->left, |
| 1669 pSrcRect->top, blend_type, m_pClipRgn, m_bRgbByteOrder, nullptr); | 1661 pSrcRect->top, blend_type, m_pClipRgn.get(), m_bRgbByteOrder, nullptr); |
| 1670 } | 1662 } |
| 1671 | 1663 |
| 1672 FX_BOOL CFX_AggDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource, | 1664 FX_BOOL CFX_AggDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource, |
| 1673 uint32_t argb, | 1665 uint32_t argb, |
| 1674 int dest_left, | 1666 int dest_left, |
| 1675 int dest_top, | 1667 int dest_top, |
| 1676 int dest_width, | 1668 int dest_width, |
| 1677 int dest_height, | 1669 int dest_height, |
| 1678 const FX_RECT* pClipRect, | 1670 const FX_RECT* pClipRect, |
| 1679 uint32_t flags, | 1671 uint32_t flags, |
| 1680 int blend_type) { | 1672 int blend_type) { |
| 1681 if (!m_pBitmap->GetBuffer()) | 1673 if (!m_pBitmap->GetBuffer()) |
| 1682 return TRUE; | 1674 return TRUE; |
| 1683 | 1675 |
| 1684 if (dest_width == pSource->GetWidth() && | 1676 if (dest_width == pSource->GetWidth() && |
| 1685 dest_height == pSource->GetHeight()) { | 1677 dest_height == pSource->GetHeight()) { |
| 1686 FX_RECT rect(0, 0, dest_width, dest_height); | 1678 FX_RECT rect(0, 0, dest_width, dest_height); |
| 1687 return SetDIBits(pSource, argb, &rect, dest_left, dest_top, blend_type); | 1679 return SetDIBits(pSource, argb, &rect, dest_left, dest_top, blend_type); |
| 1688 } | 1680 } |
| 1689 FX_RECT dest_rect(dest_left, dest_top, dest_left + dest_width, | 1681 FX_RECT dest_rect(dest_left, dest_top, dest_left + dest_width, |
| 1690 dest_top + dest_height); | 1682 dest_top + dest_height); |
| 1691 dest_rect.Normalize(); | 1683 dest_rect.Normalize(); |
| 1692 FX_RECT dest_clip = dest_rect; | 1684 FX_RECT dest_clip = dest_rect; |
| 1693 dest_clip.Intersect(*pClipRect); | 1685 dest_clip.Intersect(*pClipRect); |
| 1694 CFX_BitmapComposer composer; | 1686 CFX_BitmapComposer composer; |
| 1695 composer.Compose(m_pBitmap, m_pClipRgn, 255, argb, dest_clip, FALSE, FALSE, | 1687 composer.Compose(m_pBitmap, m_pClipRgn.get(), 255, argb, dest_clip, FALSE, |
| 1696 FALSE, m_bRgbByteOrder, 0, nullptr, blend_type); | 1688 FALSE, FALSE, m_bRgbByteOrder, 0, nullptr, blend_type); |
| 1697 dest_clip.Offset(-dest_rect.left, -dest_rect.top); | 1689 dest_clip.Offset(-dest_rect.left, -dest_rect.top); |
| 1698 CFX_ImageStretcher stretcher(&composer, pSource, dest_width, dest_height, | 1690 CFX_ImageStretcher stretcher(&composer, pSource, dest_width, dest_height, |
| 1699 dest_clip, flags); | 1691 dest_clip, flags); |
| 1700 if (stretcher.Start()) | 1692 if (stretcher.Start()) |
| 1701 stretcher.Continue(nullptr); | 1693 stretcher.Continue(nullptr); |
| 1702 return TRUE; | 1694 return TRUE; |
| 1703 } | 1695 } |
| 1704 | 1696 |
| 1705 FX_BOOL CFX_AggDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, | 1697 FX_BOOL CFX_AggDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, |
| 1706 int bitmap_alpha, | 1698 int bitmap_alpha, |
| 1707 uint32_t argb, | 1699 uint32_t argb, |
| 1708 const CFX_Matrix* pMatrix, | 1700 const CFX_Matrix* pMatrix, |
| 1709 uint32_t render_flags, | 1701 uint32_t render_flags, |
| 1710 void*& handle, | 1702 void*& handle, |
| 1711 int blend_type) { | 1703 int blend_type) { |
| 1712 if (!m_pBitmap->GetBuffer()) | 1704 if (!m_pBitmap->GetBuffer()) |
| 1713 return TRUE; | 1705 return TRUE; |
| 1714 | 1706 |
| 1715 CFX_ImageRenderer* pRenderer = new CFX_ImageRenderer; | 1707 CFX_ImageRenderer* pRenderer = new CFX_ImageRenderer; |
| 1716 pRenderer->Start(m_pBitmap, m_pClipRgn, pSource, bitmap_alpha, argb, pMatrix, | 1708 pRenderer->Start(m_pBitmap, m_pClipRgn.get(), pSource, bitmap_alpha, argb, |
| 1717 render_flags, m_bRgbByteOrder, 0, nullptr); | 1709 pMatrix, render_flags, m_bRgbByteOrder, 0, nullptr); |
| 1718 handle = pRenderer; | 1710 handle = pRenderer; |
| 1719 return TRUE; | 1711 return TRUE; |
| 1720 } | 1712 } |
| 1721 | 1713 |
| 1722 FX_BOOL CFX_AggDeviceDriver::ContinueDIBits(void* pHandle, IFX_Pause* pPause) { | 1714 FX_BOOL CFX_AggDeviceDriver::ContinueDIBits(void* pHandle, IFX_Pause* pPause) { |
| 1723 if (!m_pBitmap->GetBuffer()) { | 1715 if (!m_pBitmap->GetBuffer()) { |
| 1724 return TRUE; | 1716 return TRUE; |
| 1725 } | 1717 } |
| 1726 return ((CFX_ImageRenderer*)pHandle)->Continue(pPause); | 1718 return ((CFX_ImageRenderer*)pHandle)->Continue(pPause); |
| 1727 } | 1719 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1739 } | 1731 } |
| 1740 | 1732 |
| 1741 bool CFX_FxgeDevice::Attach(CFX_DIBitmap* pBitmap, | 1733 bool CFX_FxgeDevice::Attach(CFX_DIBitmap* pBitmap, |
| 1742 bool bRgbByteOrder, | 1734 bool bRgbByteOrder, |
| 1743 CFX_DIBitmap* pOriDevice, | 1735 CFX_DIBitmap* pOriDevice, |
| 1744 bool bGroupKnockout) { | 1736 bool bGroupKnockout) { |
| 1745 if (!pBitmap) | 1737 if (!pBitmap) |
| 1746 return false; | 1738 return false; |
| 1747 | 1739 |
| 1748 SetBitmap(pBitmap); | 1740 SetBitmap(pBitmap); |
| 1749 IFX_RenderDeviceDriver* pDriver = new CFX_AggDeviceDriver( | 1741 SetDeviceDriver(WrapUnique(new CFX_AggDeviceDriver( |
| 1750 pBitmap, bRgbByteOrder, pOriDevice, bGroupKnockout); | 1742 pBitmap, bRgbByteOrder, pOriDevice, bGroupKnockout))); |
| 1751 SetDeviceDriver(pDriver); | |
| 1752 return true; | 1743 return true; |
| 1753 } | 1744 } |
| 1754 | 1745 |
| 1755 bool CFX_FxgeDevice::Create(int width, | 1746 bool CFX_FxgeDevice::Create(int width, |
| 1756 int height, | 1747 int height, |
| 1757 FXDIB_Format format, | 1748 FXDIB_Format format, |
| 1758 CFX_DIBitmap* pOriDevice) { | 1749 CFX_DIBitmap* pOriDevice) { |
| 1759 m_bOwnedBitmap = true; | 1750 m_bOwnedBitmap = true; |
| 1760 CFX_DIBitmap* pBitmap = new CFX_DIBitmap; | 1751 CFX_DIBitmap* pBitmap = new CFX_DIBitmap; |
| 1761 if (!pBitmap->Create(width, height, format)) { | 1752 if (!pBitmap->Create(width, height, format)) { |
| 1762 delete pBitmap; | 1753 delete pBitmap; |
| 1763 return false; | 1754 return false; |
| 1764 } | 1755 } |
| 1765 SetBitmap(pBitmap); | 1756 SetBitmap(pBitmap); |
| 1766 IFX_RenderDeviceDriver* pDriver = | 1757 SetDeviceDriver( |
| 1767 new CFX_AggDeviceDriver(pBitmap, FALSE, pOriDevice, FALSE); | 1758 WrapUnique(new CFX_AggDeviceDriver(pBitmap, FALSE, pOriDevice, FALSE))); |
| 1768 SetDeviceDriver(pDriver); | |
| 1769 return true; | 1759 return true; |
| 1770 } | 1760 } |
| 1771 | 1761 |
| 1772 CFX_FxgeDevice::~CFX_FxgeDevice() { | 1762 CFX_FxgeDevice::~CFX_FxgeDevice() { |
| 1773 if (m_bOwnedBitmap) { | 1763 if (m_bOwnedBitmap) { |
| 1774 delete GetBitmap(); | 1764 delete GetBitmap(); |
| 1775 } | 1765 } |
| 1776 } | 1766 } |
| 1777 #endif | 1767 #endif |
| OLD | NEW |