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

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

Issue 1316203008: Never consolidate data in ICO decoder (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@FastSharedBuffer
Patch Set: Respond to pkasting@'s comments in patch set 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/platform/image-decoders/ico/ICOImageDecoder.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/image-decoders/ico/ICOImageDecoder.h
diff --git a/Source/platform/image-decoders/ico/ICOImageDecoder.h b/Source/platform/image-decoders/ico/ICOImageDecoder.h
index 5cc71c0c5e7c64a9f8cf3fc4025809c4e42bbae1..3e2923813b925de70c8025c7c8918cff36377b17 100644
--- a/Source/platform/image-decoders/ico/ICOImageDecoder.h
+++ b/Source/platform/image-decoders/ico/ICOImageDecoder.h
@@ -31,6 +31,7 @@
#ifndef ICOImageDecoder_h
#define ICOImageDecoder_h
+#include "platform/image-decoders/FastSharedBufferReader.h"
#include "platform/image-decoders/bmp/BMPImageReader.h"
namespace blink {
@@ -83,16 +84,24 @@ private:
size_t decodeFrameCount() override;
void decode(size_t index) override { decode(index, false); }
+ // TODO (scroggo): These functions are identical to functions in BMPImageReader. Share code?
+ inline uint8_t readUint8(size_t offset) const
+ {
+ return m_fastReader.getOneByte(m_decodedOffset + offset);
+ }
+
inline uint16_t readUint16(int offset) const
{
- // TODO (scroggo): This consolidates the data, meaning unnecessary copies.
- return BMPImageReader::readUint16(&m_data->data()[m_decodedOffset + offset]);
+ char buffer[2];
+ const char* data = m_fastReader.getConsecutiveData(m_decodedOffset + offset, 2, buffer);
+ return BMPImageReader::readUint16(data);
}
inline uint32_t readUint32(int offset) const
{
- // TODO (scroggo): This consolidates the data, meaning unnecessary copies.
- return BMPImageReader::readUint32(&m_data->data()[m_decodedOffset + offset]);
+ char buffer[4];
+ const char* data = m_fastReader.getConsecutiveData(m_decodedOffset + offset, 4, buffer);
+ return BMPImageReader::readUint32(data);
}
// If the desired PNGImageDecoder exists, gives it the appropriate data.
@@ -132,6 +141,8 @@ private:
// if the type could be determined.
ImageType imageTypeAtIndex(size_t);
+ FastSharedBufferReader m_fastReader;
+
// An index into |m_data| representing how much we've already decoded.
// Note that this only tracks data _this_ class decodes; once the
// BMPImageReader takes over this will not be updated further.
« no previous file with comments | « no previous file | Source/platform/image-decoders/ico/ICOImageDecoder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698