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

Side by Side Diff: core/include/fxge/fx_dib.h

Issue 1296043002: Merge to XFA: Use override in more classes in core/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 4 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
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 // 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 #ifndef CORE_INCLUDE_FXGE_FX_DIB_H_ 7 #ifndef CORE_INCLUDE_FXGE_FX_DIB_H_
8 #define CORE_INCLUDE_FXGE_FX_DIB_H_ 8 #define CORE_INCLUDE_FXGE_FX_DIB_H_
9 9
10 #include "../fxcrt/fx_basic.h" 10 #include "../fxcrt/fx_basic.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 #define FXDIB_BLEND_SATURATION 22 62 #define FXDIB_BLEND_SATURATION 22
63 #define FXDIB_BLEND_COLOR 23 63 #define FXDIB_BLEND_COLOR 23
64 #define FXDIB_BLEND_LUMINOSITY 24 64 #define FXDIB_BLEND_LUMINOSITY 24
65 #define FXDIB_BLEND_UNSUPPORTED -1 65 #define FXDIB_BLEND_UNSUPPORTED -1
66 typedef FX_DWORD FX_ARGB; 66 typedef FX_DWORD FX_ARGB;
67 typedef FX_DWORD FX_COLORREF; 67 typedef FX_DWORD FX_COLORREF;
68 typedef FX_DWORD FX_CMYK; 68 typedef FX_DWORD FX_CMYK;
69 class CFX_ClipRgn; 69 class CFX_ClipRgn;
70 class CFX_DIBSource; 70 class CFX_DIBSource;
71 class CFX_DIBitmap; 71 class CFX_DIBitmap;
72 class CStretchEngine;
73
72 #define FXSYS_RGB(r, g, b) ((r) | ((g) << 8) | ((b) << 16)) 74 #define FXSYS_RGB(r, g, b) ((r) | ((g) << 8) | ((b) << 16))
73 #define FXSYS_GetRValue(rgb) ((rgb)&0xff) 75 #define FXSYS_GetRValue(rgb) ((rgb)&0xff)
74 #define FXSYS_GetGValue(rgb) (((rgb) >> 8) & 0xff) 76 #define FXSYS_GetGValue(rgb) (((rgb) >> 8) & 0xff)
75 #define FXSYS_GetBValue(rgb) (((rgb) >> 16) & 0xff) 77 #define FXSYS_GetBValue(rgb) (((rgb) >> 16) & 0xff)
76 #define FX_CCOLOR(val) (255 - (val)) 78 #define FX_CCOLOR(val) (255 - (val))
77 #define FXSYS_CMYK(c, m, y, k) (((c) << 24) | ((m) << 16) | ((y) << 8) | (k)) 79 #define FXSYS_CMYK(c, m, y, k) (((c) << 24) | ((m) << 16) | ((y) << 8) | (k))
78 #define FXSYS_GetCValue(cmyk) ((uint8_t)((cmyk) >> 24) & 0xff) 80 #define FXSYS_GetCValue(cmyk) ((uint8_t)((cmyk) >> 24) & 0xff)
79 #define FXSYS_GetMValue(cmyk) ((uint8_t)((cmyk) >> 16) & 0xff) 81 #define FXSYS_GetMValue(cmyk) ((uint8_t)((cmyk) >> 16) & 0xff)
80 #define FXSYS_GetYValue(cmyk) ((uint8_t)((cmyk) >> 8) & 0xff) 82 #define FXSYS_GetYValue(cmyk) ((uint8_t)((cmyk) >> 8) & 0xff)
81 #define FXSYS_GetKValue(cmyk) ((uint8_t)(cmyk)&0xff) 83 #define FXSYS_GetKValue(cmyk) ((uint8_t)(cmyk)&0xff)
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 void BuildPalette(); 276 void BuildPalette();
275 277
276 FX_BOOL BuildAlphaMask(); 278 FX_BOOL BuildAlphaMask();
277 279
278 int FindPalette(FX_DWORD color) const; 280 int FindPalette(FX_DWORD color) const;
279 281
280 void GetPalette(FX_DWORD* pal, int alpha) const; 282 void GetPalette(FX_DWORD* pal, int alpha) const;
281 }; 283 };
282 class CFX_DIBitmap : public CFX_DIBSource { 284 class CFX_DIBitmap : public CFX_DIBSource {
283 public: 285 public:
284 virtual ~CFX_DIBitmap();
285
286 CFX_DIBitmap(); 286 CFX_DIBitmap();
287 287 explicit CFX_DIBitmap(const CFX_DIBitmap& src);
288 CFX_DIBitmap(const CFX_DIBitmap& src); 288 ~CFX_DIBitmap() override;
289 289
290 FX_BOOL Create(int width, 290 FX_BOOL Create(int width,
291 int height, 291 int height,
292 FXDIB_Format format, 292 FXDIB_Format format,
293 uint8_t* pBuffer = NULL, 293 uint8_t* pBuffer = NULL,
294 int pitch = 0); 294 int pitch = 0);
295 295
296 FX_BOOL Copy(const CFX_DIBSource* pSrc); 296 FX_BOOL Copy(const CFX_DIBSource* pSrc);
297 297
298 virtual uint8_t* GetBuffer() const { return m_pBuffer; } 298 // CFX_DIBSource
299 299 uint8_t* GetBuffer() const override { return m_pBuffer; }
300 virtual const uint8_t* GetScanline(int line) const { 300 const uint8_t* GetScanline(int line) const override {
301 return m_pBuffer ? m_pBuffer + line * m_Pitch : NULL; 301 return m_pBuffer ? m_pBuffer + line * m_Pitch : NULL;
302 } 302 }
303 303 void DownSampleScanline(int line,
304 virtual void DownSampleScanline(int line, 304 uint8_t* dest_scan,
305 uint8_t* dest_scan, 305 int dest_bpp,
306 int dest_bpp, 306 int dest_width,
307 int dest_width, 307 FX_BOOL bFlipX,
308 FX_BOOL bFlipX, 308 int clip_left,
309 int clip_left, 309 int clip_width) const override;
310 int clip_width) const;
311 310
312 void TakeOver(CFX_DIBitmap* pSrcBitmap); 311 void TakeOver(CFX_DIBitmap* pSrcBitmap);
313 312
314 FX_BOOL ConvertFormat(FXDIB_Format format, void* pIccTransform = NULL); 313 FX_BOOL ConvertFormat(FXDIB_Format format, void* pIccTransform = NULL);
315 314
316 void Clear(FX_DWORD color); 315 void Clear(FX_DWORD color);
317 316
318 FX_DWORD GetPixel(int x, int y) const; 317 FX_DWORD GetPixel(int x, int y) const;
319 318
320 void SetPixel(int x, int y, FX_DWORD color); 319 void SetPixel(int x, int y, FX_DWORD color);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 public: 399 public:
401 CFX_DIBExtractor(const CFX_DIBSource* pSrc); 400 CFX_DIBExtractor(const CFX_DIBSource* pSrc);
402 401
403 ~CFX_DIBExtractor(); 402 ~CFX_DIBExtractor();
404 403
405 operator CFX_DIBitmap*() { return m_pBitmap; } 404 operator CFX_DIBitmap*() { return m_pBitmap; }
406 405
407 private: 406 private:
408 CFX_DIBitmap* m_pBitmap; 407 CFX_DIBitmap* m_pBitmap;
409 }; 408 };
409
410 typedef CFX_CountRef<CFX_DIBitmap> CFX_DIBitmapRef; 410 typedef CFX_CountRef<CFX_DIBitmap> CFX_DIBitmapRef;
411 class CFX_FilteredDIB : public CFX_DIBSource { 411 class CFX_FilteredDIB : public CFX_DIBSource {
412 public: 412 public:
413 CFX_FilteredDIB(); 413 CFX_FilteredDIB();
414 414 ~CFX_FilteredDIB() override;
415 ~CFX_FilteredDIB();
416 415
417 void LoadSrc(const CFX_DIBSource* pSrc, FX_BOOL bAutoDropSrc = FALSE); 416 void LoadSrc(const CFX_DIBSource* pSrc, FX_BOOL bAutoDropSrc = FALSE);
418 417
419 virtual FXDIB_Format GetDestFormat() = 0; 418 virtual FXDIB_Format GetDestFormat() = 0;
420 419
421 virtual FX_DWORD* GetDestPalette() = 0; 420 virtual FX_DWORD* GetDestPalette() = 0;
422 421
423 virtual void TranslateScanline(uint8_t* dest_buf, 422 virtual void TranslateScanline(uint8_t* dest_buf,
424 const uint8_t* src_buf) const = 0; 423 const uint8_t* src_buf) const = 0;
425 424
426 virtual void TranslateDownSamples(uint8_t* dest_buf, 425 virtual void TranslateDownSamples(uint8_t* dest_buf,
427 const uint8_t* src_buf, 426 const uint8_t* src_buf,
428 int pixels, 427 int pixels,
429 int Bpp) const = 0; 428 int Bpp) const = 0;
430 429
431 protected: 430 protected:
432 virtual const uint8_t* GetScanline(int line) const; 431 // CFX_DIBSource
433 virtual void DownSampleScanline(int line, 432 const uint8_t* GetScanline(int line) const override;
434 uint8_t* dest_scan, 433 void DownSampleScanline(int line,
435 int dest_bpp, 434 uint8_t* dest_scan,
436 int dest_width, 435 int dest_bpp,
437 FX_BOOL bFlipX, 436 int dest_width,
438 int clip_left, 437 FX_BOOL bFlipX,
439 int clip_width) const; 438 int clip_left,
439 int clip_width) const override;
440 440
441 const CFX_DIBSource* m_pSrc; 441 const CFX_DIBSource* m_pSrc;
442 442
443 FX_BOOL m_bAutoDropSrc; 443 FX_BOOL m_bAutoDropSrc;
444 444
445 uint8_t* m_pScanline; 445 uint8_t* m_pScanline;
446 }; 446 };
447
447 class IFX_ScanlineComposer { 448 class IFX_ScanlineComposer {
448 public: 449 public:
449 virtual ~IFX_ScanlineComposer() {} 450 virtual ~IFX_ScanlineComposer() {}
450 451
451 virtual void ComposeScanline(int line, 452 virtual void ComposeScanline(int line,
452 const uint8_t* scanline, 453 const uint8_t* scanline,
453 const uint8_t* scan_extra_alpha = NULL) = 0; 454 const uint8_t* scan_extra_alpha = NULL) = 0;
454 455
455 virtual FX_BOOL SetInfo(int width, 456 virtual FX_BOOL SetInfo(int width,
456 int height, 457 int height,
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 FXDIB_Format m_SrcFormat, m_DestFormat; 508 FXDIB_Format m_SrcFormat, m_DestFormat;
508 FX_DWORD* m_pSrcPalette; 509 FX_DWORD* m_pSrcPalette;
509 510
510 int m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue, m_MaskBlack; 511 int m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue, m_MaskBlack;
511 int m_BlendType; 512 int m_BlendType;
512 void* m_pIccTransform; 513 void* m_pIccTransform;
513 uint8_t* m_pCacheScanline; 514 uint8_t* m_pCacheScanline;
514 int m_CacheSize; 515 int m_CacheSize;
515 FX_BOOL m_bRgbByteOrder; 516 FX_BOOL m_bRgbByteOrder;
516 }; 517 };
518
517 class CFX_BitmapComposer : public IFX_ScanlineComposer { 519 class CFX_BitmapComposer : public IFX_ScanlineComposer {
518 public: 520 public:
519 CFX_BitmapComposer(); 521 CFX_BitmapComposer();
520 522 ~CFX_BitmapComposer() override;
521 ~CFX_BitmapComposer();
522 523
523 void Compose(CFX_DIBitmap* pDest, 524 void Compose(CFX_DIBitmap* pDest,
524 const CFX_ClipRgn* pClipRgn, 525 const CFX_ClipRgn* pClipRgn,
525 int bitmap_alpha, 526 int bitmap_alpha,
526 FX_DWORD mask_color, 527 FX_DWORD mask_color,
527 FX_RECT& dest_rect, 528 FX_RECT& dest_rect,
528 FX_BOOL bVertical, 529 FX_BOOL bVertical,
529 FX_BOOL bFlipX, 530 FX_BOOL bFlipX,
530 FX_BOOL bFlipY, 531 FX_BOOL bFlipY,
531 FX_BOOL bRgbByteOrder = FALSE, 532 FX_BOOL bRgbByteOrder = FALSE,
532 int alpha_flag = 0, 533 int alpha_flag = 0,
533 void* pIccTransform = NULL, 534 void* pIccTransform = NULL,
534 int blend_type = FXDIB_BLEND_NORMAL); 535 int blend_type = FXDIB_BLEND_NORMAL);
535 536
536 virtual FX_BOOL SetInfo(int width, 537 // IFX_ScanlineComposer
537 int height, 538 FX_BOOL SetInfo(int width,
538 FXDIB_Format src_format, 539 int height,
539 FX_DWORD* pSrcPalette); 540 FXDIB_Format src_format,
541 FX_DWORD* pSrcPalette) override;
540 542
541 virtual void ComposeScanline(int line, 543 void ComposeScanline(int line,
542 const uint8_t* scanline, 544 const uint8_t* scanline,
543 const uint8_t* scan_extra_alpha); 545 const uint8_t* scan_extra_alpha) override;
544 546
545 protected: 547 protected:
546 void DoCompose(uint8_t* dest_scan, 548 void DoCompose(uint8_t* dest_scan,
547 const uint8_t* src_scan, 549 const uint8_t* src_scan,
548 int dest_width, 550 int dest_width,
549 const uint8_t* clip_scan, 551 const uint8_t* clip_scan,
550 const uint8_t* src_extra_alpha = NULL, 552 const uint8_t* src_extra_alpha = NULL,
551 uint8_t* dst_extra_alpha = NULL); 553 uint8_t* dst_extra_alpha = NULL);
552 CFX_DIBitmap* m_pBitmap; 554 CFX_DIBitmap* m_pBitmap;
553 const CFX_ClipRgn* m_pClipRgn; 555 const CFX_ClipRgn* m_pClipRgn;
554 FXDIB_Format m_SrcFormat; 556 FXDIB_Format m_SrcFormat;
555 int m_DestLeft, m_DestTop, m_DestWidth, m_DestHeight, m_BitmapAlpha; 557 int m_DestLeft, m_DestTop, m_DestWidth, m_DestHeight, m_BitmapAlpha;
556 FX_DWORD m_MaskColor; 558 FX_DWORD m_MaskColor;
557 const CFX_DIBitmap* m_pClipMask; 559 const CFX_DIBitmap* m_pClipMask;
558 CFX_ScanlineCompositor m_Compositor; 560 CFX_ScanlineCompositor m_Compositor;
559 FX_BOOL m_bVertical, m_bFlipX, m_bFlipY; 561 FX_BOOL m_bVertical, m_bFlipX, m_bFlipY;
560 int m_AlphaFlag; 562 int m_AlphaFlag;
561 void* m_pIccTransform; 563 void* m_pIccTransform;
562 FX_BOOL m_bRgbByteOrder; 564 FX_BOOL m_bRgbByteOrder;
563 int m_BlendType; 565 int m_BlendType;
564 void ComposeScanlineV(int line, 566 void ComposeScanlineV(int line,
565 const uint8_t* scanline, 567 const uint8_t* scanline,
566 const uint8_t* scan_extra_alpha = NULL); 568 const uint8_t* scan_extra_alpha = NULL);
567 uint8_t* m_pScanlineV; 569 uint8_t* m_pScanlineV;
568 uint8_t* m_pClipScanV; 570 uint8_t* m_pClipScanV;
569 uint8_t* m_pAddClipScan; 571 uint8_t* m_pAddClipScan;
570 uint8_t* m_pScanlineAlphaV; 572 uint8_t* m_pScanlineAlphaV;
571 }; 573 };
574
572 class CFX_BitmapStorer : public IFX_ScanlineComposer { 575 class CFX_BitmapStorer : public IFX_ScanlineComposer {
573 public: 576 public:
574 CFX_BitmapStorer(); 577 CFX_BitmapStorer();
578 ~CFX_BitmapStorer() override;
575 579
576 ~CFX_BitmapStorer(); 580 // IFX_ScanlineComposer
581 void ComposeScanline(int line,
582 const uint8_t* scanline,
583 const uint8_t* scan_extra_alpha) override;
577 584
578 virtual void ComposeScanline(int line, 585 FX_BOOL SetInfo(int width,
579 const uint8_t* scanline, 586 int height,
580 const uint8_t* scan_extra_alpha); 587 FXDIB_Format src_format,
581 588 FX_DWORD* pSrcPalette) override;
582 virtual FX_BOOL SetInfo(int width,
583 int height,
584 FXDIB_Format src_format,
585 FX_DWORD* pSrcPalette);
586 589
587 CFX_DIBitmap* GetBitmap() { return m_pBitmap; } 590 CFX_DIBitmap* GetBitmap() { return m_pBitmap; }
588 591
589 CFX_DIBitmap* Detach(); 592 CFX_DIBitmap* Detach();
590 593
591 void Replace(CFX_DIBitmap* pBitmap); 594 void Replace(CFX_DIBitmap* pBitmap);
592 595
593 private: 596 private:
594 CFX_DIBitmap* m_pBitmap; 597 CFX_DIBitmap* m_pBitmap;
595 }; 598 };
596 class CStretchEngine; 599
597 class CFX_ImageStretcher { 600 class CFX_ImageStretcher {
598 public: 601 public:
599 CFX_ImageStretcher(); 602 CFX_ImageStretcher();
600 ~CFX_ImageStretcher(); 603 ~CFX_ImageStretcher();
601 604
602 FX_BOOL Start(IFX_ScanlineComposer* pDest, 605 FX_BOOL Start(IFX_ScanlineComposer* pDest,
603 const CFX_DIBSource* pBitmap, 606 const CFX_DIBSource* pBitmap,
604 int dest_width, 607 int dest_width,
605 int dest_height, 608 int dest_height,
606 const FX_RECT& bitmap_rect, 609 const FX_RECT& bitmap_rect,
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 int m_Status; 685 int m_Status;
683 FX_RECT m_ClipBox; 686 FX_RECT m_ClipBox;
684 FX_DWORD m_Flags; 687 FX_DWORD m_Flags;
685 int m_AlphaFlag; 688 int m_AlphaFlag;
686 void* m_pIccTransform; 689 void* m_pIccTransform;
687 FX_BOOL m_bRgbByteOrder; 690 FX_BOOL m_bRgbByteOrder;
688 int m_BlendType; 691 int m_BlendType;
689 }; 692 };
690 693
691 #endif // CORE_INCLUDE_FXGE_FX_DIB_H_ 694 #endif // CORE_INCLUDE_FXGE_FX_DIB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698