| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. |
| 3 * Copyright (C) 2008-2009 Torch Mobile, Inc. | 3 * Copyright (C) 2008-2009 Torch Mobile, Inc. |
| 4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
| 5 * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) | 5 * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) |
| 6 * | 6 * |
| 7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
| 8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
| 9 * are met: | 9 * are met: |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 } | 187 } |
| 188 | 188 |
| 189 int height() const | 189 int height() const |
| 190 { | 190 { |
| 191 return m_bitmap->bitmap().height(); | 191 return m_bitmap->bitmap().height(); |
| 192 } | 192 } |
| 193 | 193 |
| 194 RefPtr<NativeImageSkia> m_bitmap; | 194 RefPtr<NativeImageSkia> m_bitmap; |
| 195 SkBitmap::Allocator* m_allocator; | 195 SkBitmap::Allocator* m_allocator; |
| 196 bool m_hasAlpha; | 196 bool m_hasAlpha; |
| 197 IntRect m_originalFrameRect; // This will always just be the entire | 197 // This will always just be the entire buffer except for GIF or WebP |
| 198 // buffer except for GIF frames whose | 198 // frames whose original rect was smaller than the overall image size. |
| 199 // original rect was smaller than the | 199 IntRect m_originalFrameRect; |
| 200 // overall image size. | |
| 201 FrameStatus m_status; | 200 FrameStatus m_status; |
| 202 unsigned m_duration; | 201 unsigned m_duration; |
| 203 FrameDisposalMethod m_disposalMethod; | 202 FrameDisposalMethod m_disposalMethod; |
| 204 bool m_premultiplyAlpha; | 203 bool m_premultiplyAlpha; |
| 205 }; | 204 }; |
| 206 | 205 |
| 207 // ImageDecoder is a base for all format-specific decoders | 206 // ImageDecoder is a base for all format-specific decoders |
| 208 // (e.g. JPEGImageDecoder). This base manages the ImageFrame cache. | 207 // (e.g. JPEGImageDecoder). This base manages the ImageFrame cache. |
| 209 // | 208 // |
| 210 // ENABLE(IMAGE_DECODER_DOWN_SAMPLING) allows image decoders to downsample | 209 // ENABLE(IMAGE_DECODER_DOWN_SAMPLING) allows image decoders to downsample |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 | 250 |
| 252 virtual IntSize size() const { return m_size; } | 251 virtual IntSize size() const { return m_size; } |
| 253 | 252 |
| 254 IntSize scaledSize() const | 253 IntSize scaledSize() const |
| 255 { | 254 { |
| 256 return m_scaled ? IntSize(m_scaledColumns.size(), m_scaledRows.size(
)) : size(); | 255 return m_scaled ? IntSize(m_scaledColumns.size(), m_scaledRows.size(
)) : size(); |
| 257 } | 256 } |
| 258 | 257 |
| 259 // This will only differ from size() for ICO (where each frame is a | 258 // This will only differ from size() for ICO (where each frame is a |
| 260 // different icon) or other formats where different frames are different | 259 // different icon) or other formats where different frames are different |
| 261 // sizes. This does NOT differ from size() for GIF, since decoding GIFs | 260 // sizes. This does NOT differ from size() for GIF or WebP, since |
| 262 // composites any smaller frames against previous frames to create full- | 261 // decoding GIF or WebP composites any smaller frames against previous |
| 263 // size frames. | 262 // frames to create full-size frames. |
| 264 virtual IntSize frameSizeAtIndex(size_t) const | 263 virtual IntSize frameSizeAtIndex(size_t) const |
| 265 { | 264 { |
| 266 return size(); | 265 return size(); |
| 267 } | 266 } |
| 268 | 267 |
| 269 // Returns whether the size is legal (i.e. not going to result in | 268 // Returns whether the size is legal (i.e. not going to result in |
| 270 // overflow elsewhere). If not, marks decoding as failed. | 269 // overflow elsewhere). If not, marks decoding as failed. |
| 271 virtual bool setSize(unsigned width, unsigned height) | 270 virtual bool setSize(unsigned width, unsigned height) |
| 272 { | 271 { |
| 273 if (isOverSize(width, height)) | 272 if (isOverSize(width, height)) |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 // clean up any local data. | 364 // clean up any local data. |
| 366 virtual bool setFailed() | 365 virtual bool setFailed() |
| 367 { | 366 { |
| 368 m_failed = true; | 367 m_failed = true; |
| 369 return false; | 368 return false; |
| 370 } | 369 } |
| 371 | 370 |
| 372 bool failed() const { return m_failed; } | 371 bool failed() const { return m_failed; } |
| 373 | 372 |
| 374 // Clears decoded pixel data from before the provided frame unless that | 373 // Clears decoded pixel data from before the provided frame unless that |
| 375 // data may be needed to decode future frames (e.g. due to GIF frame | 374 // data may be needed to decode future frames (e.g. due to GIF/WebP |
| 376 // compositing). | 375 // frame compositing). |
| 377 virtual void clearFrameBufferCache(size_t) { } | 376 virtual void clearFrameBufferCache(size_t) { } |
| 378 | 377 |
| 379 #if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) | 378 #if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) |
| 380 void setMaxNumPixels(int m) { m_maxNumPixels = m; } | 379 void setMaxNumPixels(int m) { m_maxNumPixels = m; } |
| 381 #endif | 380 #endif |
| 382 | 381 |
| 383 // If the image has a cursor hot-spot, stores it in the argument | 382 // If the image has a cursor hot-spot, stores it in the argument |
| 384 // and returns true. Otherwise returns false. | 383 // and returns true. Otherwise returns false. |
| 385 virtual bool hotSpot(IntPoint&) const { return false; } | 384 virtual bool hotSpot(IntPoint&) const { return false; } |
| 386 | 385 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 IntSize m_size; | 423 IntSize m_size; |
| 425 bool m_sizeAvailable; | 424 bool m_sizeAvailable; |
| 426 int m_maxNumPixels; | 425 int m_maxNumPixels; |
| 427 bool m_isAllDataReceived; | 426 bool m_isAllDataReceived; |
| 428 bool m_failed; | 427 bool m_failed; |
| 429 }; | 428 }; |
| 430 | 429 |
| 431 } // namespace WebCore | 430 } // namespace WebCore |
| 432 | 431 |
| 433 #endif | 432 #endif |
| OLD | NEW |