Clean up CPDF_AnnotList.
[pdfium.git] / core / src / fxge / skia / fx_skia_blitter_new.h
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CORE_SRC_FXGE_SKIA_FX_SKIA_BLITTER_NEW_H_
6 #define CORE_SRC_FXGE_SKIA_FX_SKIA_BLITTER_NEW_H_
7
8 #if defined(_SKIA_SUPPORT_)
9 class CFX_SkiaRenderer : public SkBlitter {
10  protected:
11   int m_Alpha,
12       m_Red,         // Or the complementary-color, Cyan
13       m_Green,       // Magenta
14       m_Blue,        // Yellow
15       m_Gray;        // Black
16   FX_DWORD m_Color;  // FX_ARGB or FX_CMYK
17   FX_BOOL m_bFullCover;
18   int m_ProcessFilter;
19   FX_BOOL m_bRgbByteOrder;
20
21   FX_RECT m_ClipBox;
22   CFX_DIBitmap* m_pDevice;
23   CFX_DIBitmap* m_pOriDevice;
24   const CFX_ClipRgn* m_pClipRgn;
25   const CFX_DIBitmap* m_pClipMask;
26
27   uint8_t* m_pDestScan;
28   uint8_t* m_pDestExtraAlphaScan;
29   uint8_t* m_pOriScan;
30   uint8_t* m_pClipScan;
31
32   void (CFX_SkiaRenderer::*composite_span)(uint8_t*,
33                                            uint8_t*,
34                                            int,
35                                            int,
36                                            int,
37                                            int,
38                                            uint8_t,
39                                            int,
40                                            int,
41                                            int,
42                                            uint8_t*,
43                                            uint8_t*);
44
45  public:
46   //--------------------------------------------------------------------
47   virtual void blitAntiH(int x,
48                          int y,
49                          const SkAlpha antialias[],
50                          const int16_t runs[]);
51   virtual void blitH(int x, int y, int width);
52   virtual void blitV(int x, int y, int height, SkAlpha alpha);
53   virtual void blitRect(int x, int y, int width, int height);
54   virtual void blitAntiRect(int x,
55                             int y,
56                             int width,
57                             int height,
58                             SkAlpha leftAlpha,
59                             SkAlpha rightAlpha);
60
61   /*------------------------------------------------------------------------------------------------------*/
62   // A general alpha merge function (with clipping mask). Gray device.
63   void CompositeSpan1bpp_0(uint8_t* dest_scan,
64                            uint8_t* ori_scan,
65                            int Bpp,
66                            int span_left,
67                            int span_len,
68                            int span_top,
69                            uint8_t cover_scan,
70                            int clip_top,
71                            int clip_left,
72                            int clip_right,
73                            uint8_t* clip_scan,
74                            uint8_t* dest_extra_alpha_scan);
75   void CompositeSpan1bpp_1(uint8_t* dest_scan,
76                            uint8_t* ori_scan,
77                            int Bpp,
78                            int span_left,
79                            int span_len,
80                            int span_top,
81                            uint8_t cover_scan,
82                            int clip_top,
83                            int clip_left,
84                            int clip_right,
85                            uint8_t* clip_scan,
86                            uint8_t* dest_extra_alpha_scan);
87   void CompositeSpan1bpp_4(uint8_t* dest_scan,
88                            uint8_t* ori_scan,
89                            int Bpp,
90                            int span_left,
91                            int span_len,
92                            int span_top,
93                            uint8_t cover_scan,
94                            int clip_top,
95                            int clip_left,
96                            int clip_right,
97                            uint8_t* clip_scan,
98                            uint8_t* dest_extra_alpha_scan);
99   void CompositeSpan1bpp_5(uint8_t* dest_scan,
100                            uint8_t* ori_scan,
101                            int Bpp,
102                            int span_left,
103                            int span_len,
104                            int span_top,
105                            uint8_t cover_scan,
106                            int clip_top,
107                            int clip_left,
108                            int clip_right,
109                            uint8_t* clip_scan,
110                            uint8_t* dest_extra_alpha_scan);
111   void CompositeSpan1bpp_8(uint8_t* dest_scan,
112                            uint8_t* ori_scan,
113                            int Bpp,
114                            int span_left,
115                            int span_len,
116                            int span_top,
117                            uint8_t cover_scan,
118                            int clip_top,
119                            int clip_left,
120                            int clip_right,
121                            uint8_t* clip_scan,
122                            uint8_t* dest_extra_alpha_scan);
123   void CompositeSpan1bpp_9(uint8_t* dest_scan,
124                            uint8_t* ori_scan,
125                            int Bpp,
126                            int span_left,
127                            int span_len,
128                            int span_top,
129                            uint8_t cover_scan,
130                            int clip_top,
131                            int clip_left,
132                            int clip_right,
133                            uint8_t* clip_scan,
134                            uint8_t* dest_extra_alpha_scan);
135   void CompositeSpan1bpp_12(uint8_t* dest_scan,
136                             uint8_t* ori_scan,
137                             int Bpp,
138                             int span_left,
139                             int span_len,
140                             int span_top,
141                             uint8_t cover_scan,
142                             int clip_top,
143                             int clip_left,
144                             int clip_right,
145                             uint8_t* clip_scan,
146                             uint8_t* dest_extra_alpha_scan);
147   void CompositeSpan1bpp_13(uint8_t* dest_scan,
148                             uint8_t* ori_scan,
149                             int Bpp,
150                             int span_left,
151                             int span_len,
152                             int span_top,
153                             uint8_t cover_scan,
154                             int clip_top,
155                             int clip_left,
156                             int clip_right,
157                             uint8_t* clip_scan,
158                             uint8_t* dest_extra_alpha_scan);
159
160   /*--------------------------------------------------------------------------------------------------------*/
161
162   // A general alpha merge function (with clipping mask). Gray device.
163   void CompositeSpanGray_2(uint8_t* dest_scan,
164                            uint8_t* ori_scan,
165                            int Bpp,
166                            int span_left,
167                            int span_len,
168                            int span_top,
169                            uint8_t cover_scan,
170                            int clip_top,
171                            int clip_left,
172                            int clip_right,
173                            uint8_t* clip_scan,
174                            uint8_t* dest_extra_alpha_scan);
175
176   void CompositeSpanGray_3(uint8_t* dest_scan,
177                            uint8_t* ori_scan,
178                            int Bpp,
179                            int span_left,
180                            int span_len,
181                            int span_top,
182                            uint8_t cover_scan,
183                            int clip_top,
184                            int clip_left,
185                            int clip_right,
186                            uint8_t* clip_scan,
187                            uint8_t* dest_extra_alpha_scan);
188
189   void CompositeSpanGray_6(uint8_t* dest_scan,
190                            uint8_t* ori_scan,
191                            int Bpp,
192                            int span_left,
193                            int span_len,
194                            int span_top,
195                            uint8_t cover_scan,
196                            int clip_top,
197                            int clip_left,
198                            int clip_right,
199                            uint8_t* clip_scan,
200                            uint8_t* dest_extra_alpha_scan);
201
202   void CompositeSpanGray_7(uint8_t* dest_scan,
203                            uint8_t* ori_scan,
204                            int Bpp,
205                            int span_left,
206                            int span_len,
207                            int span_top,
208                            uint8_t cover_scan,
209                            int clip_top,
210                            int clip_left,
211                            int clip_right,
212                            uint8_t* clip_scan,
213                            uint8_t* dest_extra_alpha_scan);
214
215   void CompositeSpanGray_10(uint8_t* dest_scan,
216                             uint8_t* ori_scan,
217                             int Bpp,
218                             int span_left,
219                             int span_len,
220                             int span_top,
221                             uint8_t cover_scan,
222                             int clip_top,
223                             int clip_left,
224                             int clip_right,
225                             uint8_t* clip_scan,
226                             uint8_t* dest_extra_alpha_scan);
227
228   void CompositeSpanGray_11(uint8_t* dest_scan,
229                             uint8_t* ori_scan,
230                             int Bpp,
231                             int span_left,
232                             int span_len,
233                             int span_top,
234                             uint8_t cover_scan,
235                             int clip_top,
236                             int clip_left,
237                             int clip_right,
238                             uint8_t* clip_scan,
239                             uint8_t* dest_extra_alpha_scan);
240
241   void CompositeSpanGray_14(uint8_t* dest_scan,
242                             uint8_t* ori_scan,
243                             int Bpp,
244                             int span_left,
245                             int span_len,
246                             int span_top,
247                             uint8_t cover_scan,
248                             int clip_top,
249                             int clip_left,
250                             int clip_right,
251                             uint8_t* clip_scan,
252                             uint8_t* dest_extra_alpha_scan);
253
254   void CompositeSpanGray_15(uint8_t* dest_scan,
255                             uint8_t* ori_scan,
256                             int Bpp,
257                             int span_left,
258                             int span_len,
259                             int span_top,
260                             uint8_t cover_scan,
261                             int clip_top,
262                             int clip_left,
263                             int clip_right,
264                             uint8_t* clip_scan,
265                             uint8_t* dest_extra_alpha_scan);
266
267   /*--------------------------------------------------------------------------------------------------------*/
268   void CompositeSpanARGB_2(uint8_t* dest_scan,
269                            uint8_t* ori_scan,
270                            int Bpp,
271                            int span_left,
272                            int span_len,
273                            int span_top,
274                            uint8_t cover_scan,
275                            int clip_top,
276                            int clip_left,
277                            int clip_right,
278                            uint8_t* clip_scan,
279                            uint8_t* dest_extra_alpha_scan);
280
281   void CompositeSpanARGB_3(uint8_t* dest_scan,
282                            uint8_t* ori_scan,
283                            int Bpp,
284                            int span_left,
285                            int span_len,
286                            int span_top,
287                            uint8_t cover_scan,
288                            int clip_top,
289                            int clip_left,
290                            int clip_right,
291                            uint8_t* clip_scan,
292                            uint8_t* dest_extra_alpha_scan);
293
294   void CompositeSpanARGB_6(uint8_t* dest_scan,
295                            uint8_t* ori_scan,
296                            int Bpp,
297                            int span_left,
298                            int span_len,
299                            int span_top,
300                            uint8_t cover_scan,
301                            int clip_top,
302                            int clip_left,
303                            int clip_right,
304                            uint8_t* clip_scan,
305                            uint8_t* dest_extra_alpha_scan);
306
307   void CompositeSpanARGB_7(uint8_t* dest_scan,
308                            uint8_t* ori_scan,
309                            int Bpp,
310                            int span_left,
311                            int span_len,
312                            int span_top,
313                            uint8_t cover_scan,
314                            int clip_top,
315                            int clip_left,
316                            int clip_right,
317                            uint8_t* clip_scan,
318                            uint8_t* dest_extra_alpha_scan);
319   // ...
320   /*--------------------------------------------------------------------------------------------------------*/
321   void CompositeSpanRGB32_2(uint8_t* dest_scan,
322                             uint8_t* ori_scan,
323                             int Bpp,
324                             int span_left,
325                             int span_len,
326                             int span_top,
327                             uint8_t cover_scan,
328                             int clip_top,
329                             int clip_left,
330                             int clip_right,
331                             uint8_t* clip_scan,
332                             uint8_t* dest_extra_alpha_scan);
333   void CompositeSpanRGB32_3(uint8_t* dest_scan,
334                             uint8_t* ori_scan,
335                             int Bpp,
336                             int span_left,
337                             int span_len,
338                             int span_top,
339                             uint8_t cover_scan,
340                             int clip_top,
341                             int clip_left,
342                             int clip_right,
343                             uint8_t* clip_scan,
344                             uint8_t* dest_extra_alpha_scan);
345   void CompositeSpanRGB32_6(uint8_t* dest_scan,
346                             uint8_t* ori_scan,
347                             int Bpp,
348                             int span_left,
349                             int span_len,
350                             int span_top,
351                             uint8_t cover_scan,
352                             int clip_top,
353                             int clip_left,
354                             int clip_right,
355                             uint8_t* clip_scan,
356                             uint8_t* dest_extra_alpha_scan);
357   void CompositeSpanRGB32_7(uint8_t* dest_scan,
358                             uint8_t* ori_scan,
359                             int Bpp,
360                             int span_left,
361                             int span_len,
362                             int span_top,
363                             uint8_t cover_scan,
364                             int clip_top,
365                             int clip_left,
366                             int clip_right,
367                             uint8_t* clip_scan,
368                             uint8_t* dest_extra_alpha_scan);
369
370   /*---------------------------------------------------------------------------------------------------------*/
371
372   void CompositeSpanRGB24_2(uint8_t* dest_scan,
373                             uint8_t* ori_scan,
374                             int Bpp,
375                             int span_left,
376                             int span_len,
377                             int span_top,
378                             uint8_t cover_scan,
379                             int clip_top,
380                             int clip_left,
381                             int clip_right,
382                             uint8_t* clip_scan,
383                             uint8_t* dest_extra_alpha_scan);
384   void CompositeSpanRGB24_3(uint8_t* dest_scan,
385                             uint8_t* ori_scan,
386                             int Bpp,
387                             int span_left,
388                             int span_len,
389                             int span_top,
390                             uint8_t cover_scan,
391                             int clip_top,
392                             int clip_left,
393                             int clip_right,
394                             uint8_t* clip_scan,
395                             uint8_t* dest_extra_alpha_scan);
396   void CompositeSpanRGB24_6(uint8_t* dest_scan,
397                             uint8_t* ori_scan,
398                             int Bpp,
399                             int span_left,
400                             int span_len,
401                             int span_top,
402                             uint8_t cover_scan,
403                             int clip_top,
404                             int clip_left,
405                             int clip_right,
406                             uint8_t* clip_scan,
407                             uint8_t* dest_extra_alpha_scan);
408   void CompositeSpanRGB24_7(uint8_t* dest_scan,
409                             uint8_t* ori_scan,
410                             int Bpp,
411                             int span_left,
412                             int span_len,
413                             int span_top,
414                             uint8_t cover_scan,
415                             int clip_top,
416                             int clip_left,
417                             int clip_right,
418                             uint8_t* clip_scan,
419                             uint8_t* dest_extra_alpha_scan);
420   void CompositeSpanRGB24_10(uint8_t* dest_scan,
421                              uint8_t* ori_scan,
422                              int Bpp,
423                              int span_left,
424                              int span_len,
425                              int span_top,
426                              uint8_t cover_scan,
427                              int clip_top,
428                              int clip_left,
429                              int clip_right,
430                              uint8_t* clip_scan,
431                              uint8_t* dest_extra_alpha_scan);
432   void CompositeSpanRGB24_11(uint8_t* dest_scan,
433                              uint8_t* ori_scan,
434                              int Bpp,
435                              int span_left,
436                              int span_len,
437                              int span_top,
438                              uint8_t cover_scan,
439                              int clip_top,
440                              int clip_left,
441                              int clip_right,
442                              uint8_t* clip_scan,
443                              uint8_t* dest_extra_alpha_scan);
444   void CompositeSpanRGB24_14(uint8_t* dest_scan,
445                              uint8_t* ori_scan,
446                              int Bpp,
447                              int span_left,
448                              int span_len,
449                              int span_top,
450                              uint8_t cover_scan,
451                              int clip_top,
452                              int clip_left,
453                              int clip_right,
454                              uint8_t* clip_scan,
455                              uint8_t* dest_extra_alpha_scan);
456   void CompositeSpanRGB24_15(uint8_t* dest_scan,
457                              uint8_t* ori_scan,
458                              int Bpp,
459                              int span_left,
460                              int span_len,
461                              int span_top,
462                              uint8_t cover_scan,
463                              int clip_top,
464                              int clip_left,
465                              int clip_right,
466                              uint8_t* clip_scan,
467                              uint8_t* dest_extra_alpha_scan);
468
469   /*----------------------------------------------------------------------------------------------------------*/
470
471   // A general alpha merge function (with clipping mask). Cmyka/Cmyk device.
472   void CompositeSpanCMYK(uint8_t* dest_scan,
473                          uint8_t* ori_scan,
474                          int Bpp,
475                          int span_left,
476                          int span_len,
477                          int span_top,
478                          uint8_t cover_scan,
479                          int clip_top,
480                          int clip_left,
481                          int clip_right,
482                          uint8_t* clip_scan,
483                          uint8_t* dest_extra_alpha_scan);
484
485   //--------------------------------------------------------------------
486   FX_BOOL Init(CFX_DIBitmap* pDevice,
487                CFX_DIBitmap* pOriDevice,
488                const CFX_ClipRgn* pClipRgn,
489                FX_DWORD color,
490                FX_BOOL bFullCover,
491                FX_BOOL bRgbByteOrder,
492                int alpha_flag = 0,
493                void* pIccTransform =
494                    NULL);  // The alpha flag must be fill_flag if exist.
495 };
496 class CFX_SkiaA8Renderer : public SkBlitter {
497  public:
498   //--------------------------------------------------------------------
499   virtual void blitAntiH(int x,
500                          int y,
501                          const SkAlpha antialias[],
502                          const int16_t runs[]);
503   virtual void blitH(int x, int y, int width);
504   virtual void blitV(int x, int y, int height, SkAlpha alpha);
505   virtual void blitRect(int x, int y, int width, int height);
506   virtual void blitAntiRect(int x,
507                             int y,
508                             int width,
509                             int height,
510                             SkAlpha leftAlpha,
511                             SkAlpha rightAlpha);
512   //--------------------------------------------------------------------
513   FX_BOOL Init(CFX_DIBitmap* pDevice, int Left, int Top);
514   CFX_DIBitmap* m_pDevice;
515   int m_Left;
516   int m_Top;
517   int m_dstWidth;
518   int m_dstHeight;
519 };
520 #endif
521
522 #endif  // CORE_SRC_FXGE_SKIA_FX_SKIA_BLITTER_NEW_H_