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 30 matching lines...) Expand all Loading... |
41 alpha_blend_source_(kBlendAtopPreviousFrame), | 41 alpha_blend_source_(kBlendAtopPreviousFrame), |
42 premultiply_alpha_(true), | 42 premultiply_alpha_(true), |
43 pixels_changed_(false), | 43 pixels_changed_(false), |
44 required_previous_frame_index_(kNotFound) {} | 44 required_previous_frame_index_(kNotFound) {} |
45 | 45 |
46 ImageFrame& ImageFrame::operator=(const ImageFrame& other) { | 46 ImageFrame& ImageFrame::operator=(const ImageFrame& other) { |
47 if (this == &other) | 47 if (this == &other) |
48 return *this; | 48 return *this; |
49 | 49 |
50 bitmap_ = other.bitmap_; | 50 bitmap_ = other.bitmap_; |
51 // Keep the pixels locked since we will be writing directly into the | |
52 // bitmap throughout this object's lifetime. | |
53 bitmap_.lockPixels(); | |
54 // Be sure to assign this before calling setStatus(), since setStatus() may | 51 // Be sure to assign this before calling setStatus(), since setStatus() may |
55 // call notifyBitmapIfPixelsChanged(). | 52 // call notifyBitmapIfPixelsChanged(). |
56 pixels_changed_ = other.pixels_changed_; | 53 pixels_changed_ = other.pixels_changed_; |
57 SetMemoryAllocator(other.GetAllocator()); | 54 SetMemoryAllocator(other.GetAllocator()); |
58 SetOriginalFrameRect(other.OriginalFrameRect()); | 55 SetOriginalFrameRect(other.OriginalFrameRect()); |
59 SetStatus(other.GetStatus()); | 56 SetStatus(other.GetStatus()); |
60 SetDuration(other.Duration()); | 57 SetDuration(other.Duration()); |
61 SetDisposalMethod(other.GetDisposalMethod()); | 58 SetDisposalMethod(other.GetDisposalMethod()); |
62 SetAlphaBlendSource(other.GetAlphaBlendSource()); | 59 SetAlphaBlendSource(other.GetAlphaBlendSource()); |
63 SetPremultiplyAlpha(other.PremultiplyAlpha()); | 60 SetPremultiplyAlpha(other.PremultiplyAlpha()); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 // If the frame is not fully loaded, there will be transparent pixels, | 199 // If the frame is not fully loaded, there will be transparent pixels, |
203 // so we can't tell skia we're opaque, even for image types that logically | 200 // so we can't tell skia we're opaque, even for image types that logically |
204 // always are (e.g. jpeg). | 201 // always are (e.g. jpeg). |
205 if (!has_alpha_ && status_ == kFrameComplete) | 202 if (!has_alpha_ && status_ == kFrameComplete) |
206 return kOpaque_SkAlphaType; | 203 return kOpaque_SkAlphaType; |
207 | 204 |
208 return premultiply_alpha_ ? kPremul_SkAlphaType : kUnpremul_SkAlphaType; | 205 return premultiply_alpha_ ? kPremul_SkAlphaType : kUnpremul_SkAlphaType; |
209 } | 206 } |
210 | 207 |
211 } // namespace blink | 208 } // namespace blink |
OLD | NEW |