OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 #include "platform/graphics/DeferredImageDecoder.h" | 24 #include "platform/graphics/DeferredImageDecoder.h" |
25 #include "platform/image-decoders/bmp/BMPImageDecoder.h" | 25 #include "platform/image-decoders/bmp/BMPImageDecoder.h" |
26 #include "platform/image-decoders/gif/GIFImageDecoder.h" | 26 #include "platform/image-decoders/gif/GIFImageDecoder.h" |
27 #include "platform/image-decoders/ico/ICOImageDecoder.h" | 27 #include "platform/image-decoders/ico/ICOImageDecoder.h" |
28 #include "platform/image-decoders/jpeg/JPEGImageDecoder.h" | 28 #include "platform/image-decoders/jpeg/JPEGImageDecoder.h" |
29 #include "platform/image-decoders/png/PNGImageDecoder.h" | 29 #include "platform/image-decoders/png/PNGImageDecoder.h" |
30 #include "platform/image-decoders/webp/WEBPImageDecoder.h" | 30 #include "platform/image-decoders/webp/WEBPImageDecoder.h" |
31 #include "wtf/PassOwnPtr.h" | 31 #include "wtf/PassOwnPtr.h" |
32 | 32 |
33 namespace WebCore { | 33 namespace blink { |
34 | 34 |
35 static unsigned copyFromSharedBuffer(char* buffer, unsigned bufferLength, const
SharedBuffer& sharedBuffer, unsigned offset) | 35 static unsigned copyFromSharedBuffer(char* buffer, unsigned bufferLength, const
SharedBuffer& sharedBuffer, unsigned offset) |
36 { | 36 { |
37 unsigned bytesExtracted = 0; | 37 unsigned bytesExtracted = 0; |
38 const char* moreData; | 38 const char* moreData; |
39 while (unsigned moreDataLength = sharedBuffer.getSomeData(moreData, offset))
{ | 39 while (unsigned moreDataLength = sharedBuffer.getSomeData(moreData, offset))
{ |
40 unsigned bytesToCopy = std::min(bufferLength - bytesExtracted, moreDataL
ength); | 40 unsigned bytesToCopy = std::min(bufferLength - bytesExtracted, moreDataL
ength); |
41 memcpy(buffer + bytesExtracted, moreData, bytesToCopy); | 41 memcpy(buffer + bytesExtracted, moreData, bytesToCopy); |
42 bytesExtracted += bytesToCopy; | 42 bytesExtracted += bytesToCopy; |
43 if (bytesExtracted == bufferLength) | 43 if (bytesExtracted == bufferLength) |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 // this frame is a blank frame, so it can again be decoded alone. | 197 // this frame is a blank frame, so it can again be decoded alone. |
198 // Otherwise, the previous frame contributes to this frame. | 198 // Otherwise, the previous frame contributes to this frame. |
199 return (prevBuffer->originalFrameRect().contains(IntRect(IntPoint(), siz
e())) | 199 return (prevBuffer->originalFrameRect().contains(IntRect(IntPoint(), siz
e())) |
200 || (prevBuffer->requiredPreviousFrameIndex() == kNotFound)) ? kNotFo
und : prevFrame; | 200 || (prevBuffer->requiredPreviousFrameIndex() == kNotFound)) ? kNotFo
und : prevFrame; |
201 default: | 201 default: |
202 ASSERT_NOT_REACHED(); | 202 ASSERT_NOT_REACHED(); |
203 return kNotFound; | 203 return kNotFound; |
204 } | 204 } |
205 } | 205 } |
206 | 206 |
207 } // namespace WebCore | 207 } // namespace blink |
OLD | NEW |