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

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

Issue 1365313002: Merge SkCodec with SkScanlineDecoder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Skip ICO in SkScaledCodec for now 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
« no previous file with comments | « src/codec/SkCodec_libpng.cpp ('k') | src/codec/SkCodec_wbmp.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7
8 #ifndef SkCodec_wbmp_DEFINED 8 #ifndef SkCodec_wbmp_DEFINED
9 #define SkCodec_wbmp_DEFINED 9 #define SkCodec_wbmp_DEFINED
10 10
11 #include "SkCodec.h" 11 #include "SkCodec.h"
12 #include "SkScanlineDecoder.h"
13 #include "SkSwizzler.h" 12 #include "SkSwizzler.h"
14 13
15 class SkWbmpCodec final : public SkCodec { 14 class SkWbmpCodec final : public SkCodec {
16 public: 15 public:
17 static bool IsWbmp(SkStream*); 16 static bool IsWbmp(SkStream*);
18 17
19 /* 18 /*
20 * Assumes IsWbmp was called and returned true 19 * Assumes IsWbmp was called and returned true
21 * Creates a wbmp codec 20 * Creates a wbmp codec
22 * Takes ownership of the stream 21 * Takes ownership of the stream
23 */ 22 */
24 static SkCodec* NewFromStream(SkStream*); 23 static SkCodec* NewFromStream(SkStream*);
25 24
26 /*
27 * Assumes IsWbmp was called and returned true
28 * Creates a wbmp scanline decoder
29 * Takes ownership of the stream
30 */
31 static SkScanlineDecoder* NewSDFromStream(SkStream*);
32 protected: 25 protected:
33 SkEncodedFormat onGetEncodedFormat() const override; 26 SkEncodedFormat onGetEncodedFormat() const override;
34 Result onGetPixels(const SkImageInfo&, void*, size_t, 27 Result onGetPixels(const SkImageInfo&, void*, size_t,
35 const Options&, SkPMColor[], int*) override; 28 const Options&, SkPMColor[], int*) override;
36 bool onRewind() override; 29 bool onRewind() override;
37 private: 30 private:
38 /* 31 /*
39 * Returns a swizzler on success, nullptr on failure 32 * Returns a swizzler on success, nullptr on failure
40 */ 33 */
41 SkSwizzler* initializeSwizzler(const SkImageInfo& info, const SkPMColor* cta ble, 34 SkSwizzler* initializeSwizzler(const SkImageInfo& info, const SkPMColor* cta ble,
42 const Options& opts); 35 const Options& opts);
43 36
44 /* 37 /*
45 * Read a src row from the encoded stream 38 * Read a src row from the encoded stream
46 */ 39 */
47 Result readRow(uint8_t* row); 40 Result readRow(uint8_t* row);
48 41
49 SkWbmpCodec(const SkImageInfo&, SkStream*); 42 SkWbmpCodec(const SkImageInfo&, SkStream*);
50 43
51 const size_t fSrcRowBytes; 44 const size_t fSrcRowBytes;
52 45
53 friend class SkWbmpScanlineDecoder; 46 // Used for scanline decodes:
47 SkAutoTUnref<SkColorTable> fColorTable;
48 SkAutoTDelete<SkSwizzler> fSwizzler;
49 SkAutoTMalloc<uint8_t> fSrcBuffer;
50
51 // FIXME: Override onSkipScanlines to avoid swizzling.
52 Result onGetScanlines(void* dst, int count, size_t dstRowBytes) override;
53 Result onStartScanlineDecode(const SkImageInfo& dstInfo, const Options& opti ons,
54 SkPMColor inputColorTable[], int* inputColorCount) override;
55
54 typedef SkCodec INHERITED; 56 typedef SkCodec INHERITED;
55 }; 57 };
56 58
57 #endif // SkCodec_wbmp_DEFINED 59 #endif // SkCodec_wbmp_DEFINED
OLDNEW
« no previous file with comments | « src/codec/SkCodec_libpng.cpp ('k') | src/codec/SkCodec_wbmp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698