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

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

Issue 1022673011: Creating a new wrapper for gif decoder (Closed) Base URL: https://skia.googlesource.com/skia.git@ico-real
Patch Set: Added comments and do while loop Created 5 years, 8 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.cpp ('k') | src/codec/SkCodec_libgif.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "SkCodec.h"
9 #include "SkImageInfo.h"
10
11 #include "gif_lib.h"
12
13 /*
14 *
15 * This class implements the decoding for gif images
16 *
17 */
18 class SkGifCodec : public SkCodec {
19 public:
20
21 /*
22 * Checks the start of the stream to see if the image is a gif
23 */
24 static bool IsGif(SkStream*);
25
26 /*
27 * Assumes IsGif was called and returned true
28 * Creates a gif decoder
29 * Reads enough of the stream to determine the image format
30 */
31 static SkCodec* NewFromStream(SkStream*);
32
33
34 protected:
35
36 /*
37 * Initiates the gif decode
38 */
39 Result onGetPixels(const SkImageInfo&, void*, size_t, const Options&,
40 SkPMColor*, int32_t*) override;
41
42 SkEncodedFormat onGetEncodedFormat() const override {
43 return kGIF_SkEncodedFormat;
44 }
45
46 private:
47
48 /*
49 * This function cleans up the gif object after the decode completes
50 * It is used in a SkAutoTCallIProc template
51 */
52 static int32_t CloseGif(GifFileType* gif);
53
54 /*
55 * Frees any extension data used in the decode
56 * Used in a SkAutoTCallVProc
57 */
58 static void FreeExtension(SavedImage* image);
59
60 /*
61 * Creates an instance of the decoder
62 * Called only by NewFromStream
63 *
64 * @param srcInfo contains the source width and height
65 * @param stream the stream of image data
66 * @param gif pointer to library type that manages gif decode
67 * takes ownership
68 */
69 SkGifCodec(const SkImageInfo& srcInfo, SkStream* stream, GifFileType* gif);
70
71 SkAutoTCallIProc<GifFileType, CloseGif> fGif; // owned
72
73 typedef SkCodec INHERITED;
74 };
OLDNEW
« no previous file with comments | « src/codec/SkCodec.cpp ('k') | src/codec/SkCodec_libgif.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698