| 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 | into a row of D32 pixels. src and dst may be the same memory, but |
| 33 | if they are not, they may not overlap. |
| 34 | */ |
| 35 | static void Color32(SkPMColor dst[], const SkPMColor src[], int count, SkPMColor color); |
| 36 | }; |
| 37 | |
| 38 | #endif |
| 39 | |