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

Side by Side Diff: src/codec/SkMaskSwizzler.h

Issue 947283002: Bmp Image Decoding (Closed) Base URL: https://skia.googlesource.com/skia.git@decode-leon-3
Patch Set: separate swizzler for masks Created 5 years, 9 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
(Empty)
1 /*
2 * Copyright 2015 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 #include "SkSwizzler.h"
9 #include "SkTemplates.h"
10
11 /*
12 *
13 * Used to swizzle images whose pixel components are extracted by bit masks
14 * Currently only used by bmp
15 *
16 */
17 class SkMaskSwizzler {
18 public:
19
20 /*
21 *
22 * Input bit masks format
23 *
24 */
25 struct InputMasks {
26 uint32_t red;
27 uint32_t green;
28 uint32_t blue;
29 uint32_t alpha;
30 };
31
32 /*
33 *
34 * Contains all of the information for a single mask
35 *
36 */
37 struct MaskInfo {
38 uint32_t mask;
39 uint32_t shift;
40 uint32_t size;
41 };
42
43 /*
44 *
45 * The bit masks used in the decode
46 *
47 */
48 struct Masks {
49 const MaskInfo red;
50 const MaskInfo green;
51 const MaskInfo blue;
52 const MaskInfo alpha;
53 };
54
55 /*
56 *
57 * Process an input mask to obtain the necessary information
58 *
59 */
60 static const MaskInfo& ProcessMask(uint32_t mask, uint32_t bpp);
61
62 /*
63 *
64 * Create a new swizzler
65 *
66 */
67 static SkMaskSwizzler* CreateMaskSwizzler(const SkImageInfo& imageInfo,
68 InputMasks masks,
69 uint32_t bitsPerPixel);
70
71 /*
72 *
73 * Swizzle the next row
74 *
75 */
76 SkSwizzler::ResultAlpha next(void* dst, const uint8_t* src);
77
78 private:
79
80 /*
81 *
82 * Row procedure used for swizzle
83 *
84 */
85 typedef SkSwizzler::ResultAlpha (*RowProc)(
86 void* dstRow, const uint8_t* srcRow, int width, const Masks& masks);
87
88 /*
89 *
90 * Constructor for mask swizzler
91 *
92 */
93 SkMaskSwizzler(const SkImageInfo& info, const Masks& masks, RowProc proc);
94
95 // Fields
96 const SkImageInfo& fImageInfo;
97 const Masks fMasks;
98 const RowProc fRowProc;
99 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698