| 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 | 32 |
| 33 namespace WebCore { | 33 namespace WebCore { |
| 34 | 34 |
| 35 ImageFrame::ImageFrame() | 35 ImageFrame::ImageFrame() |
| 36 : m_bitmap(NativeImageSkia::create()) | 36 : m_bitmap(NativeImageSkia::create()) |
| 37 , m_allocator(0) | 37 , m_allocator(0) |
| 38 , m_hasAlpha(false) | 38 , m_hasAlpha(false) |
| 39 , m_status(FrameEmpty) | 39 , m_status(FrameEmpty) |
| 40 , m_duration(0) | 40 , m_duration(0) |
| 41 , m_disposalMethod(DisposeNotSpecified) | 41 , m_disposalMethod(DisposeNotSpecified) |
| 42 , m_alphaBlendSource(BlendAtopPreviousFrame) |
| 42 , m_premultiplyAlpha(true) | 43 , m_premultiplyAlpha(true) |
| 43 , m_requiredPreviousFrameIndex(notFound) | 44 , m_requiredPreviousFrameIndex(notFound) |
| 44 #if !ASSERT_DISABLED | 45 #if !ASSERT_DISABLED |
| 45 , m_requiredPreviousFrameIndexValid(false) | 46 , m_requiredPreviousFrameIndexValid(false) |
| 46 #endif | 47 #endif |
| 47 { | 48 { |
| 48 } | 49 } |
| 49 | 50 |
| 50 ImageFrame& ImageFrame::operator=(const ImageFrame& other) | 51 ImageFrame& ImageFrame::operator=(const ImageFrame& other) |
| 51 { | 52 { |
| 52 if (this == &other) | 53 if (this == &other) |
| 53 return *this; | 54 return *this; |
| 54 | 55 |
| 55 m_bitmap = other.m_bitmap->clone(); | 56 m_bitmap = other.m_bitmap->clone(); |
| 56 // Keep the pixels locked since we will be writing directly into the | 57 // Keep the pixels locked since we will be writing directly into the |
| 57 // bitmap throughout this object's lifetime. | 58 // bitmap throughout this object's lifetime. |
| 58 m_bitmap->bitmap().lockPixels(); | 59 m_bitmap->bitmap().lockPixels(); |
| 59 setMemoryAllocator(other.allocator()); | 60 setMemoryAllocator(other.allocator()); |
| 60 setOriginalFrameRect(other.originalFrameRect()); | 61 setOriginalFrameRect(other.originalFrameRect()); |
| 61 setStatus(other.status()); | 62 setStatus(other.status()); |
| 62 setDuration(other.duration()); | 63 setDuration(other.duration()); |
| 63 setDisposalMethod(other.disposalMethod()); | 64 setDisposalMethod(other.disposalMethod()); |
| 65 setAlphaBlendSource(other.alphaBlendSource()); |
| 64 setPremultiplyAlpha(other.premultiplyAlpha()); | 66 setPremultiplyAlpha(other.premultiplyAlpha()); |
| 65 // 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 |
| 66 // 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. |
| 67 setHasAlpha(other.hasAlpha()); | 69 setHasAlpha(other.hasAlpha()); |
| 68 // Copy raw fields to avoid ASSERT failure in requiredPreviousFrameIndex(). | 70 // Copy raw fields to avoid ASSERT failure in requiredPreviousFrameIndex(). |
| 69 m_requiredPreviousFrameIndex = other.m_requiredPreviousFrameIndex; | 71 m_requiredPreviousFrameIndex = other.m_requiredPreviousFrameIndex; |
| 70 #if !ASSERT_DISABLED | 72 #if !ASSERT_DISABLED |
| 71 m_requiredPreviousFrameIndexValid = other.m_requiredPreviousFrameIndexValid; | 73 m_requiredPreviousFrameIndexValid = other.m_requiredPreviousFrameIndexValid; |
| 72 #endif | 74 #endif |
| 73 return *this; | 75 return *this; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 void ImageFrame::zeroFillFrameRect(const IntRect& rect) | 150 void ImageFrame::zeroFillFrameRect(const IntRect& rect) |
| 149 { | 151 { |
| 150 if (rect.isEmpty()) | 152 if (rect.isEmpty()) |
| 151 return; | 153 return; |
| 152 | 154 |
| 153 m_bitmap->bitmap().eraseArea(rect, SkColorSetARGB(0, 0, 0, 0)); | 155 m_bitmap->bitmap().eraseArea(rect, SkColorSetARGB(0, 0, 0, 0)); |
| 154 setHasAlpha(true); | 156 setHasAlpha(true); |
| 155 } | 157 } |
| 156 | 158 |
| 157 } // namespace WebCore | 159 } // namespace WebCore |
| OLD | NEW |