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

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

Issue 1288483002: Consolidate SkCodec functions for handling rewind (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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 | « include/codec/SkCodec.h ('k') | src/codec/SkBmpCodec.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 #ifndef SkBmpCodec_DEFINED 7 #ifndef SkBmpCodec_DEFINED
8 #define SkBmpCodec_DEFINED 8 #define SkBmpCodec_DEFINED
9 9
10 #include "SkCodec.h" 10 #include "SkCodec.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 SkEncodedFormat onGetEncodedFormat() const override { return kBMP_SkEncodedF ormat; } 56 SkEncodedFormat onGetEncodedFormat() const override { return kBMP_SkEncodedF ormat; }
57 57
58 /* 58 /*
59 * Read enough of the stream to initialize the SkBmpCodec. Returns a bool 59 * Read enough of the stream to initialize the SkBmpCodec. Returns a bool
60 * representing success or failure. If it returned true, and codecOut was 60 * representing success or failure. If it returned true, and codecOut was
61 * not NULL, it will be set to a new SkBmpCodec. 61 * not NULL, it will be set to a new SkBmpCodec.
62 * Does *not* take ownership of the passed in SkStream. 62 * Does *not* take ownership of the passed in SkStream.
63 */ 63 */
64 static bool ReadHeader(SkStream*, bool inIco, SkCodec** codecOut); 64 static bool ReadHeader(SkStream*, bool inIco, SkCodec** codecOut);
65 65
66 bool onRewind() override;
67
66 /* 68 /*
67 * Rewinds the image stream if necessary 69 * Returns whether this BMP is part of an ICO image.
68 */ 70 */
69 bool handleRewind(bool inIco); 71 bool inIco() const {
scroggo_chromium 2015/08/11 16:29:42 This split follows the convention we follow for pu
msarett 2015/08/12 13:38:46 I don't feel strongly on this. Looks fine to me.
72 return this->onInIco();
73 }
74
75 virtual bool onInIco() const {
76 return false;
77 }
70 78
71 /* 79 /*
72 * Get the destination row to start filling from 80 * Get the destination row to start filling from
73 * Used to fill the remainder of the image on incomplete input for bmps 81 * Used to fill the remainder of the image on incomplete input for bmps
74 * This is tricky since bmps may be kTopDown or kBottomUp. For kTopDown, 82 * This is tricky since bmps may be kTopDown or kBottomUp. For kTopDown,
75 * we start filling from where we left off, but for kBottomUp we start 83 * we start filling from where we left off, but for kBottomUp we start
76 * filling at the top of the image. 84 * filling at the top of the image.
77 */ 85 */
78 void* getDstStartRow(void* dst, size_t dstRowBytes, int32_t y) const; 86 void* getDstStartRow(void* dst, size_t dstRowBytes, int32_t y) const;
79 87
(...skipping 16 matching lines...) Expand all
96 */ 104 */
97 static SkCodec* NewFromStream(SkStream*, bool inIco); 105 static SkCodec* NewFromStream(SkStream*, bool inIco);
98 106
99 const uint16_t fBitsPerPixel; 107 const uint16_t fBitsPerPixel;
100 const RowOrder fRowOrder; 108 const RowOrder fRowOrder;
101 109
102 typedef SkCodec INHERITED; 110 typedef SkCodec INHERITED;
103 }; 111 };
104 112
105 #endif 113 #endif
OLDNEW
« no previous file with comments | « include/codec/SkCodec.h ('k') | src/codec/SkBmpCodec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698