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 Google, Inc. | 3 * Copyright (C) 2008, 2009 Google, Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 21 matching lines...) Expand all Loading... |
32 ImageFrame::ImageFrame() | 32 ImageFrame::ImageFrame() |
33 : m_allocator(0) | 33 : m_allocator(0) |
34 , m_hasAlpha(false) | 34 , m_hasAlpha(false) |
35 , m_status(FrameEmpty) | 35 , m_status(FrameEmpty) |
36 , m_duration(0) | 36 , m_duration(0) |
37 , m_disposalMethod(DisposeNotSpecified) | 37 , m_disposalMethod(DisposeNotSpecified) |
38 , m_alphaBlendSource(BlendAtopPreviousFrame) | 38 , m_alphaBlendSource(BlendAtopPreviousFrame) |
39 , m_premultiplyAlpha(true) | 39 , m_premultiplyAlpha(true) |
40 , m_pixelsChanged(false) | 40 , m_pixelsChanged(false) |
41 , m_requiredPreviousFrameIndex(kNotFound) | 41 , m_requiredPreviousFrameIndex(kNotFound) |
42 #if !ASSERT_DISABLED | 42 #if ASSERT_ENABLED |
43 , m_requiredPreviousFrameIndexValid(false) | 43 , m_requiredPreviousFrameIndexValid(false) |
44 #endif | 44 #endif |
45 { | 45 { |
46 } | 46 } |
47 | 47 |
48 ImageFrame& ImageFrame::operator=(const ImageFrame& other) | 48 ImageFrame& ImageFrame::operator=(const ImageFrame& other) |
49 { | 49 { |
50 if (this == &other) | 50 if (this == &other) |
51 return *this; | 51 return *this; |
52 | 52 |
53 m_bitmap = other.m_bitmap; | 53 m_bitmap = other.m_bitmap; |
54 // Keep the pixels locked since we will be writing directly into the | 54 // Keep the pixels locked since we will be writing directly into the |
55 // bitmap throughout this object's lifetime. | 55 // bitmap throughout this object's lifetime. |
56 m_bitmap.lockPixels(); | 56 m_bitmap.lockPixels(); |
57 // Be sure to assign this before calling setStatus(), since setStatus() may | 57 // Be sure to assign this before calling setStatus(), since setStatus() may |
58 // call notifyBitmapIfPixelsChanged(). | 58 // call notifyBitmapIfPixelsChanged(). |
59 m_pixelsChanged = other.m_pixelsChanged; | 59 m_pixelsChanged = other.m_pixelsChanged; |
60 setMemoryAllocator(other.allocator()); | 60 setMemoryAllocator(other.allocator()); |
61 setOriginalFrameRect(other.originalFrameRect()); | 61 setOriginalFrameRect(other.originalFrameRect()); |
62 setStatus(other.status()); | 62 setStatus(other.status()); |
63 setDuration(other.duration()); | 63 setDuration(other.duration()); |
64 setDisposalMethod(other.disposalMethod()); | 64 setDisposalMethod(other.disposalMethod()); |
65 setAlphaBlendSource(other.alphaBlendSource()); | 65 setAlphaBlendSource(other.alphaBlendSource()); |
66 setPremultiplyAlpha(other.premultiplyAlpha()); | 66 setPremultiplyAlpha(other.premultiplyAlpha()); |
67 // Be sure that this is called after we've called setStatus(), since we | 67 // Be sure that this is called after we've called setStatus(), since we |
68 // look at our status to know what to do with the alpha value. | 68 // look at our status to know what to do with the alpha value. |
69 setHasAlpha(other.hasAlpha()); | 69 setHasAlpha(other.hasAlpha()); |
70 // Copy raw fields to avoid ASSERT failure in requiredPreviousFrameIndex(). | 70 // Copy raw fields to avoid ASSERT failure in requiredPreviousFrameIndex(). |
71 m_requiredPreviousFrameIndex = other.m_requiredPreviousFrameIndex; | 71 m_requiredPreviousFrameIndex = other.m_requiredPreviousFrameIndex; |
72 #if !ASSERT_DISABLED | 72 #if ASSERT_ENABLED |
73 m_requiredPreviousFrameIndexValid = other.m_requiredPreviousFrameIndexValid; | 73 m_requiredPreviousFrameIndexValid = other.m_requiredPreviousFrameIndexValid; |
74 #endif | 74 #endif |
75 return *this; | 75 return *this; |
76 } | 76 } |
77 | 77 |
78 void ImageFrame::clearPixelData() | 78 void ImageFrame::clearPixelData() |
79 { | 79 { |
80 m_bitmap.reset(); | 80 m_bitmap.reset(); |
81 m_status = FrameEmpty; | 81 m_status = FrameEmpty; |
82 // NOTE: Do not reset other members here; clearFrameBufferCache() | 82 // NOTE: Do not reset other members here; clearFrameBufferCache() |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 void ImageFrame::zeroFillFrameRect(const IntRect& rect) | 151 void ImageFrame::zeroFillFrameRect(const IntRect& rect) |
152 { | 152 { |
153 if (rect.isEmpty()) | 153 if (rect.isEmpty()) |
154 return; | 154 return; |
155 | 155 |
156 m_bitmap.eraseArea(rect, SkColorSetARGB(0, 0, 0, 0)); | 156 m_bitmap.eraseArea(rect, SkColorSetARGB(0, 0, 0, 0)); |
157 setHasAlpha(true); | 157 setHasAlpha(true); |
158 } | 158 } |
159 | 159 |
160 } // namespace WebCore | 160 } // namespace WebCore |
OLD | NEW |