| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 bool ImageFrame::copyBitmapData(const ImageFrame& other) | 86 bool ImageFrame::copyBitmapData(const ImageFrame& other) |
| 87 { | 87 { |
| 88 if (this == &other) | 88 if (this == &other) |
| 89 return true; | 89 return true; |
| 90 | 90 |
| 91 m_hasAlpha = other.m_hasAlpha; | 91 m_hasAlpha = other.m_hasAlpha; |
| 92 m_bitmap.reset(); | 92 m_bitmap.reset(); |
| 93 return other.m_bitmap.copyTo(&m_bitmap, other.m_bitmap.colorType()); | 93 return other.m_bitmap.copyTo(&m_bitmap, other.m_bitmap.colorType()); |
| 94 } | 94 } |
| 95 | 95 |
| 96 bool ImageFrame::setSize(int newWidth, int newHeight) | 96 bool ImageFrame::setSizeAndColorProfile(int newWidth, int newHeight, const ICCPr
ofile& newIccProfile) |
| 97 { | 97 { |
| 98 // setSize() should only be called once, it leaks memory otherwise. | 98 // setSizeAndColorProfile() should only be called once, it leaks memory othe
rwise. |
| 99 ASSERT(!width() && !height()); | 99 ASSERT(!width() && !height()); |
| 100 | 100 |
| 101 // TODO(ccameron): Populate the color space parameter of the SkImageInfo |
| 102 // with newIccProfile, under a runtime flag. |
| 103 |
| 101 m_bitmap.setInfo(SkImageInfo::MakeN32(newWidth, newHeight, | 104 m_bitmap.setInfo(SkImageInfo::MakeN32(newWidth, newHeight, |
| 102 m_premultiplyAlpha ? kPremul_SkAlphaType : kUnpremul_SkAlphaType)); | 105 m_premultiplyAlpha ? kPremul_SkAlphaType : kUnpremul_SkAlphaType)); |
| 103 if (!m_bitmap.tryAllocPixels(m_allocator, 0)) | 106 if (!m_bitmap.tryAllocPixels(m_allocator, 0)) |
| 104 return false; | 107 return false; |
| 105 | 108 |
| 106 zeroFillPixelData(); | 109 zeroFillPixelData(); |
| 107 return true; | 110 return true; |
| 108 } | 111 } |
| 109 | 112 |
| 110 bool ImageFrame::hasAlpha() const | 113 bool ImageFrame::hasAlpha() const |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 // If the frame is not fully loaded, there will be transparent pixels, | 148 // If the frame is not fully loaded, there will be transparent pixels, |
| 146 // so we can't tell skia we're opaque, even for image types that logically | 149 // so we can't tell skia we're opaque, even for image types that logically |
| 147 // always are (e.g. jpeg). | 150 // always are (e.g. jpeg). |
| 148 if (!m_hasAlpha && m_status == FrameComplete) | 151 if (!m_hasAlpha && m_status == FrameComplete) |
| 149 return kOpaque_SkAlphaType; | 152 return kOpaque_SkAlphaType; |
| 150 | 153 |
| 151 return m_premultiplyAlpha ? kPremul_SkAlphaType : kUnpremul_SkAlphaType; | 154 return m_premultiplyAlpha ? kPremul_SkAlphaType : kUnpremul_SkAlphaType; |
| 152 } | 155 } |
| 153 | 156 |
| 154 } // namespace blink | 157 } // namespace blink |
| OLD | NEW |