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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 RefPtr<NativeImageSkia> m_bitmap; | 221 RefPtr<NativeImageSkia> m_bitmap; |
222 SkBitmap::Allocator* m_allocator; | 222 SkBitmap::Allocator* m_allocator; |
223 #else | 223 #else |
224 Vector<PixelData> m_backingStore; | 224 Vector<PixelData> m_backingStore; |
225 PixelData* m_bytes; // The memory is backed by m_backingStore. | 225 PixelData* m_bytes; // The memory is backed by m_backingStore. |
226 IntSize m_size; | 226 IntSize m_size; |
227 // FIXME: Do we need m_colorProfile anymore? | 227 // FIXME: Do we need m_colorProfile anymore? |
228 ColorProfile m_colorProfile; | 228 ColorProfile m_colorProfile; |
229 #endif | 229 #endif |
230 bool m_hasAlpha; | 230 bool m_hasAlpha; |
231 IntRect m_originalFrameRect; // This will always just be the entire | 231 // This will always just be the entire buffer except for GIF or WebP |
232 // buffer except for GIF frames whose | 232 // frames whose original rect was smaller than the overall image size. |
233 // original rect was smaller than the | 233 IntRect m_originalFrameRect; |
234 // overall image size. | |
235 FrameStatus m_status; | 234 FrameStatus m_status; |
236 unsigned m_duration; | 235 unsigned m_duration; |
237 FrameDisposalMethod m_disposalMethod; | 236 FrameDisposalMethod m_disposalMethod; |
238 bool m_premultiplyAlpha; | 237 bool m_premultiplyAlpha; |
239 }; | 238 }; |
240 | 239 |
241 // ImageDecoder is a base for all format-specific decoders | 240 // ImageDecoder is a base for all format-specific decoders |
242 // (e.g. JPEGImageDecoder). This base manages the ImageFrame cache. | 241 // (e.g. JPEGImageDecoder). This base manages the ImageFrame cache. |
243 // | 242 // |
244 // ENABLE(IMAGE_DECODER_DOWN_SAMPLING) allows image decoders to downsample | 243 // ENABLE(IMAGE_DECODER_DOWN_SAMPLING) allows image decoders to downsample |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 | 284 |
286 virtual IntSize size() const { return m_size; } | 285 virtual IntSize size() const { return m_size; } |
287 | 286 |
288 IntSize scaledSize() const | 287 IntSize scaledSize() const |
289 { | 288 { |
290 return m_scaled ? IntSize(m_scaledColumns.size(), m_scaledRows.size(
)) : size(); | 289 return m_scaled ? IntSize(m_scaledColumns.size(), m_scaledRows.size(
)) : size(); |
291 } | 290 } |
292 | 291 |
293 // This will only differ from size() for ICO (where each frame is a | 292 // This will only differ from size() for ICO (where each frame is a |
294 // different icon) or other formats where different frames are different | 293 // different icon) or other formats where different frames are different |
295 // sizes. This does NOT differ from size() for GIF, since decoding GIFs | 294 // sizes. This does NOT differ from size() for GIF or WebP, since |
296 // composites any smaller frames against previous frames to create full- | 295 // decoding GIF or WebP composites any smaller frames against previous |
297 // size frames. | 296 // frames to create full-size frames. |
298 virtual IntSize frameSizeAtIndex(size_t) const | 297 virtual IntSize frameSizeAtIndex(size_t) const |
299 { | 298 { |
300 return size(); | 299 return size(); |
301 } | 300 } |
302 | 301 |
303 // Returns whether the size is legal (i.e. not going to result in | 302 // Returns whether the size is legal (i.e. not going to result in |
304 // overflow elsewhere). If not, marks decoding as failed. | 303 // overflow elsewhere). If not, marks decoding as failed. |
305 virtual bool setSize(unsigned width, unsigned height) | 304 virtual bool setSize(unsigned width, unsigned height) |
306 { | 305 { |
307 if (isOverSize(width, height)) | 306 if (isOverSize(width, height)) |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 // clean up any local data. | 392 // clean up any local data. |
394 virtual bool setFailed() | 393 virtual bool setFailed() |
395 { | 394 { |
396 m_failed = true; | 395 m_failed = true; |
397 return false; | 396 return false; |
398 } | 397 } |
399 | 398 |
400 bool failed() const { return m_failed; } | 399 bool failed() const { return m_failed; } |
401 | 400 |
402 // Clears decoded pixel data from before the provided frame unless that | 401 // Clears decoded pixel data from before the provided frame unless that |
403 // data may be needed to decode future frames (e.g. due to GIF frame | 402 // data may be needed to decode future frames (e.g. due to GIF/WebP |
404 // compositing). | 403 // frame compositing). |
405 virtual void clearFrameBufferCache(size_t) { } | 404 virtual void clearFrameBufferCache(size_t) { } |
406 | 405 |
407 #if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) | 406 #if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) |
408 void setMaxNumPixels(int m) { m_maxNumPixels = m; } | 407 void setMaxNumPixels(int m) { m_maxNumPixels = m; } |
409 #endif | 408 #endif |
410 | 409 |
411 // If the image has a cursor hot-spot, stores it in the argument | 410 // If the image has a cursor hot-spot, stores it in the argument |
412 // and returns true. Otherwise returns false. | 411 // and returns true. Otherwise returns false. |
413 virtual bool hotSpot(IntPoint&) const { return false; } | 412 virtual bool hotSpot(IntPoint&) const { return false; } |
414 | 413 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 IntSize m_size; | 454 IntSize m_size; |
456 bool m_sizeAvailable; | 455 bool m_sizeAvailable; |
457 int m_maxNumPixels; | 456 int m_maxNumPixels; |
458 bool m_isAllDataReceived; | 457 bool m_isAllDataReceived; |
459 bool m_failed; | 458 bool m_failed; |
460 }; | 459 }; |
461 | 460 |
462 } // namespace WebCore | 461 } // namespace WebCore |
463 | 462 |
464 #endif | 463 #endif |
OLD | NEW |