xref: /aosp_15_r20/external/skia/src/core/SkBlitRow.h (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1 /*
2  * Copyright 2011 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #ifndef SkBlitRow_DEFINED
9 #define SkBlitRow_DEFINED
10 
11 #include "include/core/SkBitmap.h"
12 #include "include/core/SkColor.h"
13 
14 class SkBlitRow {
15 public:
16     enum Flags32 {
17         kGlobalAlpha_Flag32     = 1 << 0,
18         kSrcPixelAlpha_Flag32   = 1 << 1
19     };
20 
21     /** Function pointer that blends 32bit colors onto a 32bit destination.
22         @param dst  array of dst 32bit colors
23         @param src  array of src 32bit colors (w/ or w/o alpha)
24         @param count number of colors to blend
25         @param alpha global alpha to be applied to all src colors
26      */
27     typedef void (*Proc32)(uint32_t dst[], const SkPMColor src[], int count, U8CPU alpha);
28 
29     static Proc32 Factory32(unsigned flags32);
30 
31     /** Blend a single color onto a row of S32 pixels, writing the result
32         back to the same memory.
33      */
34     static void Color32(SkPMColor dst[], int count, SkPMColor color);
35 };
36 
37 namespace SkOpts {
38     extern void (*blit_row_color32)(SkPMColor* dst, int count, SkPMColor color);
39     extern void (*blit_row_s32a_opaque)(SkPMColor* dst, const SkPMColor* src,
40                                         int count, U8CPU alpha);
41 
42     void Init_BlitRow();
43 }  // namespace SkOpts
44 
45 #endif
46