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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 void ImageFrame::clearPixelData() { | 71 void ImageFrame::clearPixelData() { |
72 m_bitmap.reset(); | 72 m_bitmap.reset(); |
73 m_status = FrameEmpty; | 73 m_status = FrameEmpty; |
74 // NOTE: Do not reset other members here; clearFrameBufferCache() | 74 // NOTE: Do not reset other members here; clearFrameBufferCache() |
75 // calls this to free the bitmap data, but other functions like | 75 // calls this to free the bitmap data, but other functions like |
76 // initFrameBuffer() and frameComplete() may still need to read | 76 // initFrameBuffer() and frameComplete() may still need to read |
77 // other metadata out of this frame later. | 77 // other metadata out of this frame later. |
78 } | 78 } |
79 | 79 |
80 void ImageFrame::zeroFillPixelData() { | 80 void ImageFrame::zeroFillPixelData() { |
| 81 setHasAlpha(true); |
81 m_bitmap.eraseARGB(0, 0, 0, 0); | 82 m_bitmap.eraseARGB(0, 0, 0, 0); |
82 m_hasAlpha = true; | |
83 } | 83 } |
84 | 84 |
85 bool ImageFrame::copyBitmapData(const ImageFrame& other) { | 85 bool ImageFrame::copyBitmapData(const ImageFrame& other) { |
86 DCHECK_NE(this, &other); | 86 DCHECK_NE(this, &other); |
87 m_hasAlpha = other.m_hasAlpha; | 87 m_hasAlpha = other.m_hasAlpha; |
88 m_bitmap.reset(); | 88 m_bitmap.reset(); |
89 return other.m_bitmap.copyTo(&m_bitmap, other.m_bitmap.colorType()); | 89 return other.m_bitmap.copyTo(&m_bitmap, other.m_bitmap.colorType()); |
90 } | 90 } |
91 | 91 |
92 bool ImageFrame::takeBitmapDataIfWritable(ImageFrame* other) { | 92 bool ImageFrame::takeBitmapDataIfWritable(ImageFrame* other) { |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 // 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, |
200 // 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 |
201 // always are (e.g. jpeg). | 201 // always are (e.g. jpeg). |
202 if (!m_hasAlpha && m_status == FrameComplete) | 202 if (!m_hasAlpha && m_status == FrameComplete) |
203 return kOpaque_SkAlphaType; | 203 return kOpaque_SkAlphaType; |
204 | 204 |
205 return m_premultiplyAlpha ? kPremul_SkAlphaType : kUnpremul_SkAlphaType; | 205 return m_premultiplyAlpha ? kPremul_SkAlphaType : kUnpremul_SkAlphaType; |
206 } | 206 } |
207 | 207 |
208 } // namespace blink | 208 } // namespace blink |
OLD | NEW |