| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 if (RuntimeEnabledFeatures::colorCorrectRenderingEnabled()) { | 117 if (RuntimeEnabledFeatures::colorCorrectRenderingEnabled()) { |
| 118 DCHECK(colorSpace); | 118 DCHECK(colorSpace); |
| 119 m_colorSpace = std::move(colorSpace); | 119 m_colorSpace = std::move(colorSpace); |
| 120 } else { | 120 } else { |
| 121 DCHECK(!colorSpace); | 121 DCHECK(!colorSpace); |
| 122 } | 122 } |
| 123 | 123 |
| 124 m_bitmap.setInfo(SkImageInfo::MakeN32( | 124 m_bitmap.setInfo(SkImageInfo::MakeN32( |
| 125 newWidth, newHeight, | 125 newWidth, newHeight, |
| 126 m_premultiplyAlpha ? kPremul_SkAlphaType : kUnpremul_SkAlphaType, | 126 m_premultiplyAlpha ? kPremul_SkAlphaType : kUnpremul_SkAlphaType, |
| 127 std::move(colorSpace))); | 127 m_colorSpace)); |
| 128 if (!m_bitmap.tryAllocPixels(m_allocator, 0)) | 128 if (!m_bitmap.tryAllocPixels(m_allocator, 0)) |
| 129 return false; | 129 return false; |
| 130 | 130 |
| 131 zeroFillPixelData(); | 131 zeroFillPixelData(); |
| 132 return true; | 132 return true; |
| 133 } | 133 } |
| 134 | 134 |
| 135 bool ImageFrame::hasAlpha() const { | 135 bool ImageFrame::hasAlpha() const { |
| 136 return m_hasAlpha; | 136 return m_hasAlpha; |
| 137 } | 137 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 // If the frame is not fully loaded, there will be transparent pixels, | 174 // If the frame is not fully loaded, there will be transparent pixels, |
| 175 // so we can't tell skia we're opaque, even for image types that logically | 175 // so we can't tell skia we're opaque, even for image types that logically |
| 176 // always are (e.g. jpeg). | 176 // always are (e.g. jpeg). |
| 177 if (!m_hasAlpha && m_status == FrameComplete) | 177 if (!m_hasAlpha && m_status == FrameComplete) |
| 178 return kOpaque_SkAlphaType; | 178 return kOpaque_SkAlphaType; |
| 179 | 179 |
| 180 return m_premultiplyAlpha ? kPremul_SkAlphaType : kUnpremul_SkAlphaType; | 180 return m_premultiplyAlpha ? kPremul_SkAlphaType : kUnpremul_SkAlphaType; |
| 181 } | 181 } |
| 182 | 182 |
| 183 } // namespace blink | 183 } // namespace blink |
| OLD | NEW |