| 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 } | 188 } |
| 189 | 189 |
| 190 int height() const | 190 int height() const |
| 191 { | 191 { |
| 192 return m_bitmap->bitmap().height(); | 192 return m_bitmap->bitmap().height(); |
| 193 } | 193 } |
| 194 | 194 |
| 195 RefPtr<NativeImageSkia> m_bitmap; | 195 RefPtr<NativeImageSkia> m_bitmap; |
| 196 SkBitmap::Allocator* m_allocator; | 196 SkBitmap::Allocator* m_allocator; |
| 197 bool m_hasAlpha; | 197 bool m_hasAlpha; |
| 198 IntRect m_originalFrameRect; // This will always just be the entire | 198 // This will always just be the entire buffer except for GIF or WebP |
| 199 // buffer except for GIF frames whose | 199 // frames whose original rect was smaller than the overall image size. |
| 200 // original rect was smaller than the | 200 IntRect m_originalFrameRect; |
| 201 // overall image size. | |
| 202 FrameStatus m_status; | 201 FrameStatus m_status; |
| 203 unsigned m_duration; | 202 unsigned m_duration; |
| 204 FrameDisposalMethod m_disposalMethod; | 203 FrameDisposalMethod m_disposalMethod; |
| 205 bool m_premultiplyAlpha; | 204 bool m_premultiplyAlpha; |
| 206 }; | 205 }; |
| 207 | 206 |
| 208 // ImageDecoder is a base for all format-specific decoders | 207 // ImageDecoder is a base for all format-specific decoders |
| 209 // (e.g. JPEGImageDecoder). This base manages the ImageFrame cache. | 208 // (e.g. JPEGImageDecoder). This base manages the ImageFrame cache. |
| 210 // | 209 // |
| 211 // ENABLE(IMAGE_DECODER_DOWN_SAMPLING) allows image decoders to downsample | 210 // ENABLE(IMAGE_DECODER_DOWN_SAMPLING) allows image decoders to downsample |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 | 251 |
| 253 virtual IntSize size() const { return m_size; } | 252 virtual IntSize size() const { return m_size; } |
| 254 | 253 |
| 255 IntSize scaledSize() const | 254 IntSize scaledSize() const |
| 256 { | 255 { |
| 257 return m_scaled ? IntSize(m_scaledColumns.size(), m_scaledRows.size(
)) : size(); | 256 return m_scaled ? IntSize(m_scaledColumns.size(), m_scaledRows.size(
)) : size(); |
| 258 } | 257 } |
| 259 | 258 |
| 260 // This will only differ from size() for ICO (where each frame is a | 259 // This will only differ from size() for ICO (where each frame is a |
| 261 // different icon) or other formats where different frames are different | 260 // different icon) or other formats where different frames are different |
| 262 // sizes. This does NOT differ from size() for GIF, since decoding GIFs | 261 // sizes. This does NOT differ from size() for GIF or WebP, since |
| 263 // composites any smaller frames against previous frames to create full- | 262 // decoding GIF or WebP composites any smaller frames against previous |
| 264 // size frames. | 263 // frames to create full-size frames. |
| 265 virtual IntSize frameSizeAtIndex(size_t) const | 264 virtual IntSize frameSizeAtIndex(size_t) const |
| 266 { | 265 { |
| 267 return size(); | 266 return size(); |
| 268 } | 267 } |
| 269 | 268 |
| 270 // Returns whether the size is legal (i.e. not going to result in | 269 // Returns whether the size is legal (i.e. not going to result in |
| 271 // overflow elsewhere). If not, marks decoding as failed. | 270 // overflow elsewhere). If not, marks decoding as failed. |
| 272 virtual bool setSize(unsigned width, unsigned height) | 271 virtual bool setSize(unsigned width, unsigned height) |
| 273 { | 272 { |
| 274 if (isOverSize(width, height)) | 273 if (isOverSize(width, height)) |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 // clean up any local data. | 359 // clean up any local data. |
| 361 virtual bool setFailed() | 360 virtual bool setFailed() |
| 362 { | 361 { |
| 363 m_failed = true; | 362 m_failed = true; |
| 364 return false; | 363 return false; |
| 365 } | 364 } |
| 366 | 365 |
| 367 bool failed() const { return m_failed; } | 366 bool failed() const { return m_failed; } |
| 368 | 367 |
| 369 // Clears decoded pixel data from before the provided frame unless that | 368 // Clears decoded pixel data from before the provided frame unless that |
| 370 // data may be needed to decode future frames (e.g. due to GIF frame | 369 // data may be needed to decode future frames (e.g. due to GIF/WebP |
| 371 // compositing). | 370 // frame compositing). |
| 372 virtual void clearFrameBufferCache(size_t) { } | 371 virtual void clearFrameBufferCache(size_t) { } |
| 373 | 372 |
| 374 #if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) | 373 #if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) |
| 375 void setMaxNumPixels(int m) { m_maxNumPixels = m; } | 374 void setMaxNumPixels(int m) { m_maxNumPixels = m; } |
| 376 #endif | 375 #endif |
| 377 | 376 |
| 378 // If the image has a cursor hot-spot, stores it in the argument | 377 // If the image has a cursor hot-spot, stores it in the argument |
| 379 // and returns true. Otherwise returns false. | 378 // and returns true. Otherwise returns false. |
| 380 virtual bool hotSpot(IntPoint&) const { return false; } | 379 virtual bool hotSpot(IntPoint&) const { return false; } |
| 381 | 380 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 IntSize m_size; | 420 IntSize m_size; |
| 422 bool m_sizeAvailable; | 421 bool m_sizeAvailable; |
| 423 int m_maxNumPixels; | 422 int m_maxNumPixels; |
| 424 bool m_isAllDataReceived; | 423 bool m_isAllDataReceived; |
| 425 bool m_failed; | 424 bool m_failed; |
| 426 }; | 425 }; |
| 427 | 426 |
| 428 } // namespace WebCore | 427 } // namespace WebCore |
| 429 | 428 |
| 430 #endif | 429 #endif |
| OLD | NEW |