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

Side by Side Diff: Source/platform/image-decoders/ico/ICOImageDecoder.h

Issue 1259083003: Do not consolidate data in BMPImageDecoder (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@SegmentedBuffer
Patch Set: Do not use a raw pointer Created 5 years, 3 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 | « Source/platform/image-decoders/bmp/BMPImageReader.cpp ('k') | no next file » | 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 (c) 2008, 2009, Google Inc. All rights reserved. 2 * Copyright (c) 2008, 2009, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 // Larger sizes, or greater bitdepths at the same size, are preferable. 78 // Larger sizes, or greater bitdepths at the same size, are preferable.
79 static bool compareEntries(const IconDirectoryEntry& a, const IconDirectoryE ntry& b); 79 static bool compareEntries(const IconDirectoryEntry& a, const IconDirectoryE ntry& b);
80 80
81 // ImageDecoder: 81 // ImageDecoder:
82 virtual void decodeSize() { decode(0, true); } 82 virtual void decodeSize() { decode(0, true); }
83 size_t decodeFrameCount() override; 83 size_t decodeFrameCount() override;
84 void decode(size_t index) override { decode(index, false); } 84 void decode(size_t index) override { decode(index, false); }
85 85
86 inline uint16_t readUint16(int offset) const 86 inline uint16_t readUint16(int offset) const
87 { 87 {
88 return BMPImageReader::readUint16(m_data.get(), m_decodedOffset + offset ); 88 // TODO (scroggo): This consolidates the data, meaning unnecessary copie s.
89 return BMPImageReader::readUint16(&m_data->data()[m_decodedOffset + offs et]);
89 } 90 }
90 91
91 inline uint32_t readUint32(int offset) const 92 inline uint32_t readUint32(int offset) const
92 { 93 {
93 return BMPImageReader::readUint32(m_data.get(), m_decodedOffset + offset ); 94 // TODO (scroggo): This consolidates the data, meaning unnecessary copie s.
95 return BMPImageReader::readUint32(&m_data->data()[m_decodedOffset + offs et]);
94 } 96 }
95 97
96 // If the desired PNGImageDecoder exists, gives it the appropriate data. 98 // If the desired PNGImageDecoder exists, gives it the appropriate data.
97 void setDataForPNGDecoderAtIndex(size_t); 99 void setDataForPNGDecoderAtIndex(size_t);
98 100
99 // Decodes the entry at |index|. If |onlySize| is true, stops decoding 101 // Decodes the entry at |index|. If |onlySize| is true, stops decoding
100 // after calculating the image size. If decoding fails but there is no 102 // after calculating the image size. If decoding fails but there is no
101 // more data coming, sets the "decode failure" flag. 103 // more data coming, sets the "decode failure" flag.
102 void decode(size_t index, bool onlySize); 104 void decode(size_t index, bool onlySize);
103 105
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 PNGDecoders m_pngDecoders; 151 PNGDecoders m_pngDecoders;
150 152
151 // Valid only while a BMPImageReader is decoding, this holds the size 153 // Valid only while a BMPImageReader is decoding, this holds the size
152 // for the particular entry being decoded. 154 // for the particular entry being decoded.
153 IntSize m_frameSize; 155 IntSize m_frameSize;
154 }; 156 };
155 157
156 } // namespace blink 158 } // namespace blink
157 159
158 #endif 160 #endif
OLDNEW
« no previous file with comments | « Source/platform/image-decoders/bmp/BMPImageReader.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698