| 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/fxge/dib/dib_int.h" | 12 #include "core/fxge/dib/dib_int.h" |
| 13 #include "core/fxge/ge/fx_text_int.h" | 13 #include "core/fxge/ge/fx_text_int.h" |
| 14 #include "core/fxge/include/fx_ge.h" | 14 #include "core/fxge/include/fx_ge.h" |
| 15 #include "core/fxge/include/ifx_renderdevicedriver.h" |
| 15 #include "third_party/agg23/agg_conv_dash.h" | 16 #include "third_party/agg23/agg_conv_dash.h" |
| 16 #include "third_party/agg23/agg_conv_stroke.h" | 17 #include "third_party/agg23/agg_conv_stroke.h" |
| 17 #include "third_party/agg23/agg_curves.h" | 18 #include "third_party/agg23/agg_curves.h" |
| 18 #include "third_party/agg23/agg_path_storage.h" | 19 #include "third_party/agg23/agg_path_storage.h" |
| 19 #include "third_party/agg23/agg_pixfmt_gray.h" | 20 #include "third_party/agg23/agg_pixfmt_gray.h" |
| 20 #include "third_party/agg23/agg_rasterizer_scanline_aa.h" | 21 #include "third_party/agg23/agg_rasterizer_scanline_aa.h" |
| 21 #include "third_party/agg23/agg_renderer_scanline.h" | 22 #include "third_party/agg23/agg_renderer_scanline.h" |
| 22 #include "third_party/agg23/agg_scanline_u.h" | 23 #include "third_party/agg23/agg_scanline_u.h" |
| 23 | 24 |
| 24 namespace { | 25 namespace { |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 } else { | 410 } else { |
| 410 agg::conv_stroke<agg::path_storage> stroke(path_data); | 411 agg::conv_stroke<agg::path_storage> stroke(path_data); |
| 411 stroke.line_join(join); | 412 stroke.line_join(join); |
| 412 stroke.line_cap(cap); | 413 stroke.line_cap(cap); |
| 413 stroke.miter_limit(pGraphState->m_MiterLimit); | 414 stroke.miter_limit(pGraphState->m_MiterLimit); |
| 414 stroke.width(width); | 415 stroke.width(width); |
| 415 rasterizer.add_path_transformed(stroke, pObject2Device); | 416 rasterizer.add_path_transformed(stroke, pObject2Device); |
| 416 } | 417 } |
| 417 } | 418 } |
| 418 | 419 |
| 419 IFX_RenderDeviceDriver* IFX_RenderDeviceDriver::CreateFxgeDriver( | |
| 420 CFX_DIBitmap* pBitmap, | |
| 421 FX_BOOL bRgbByteOrder, | |
| 422 CFX_DIBitmap* pOriDevice, | |
| 423 FX_BOOL bGroupKnockout) { | |
| 424 return new CFX_AggDeviceDriver(pBitmap, bRgbByteOrder, pOriDevice, | |
| 425 bGroupKnockout); | |
| 426 } | |
| 427 | |
| 428 IFX_RenderDeviceDriver::~IFX_RenderDeviceDriver() {} | |
| 429 | |
| 430 CFX_Matrix IFX_RenderDeviceDriver::GetCTM() const { | |
| 431 return CFX_Matrix(); | |
| 432 } | |
| 433 | |
| 434 FX_BOOL IFX_RenderDeviceDriver::StartRendering() { | |
| 435 return TRUE; | |
| 436 } | |
| 437 | |
| 438 void IFX_RenderDeviceDriver::EndRendering() {} | |
| 439 | |
| 440 FX_BOOL IFX_RenderDeviceDriver::SetClip_PathStroke( | |
| 441 const CFX_PathData* pPathData, | |
| 442 const CFX_Matrix* pObject2Device, | |
| 443 const CFX_GraphStateData* pGraphState) { | |
| 444 return FALSE; | |
| 445 } | |
| 446 | |
| 447 FX_BOOL IFX_RenderDeviceDriver::SetPixel(int x, int y, uint32_t color) { | |
| 448 return FALSE; | |
| 449 } | |
| 450 | |
| 451 FX_BOOL IFX_RenderDeviceDriver::FillRectWithBlend(const FX_RECT* pRect, | |
| 452 uint32_t fill_color, | |
| 453 int blend_type) { | |
| 454 return FALSE; | |
| 455 } | |
| 456 | |
| 457 FX_BOOL IFX_RenderDeviceDriver::DrawCosmeticLine(FX_FLOAT x1, | |
| 458 FX_FLOAT y1, | |
| 459 FX_FLOAT x2, | |
| 460 FX_FLOAT y2, | |
| 461 uint32_t color, | |
| 462 int blend_type) { | |
| 463 return FALSE; | |
| 464 } | |
| 465 | |
| 466 FX_BOOL IFX_RenderDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap, | |
| 467 int left, | |
| 468 int top) { | |
| 469 return FALSE; | |
| 470 } | |
| 471 CFX_DIBitmap* IFX_RenderDeviceDriver::GetBackDrop() { | |
| 472 return nullptr; | |
| 473 } | |
| 474 | |
| 475 FX_BOOL IFX_RenderDeviceDriver::ContinueDIBits(void* handle, | |
| 476 IFX_Pause* pPause) { | |
| 477 return FALSE; | |
| 478 } | |
| 479 | |
| 480 void IFX_RenderDeviceDriver::CancelDIBits(void* handle) {} | |
| 481 | |
| 482 FX_BOOL IFX_RenderDeviceDriver::DrawDeviceText(int nChars, | |
| 483 const FXTEXT_CHARPOS* pCharPos, | |
| 484 CFX_Font* pFont, | |
| 485 CFX_FontCache* pCache, | |
| 486 const CFX_Matrix* pObject2Device, | |
| 487 FX_FLOAT font_size, | |
| 488 uint32_t color) { | |
| 489 return FALSE; | |
| 490 } | |
| 491 | |
| 492 void* IFX_RenderDeviceDriver::GetPlatformSurface() const { | |
| 493 return nullptr; | |
| 494 } | |
| 495 | |
| 496 int IFX_RenderDeviceDriver::GetDriverType() const { | |
| 497 return 0; | |
| 498 } | |
| 499 | |
| 500 void IFX_RenderDeviceDriver::ClearDriver() {} | |
| 501 | |
| 502 FX_BOOL IFX_RenderDeviceDriver::DrawShading(const CPDF_ShadingPattern* pPattern, | |
| 503 const CFX_Matrix* pMatrix, | |
| 504 const FX_RECT& clip_rect, | |
| 505 int alpha, | |
| 506 FX_BOOL bAlphaMode) { | |
| 507 return false; | |
| 508 } | |
| 509 | |
| 510 CFX_AggDeviceDriver::CFX_AggDeviceDriver(CFX_DIBitmap* pBitmap, | 420 CFX_AggDeviceDriver::CFX_AggDeviceDriver(CFX_DIBitmap* pBitmap, |
| 511 FX_BOOL bRgbByteOrder, | 421 FX_BOOL bRgbByteOrder, |
| 512 CFX_DIBitmap* pOriDevice, | 422 CFX_DIBitmap* pOriDevice, |
| 513 FX_BOOL bGroupKnockout) { | 423 FX_BOOL bGroupKnockout) { |
| 514 m_pBitmap = pBitmap; | 424 m_pBitmap = pBitmap; |
| 515 m_pClipRgn = nullptr; | 425 m_pClipRgn = nullptr; |
| 516 m_pPlatformBitmap = nullptr; | 426 m_pPlatformBitmap = nullptr; |
| 517 m_pPlatformGraphics = nullptr; | 427 m_pPlatformGraphics = nullptr; |
| 518 m_pDwRenderTartget = nullptr; | 428 m_pDwRenderTartget = nullptr; |
| 519 m_bRgbByteOrder = bRgbByteOrder; | 429 m_bRgbByteOrder = bRgbByteOrder; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 547 const FXTEXT_CHARPOS* pCharPos, | 457 const FXTEXT_CHARPOS* pCharPos, |
| 548 CFX_Font* pFont, | 458 CFX_Font* pFont, |
| 549 CFX_FontCache* pCache, | 459 CFX_FontCache* pCache, |
| 550 const CFX_Matrix* pObject2Device, | 460 const CFX_Matrix* pObject2Device, |
| 551 FX_FLOAT font_size, | 461 FX_FLOAT font_size, |
| 552 uint32_t color) { | 462 uint32_t color) { |
| 553 return FALSE; | 463 return FALSE; |
| 554 } | 464 } |
| 555 #endif // _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_ | 465 #endif // _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_ |
| 556 | 466 |
| 557 int CFX_AggDeviceDriver::GetDeviceCaps(int caps_id) { | 467 int CFX_AggDeviceDriver::GetDeviceCaps(int caps_id) const { |
| 558 switch (caps_id) { | 468 switch (caps_id) { |
| 559 case FXDC_DEVICE_CLASS: | 469 case FXDC_DEVICE_CLASS: |
| 560 return FXDC_DISPLAY; | 470 return FXDC_DISPLAY; |
| 561 case FXDC_PIXEL_WIDTH: | 471 case FXDC_PIXEL_WIDTH: |
| 562 return m_pBitmap->GetWidth(); | 472 return m_pBitmap->GetWidth(); |
| 563 case FXDC_PIXEL_HEIGHT: | 473 case FXDC_PIXEL_HEIGHT: |
| 564 return m_pBitmap->GetHeight(); | 474 return m_pBitmap->GetHeight(); |
| 565 case FXDC_BITS_PIXEL: | 475 case FXDC_BITS_PIXEL: |
| 566 return m_pBitmap->GetBPP(); | 476 return m_pBitmap->GetBPP(); |
| 567 case FXDC_HORZ_SIZE: | 477 case FXDC_HORZ_SIZE: |
| (...skipping 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1858 SetDeviceDriver(pDriver); | 1768 SetDeviceDriver(pDriver); |
| 1859 return true; | 1769 return true; |
| 1860 } | 1770 } |
| 1861 | 1771 |
| 1862 CFX_FxgeDevice::~CFX_FxgeDevice() { | 1772 CFX_FxgeDevice::~CFX_FxgeDevice() { |
| 1863 if (m_bOwnedBitmap) { | 1773 if (m_bOwnedBitmap) { |
| 1864 delete GetBitmap(); | 1774 delete GetBitmap(); |
| 1865 } | 1775 } |
| 1866 } | 1776 } |
| 1867 #endif | 1777 #endif |
| OLD | NEW |