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

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

Issue 1321433002: Add subsetting to SkScaledCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@gif-scan
Patch Set: Created 5 years, 2 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 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 #ifndef SkMaskSwizzler_DEFINED 7 #ifndef SkMaskSwizzler_DEFINED
8 #define SkMaskSwizzler_DEFINED 8 #define SkMaskSwizzler_DEFINED
9 9
10 #include "SkMasks.h" 10 #include "SkMasks.h"
11 #include "SkSwizzler.h" 11 #include "SkSwizzler.h"
12 #include "SkTypes.h" 12 #include "SkTypes.h"
13 13
14 /* 14 /*
15 * 15 *
16 * Used to swizzle images whose pixel components are extracted by bit masks 16 * Used to swizzle images whose pixel components are extracted by bit masks
17 * Currently only used by bmp 17 * Currently only used by bmp
18 * 18 *
19 */ 19 */
20 class SkMaskSwizzler { 20 class SkMaskSwizzler {
21 public: 21 public:
22 22
23 /* 23 /*
24 * Create a new swizzler 24 * Create a new swizzler
25 * @param masks Unowned pointer to helper class 25 * @param masks Unowned pointer to helper class
26 */ 26 */
27 static SkMaskSwizzler* CreateMaskSwizzler(const SkImageInfo& dstInfo, 27 static SkMaskSwizzler* CreateMaskSwizzler(const SkImageInfo& dstInfo,
28 const SkImageInfo& srcInfo, 28 const SkImageInfo& srcInfo,
29 SkMasks* masks, 29 SkMasks* masks,
30 uint32_t bitsPerPixel); 30 uint32_t bitsPerPixel,
31 int subsetLeft,
32 int subsetWidth);
31 33
32 /* 34 /*
33 * Swizzle a row 35 * Swizzle a row
34 */ 36 */
35 SkSwizzler::ResultAlpha swizzle(void* dst, const uint8_t* SK_RESTRICT src); 37 SkSwizzler::ResultAlpha swizzle(void* dst, const uint8_t* SK_RESTRICT src);
36 38
37 private: 39 private:
38 40
39 /* 41 /*
40 * Row procedure used for swizzle 42 * Row procedure used for swizzle
41 */ 43 */
42 typedef SkSwizzler::ResultAlpha (*RowProc)( 44 typedef SkSwizzler::ResultAlpha (*RowProc)(void* dstRow, const uint8_t* srcR ow, int width,
43 void* dstRow, const uint8_t* srcRow, int width,
44 SkMasks* masks, uint32_t startX, uint32_t sampleX); 45 SkMasks* masks, uint32_t startX, uint32_t sampleX);
45 46
46 /* 47 /*
47 * Constructor for mask swizzler 48 * Constructor for mask swizzler
48 */ 49 */
49 SkMaskSwizzler(const SkImageInfo& info, SkMasks* masks, RowProc proc, 50 SkMaskSwizzler(SkMasks* masks, RowProc proc, uint32_t width, uint32_t sample X, uint32_t startX);
50 uint32_t sampleX);
51 51
52 // Fields 52 // Fields
53 const SkImageInfo& fDstInfo;
54 SkMasks* fMasks; // unowned 53 SkMasks* fMasks; // unowned
55 const RowProc fRowProc; 54 const RowProc fRowProc;
55 const uint32_t fWidth;
56 const uint32_t fSampleX; 56 const uint32_t fSampleX;
57 const uint32_t fStartX; 57 const uint32_t fStartX;
58 }; 58 };
59 59
60 #endif 60 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698