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 30 matching lines...) Expand all Loading... |
41 #include <wtf/text/WTFString.h> | 41 #include <wtf/text/WTFString.h> |
42 | 42 |
43 #if USE(QCMSLIB) | 43 #if USE(QCMSLIB) |
44 #include "qcms.h" | 44 #include "qcms.h" |
45 #if OS(DARWIN) | 45 #if OS(DARWIN) |
46 #include "GraphicsContextCG.h" | 46 #include "GraphicsContextCG.h" |
47 #include <ApplicationServices/ApplicationServices.h> | 47 #include <ApplicationServices/ApplicationServices.h> |
48 #include <wtf/RetainPtr.h> | 48 #include <wtf/RetainPtr.h> |
49 #endif | 49 #endif |
50 #endif | 50 #endif |
| 51 #include <wtf/PassOwnPtr.h> |
51 | 52 |
52 namespace WebCore { | 53 namespace WebCore { |
53 | 54 |
54 // ImageFrame represents the decoded image data. This buffer is what all | 55 // ImageFrame represents the decoded image data. This buffer is what all |
55 // decoders write a single frame into. | 56 // decoders write a single frame into. |
56 class ImageFrame { | 57 class ImageFrame { |
57 public: | 58 public: |
58 enum FrameStatus { FrameEmpty, FramePartial, FrameComplete }; | 59 enum FrameStatus { FrameEmpty, FramePartial, FrameComplete }; |
59 enum FrameDisposalMethod { | 60 enum FrameDisposalMethod { |
60 // If you change the numeric values of these, make sure you audit | 61 // If you change the numeric values of these, make sure you audit |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 // (Actual use: This pointer will be owned by BitmapImage and freed in | 110 // (Actual use: This pointer will be owned by BitmapImage and freed in |
110 // FrameData::clear()). | 111 // FrameData::clear()). |
111 PassNativeImagePtr asNewNativeImage() const; | 112 PassNativeImagePtr asNewNativeImage() const; |
112 | 113 |
113 bool hasAlpha() const; | 114 bool hasAlpha() const; |
114 const IntRect& originalFrameRect() const { return m_originalFrameRect; } | 115 const IntRect& originalFrameRect() const { return m_originalFrameRect; } |
115 FrameStatus status() const { return m_status; } | 116 FrameStatus status() const { return m_status; } |
116 unsigned duration() const { return m_duration; } | 117 unsigned duration() const { return m_duration; } |
117 FrameDisposalMethod disposalMethod() const { return m_disposalMethod; } | 118 FrameDisposalMethod disposalMethod() const { return m_disposalMethod; } |
118 bool premultiplyAlpha() const { return m_premultiplyAlpha; } | 119 bool premultiplyAlpha() const { return m_premultiplyAlpha; } |
119 void reportMemoryUsage(MemoryObjectInfo*) const; | |
120 | 120 |
121 void setHasAlpha(bool alpha); | 121 void setHasAlpha(bool alpha); |
122 void setColorProfile(const ColorProfile&); | 122 void setColorProfile(const ColorProfile&); |
123 void setOriginalFrameRect(const IntRect& r) { m_originalFrameRect = r; } | 123 void setOriginalFrameRect(const IntRect& r) { m_originalFrameRect = r; } |
124 void setStatus(FrameStatus status); | 124 void setStatus(FrameStatus status); |
125 void setDuration(unsigned duration) { m_duration = duration; } | 125 void setDuration(unsigned duration) { m_duration = duration; } |
126 void setDisposalMethod(FrameDisposalMethod method) { m_disposalMethod =
method; } | 126 void setDisposalMethod(FrameDisposalMethod method) { m_disposalMethod =
method; } |
127 void setPremultiplyAlpha(bool premultiplyAlpha) { m_premultiplyAlpha = p
remultiplyAlpha; } | 127 void setPremultiplyAlpha(bool premultiplyAlpha) { m_premultiplyAlpha = p
remultiplyAlpha; } |
128 | 128 |
129 inline void setRGBA(int x, int y, unsigned r, unsigned g, unsigned b, un
signed a) | 129 inline void setRGBA(int x, int y, unsigned r, unsigned g, unsigned b, un
signed a) |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 virtual void clearFrameBufferCache(size_t) { } | 372 virtual void clearFrameBufferCache(size_t) { } |
373 | 373 |
374 #if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) | 374 #if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) |
375 void setMaxNumPixels(int m) { m_maxNumPixels = m; } | 375 void setMaxNumPixels(int m) { m_maxNumPixels = m; } |
376 #endif | 376 #endif |
377 | 377 |
378 // If the image has a cursor hot-spot, stores it in the argument | 378 // If the image has a cursor hot-spot, stores it in the argument |
379 // and returns true. Otherwise returns false. | 379 // and returns true. Otherwise returns false. |
380 virtual bool hotSpot(IntPoint&) const { return false; } | 380 virtual bool hotSpot(IntPoint&) const { return false; } |
381 | 381 |
382 virtual void reportMemoryUsage(MemoryObjectInfo*) const; | |
383 | |
384 virtual void setMemoryAllocator(SkBitmap::Allocator* allocator) | 382 virtual void setMemoryAllocator(SkBitmap::Allocator* allocator) |
385 { | 383 { |
386 // FIXME: this doesn't work for images with multiple frames. | 384 // FIXME: this doesn't work for images with multiple frames. |
387 if (m_frameBufferCache.isEmpty()) | 385 if (m_frameBufferCache.isEmpty()) |
388 m_frameBufferCache.resize(1); | 386 m_frameBufferCache.resize(1); |
389 m_frameBufferCache[0].setMemoryAllocator(allocator); | 387 m_frameBufferCache[0].setMemoryAllocator(allocator); |
390 } | 388 } |
391 | 389 |
392 protected: | 390 protected: |
393 void prepareScaleDataIfNecessary(); | 391 void prepareScaleDataIfNecessary(); |
(...skipping 27 matching lines...) Expand all Loading... |
421 IntSize m_size; | 419 IntSize m_size; |
422 bool m_sizeAvailable; | 420 bool m_sizeAvailable; |
423 int m_maxNumPixels; | 421 int m_maxNumPixels; |
424 bool m_isAllDataReceived; | 422 bool m_isAllDataReceived; |
425 bool m_failed; | 423 bool m_failed; |
426 }; | 424 }; |
427 | 425 |
428 } // namespace WebCore | 426 } // namespace WebCore |
429 | 427 |
430 #endif | 428 #endif |
OLD | NEW |