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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 m_hasAlpha = other->m_hasAlpha; | 99 m_hasAlpha = other->m_hasAlpha; |
100 m_bitmap.reset(); | 100 m_bitmap.reset(); |
101 m_bitmap.swap(other->m_bitmap); | 101 m_bitmap.swap(other->m_bitmap); |
102 other->m_status = FrameEmpty; | 102 other->m_status = FrameEmpty; |
103 return true; | 103 return true; |
104 } | 104 } |
105 | 105 |
106 bool ImageFrame::setSizeAndColorProfile(int newWidth, | 106 bool ImageFrame::setSizeAndColorProfile(int newWidth, |
107 int newHeight, | 107 int newHeight, |
108 const ICCProfile& newIccProfile) { | 108 const ICCProfile& newIccProfile) { |
109 // setSizeAndColorProfile() should only be called once, it leaks memory otherw
ise. | 109 // setSizeAndColorProfile() should only be called once, it leaks memory |
| 110 // otherwise. |
110 ASSERT(!width() && !height()); | 111 ASSERT(!width() && !height()); |
111 | 112 |
112 sk_sp<SkColorSpace> colorSpace; | 113 sk_sp<SkColorSpace> colorSpace; |
113 if (RuntimeEnabledFeatures::colorCorrectRenderingEnabled()) { | 114 if (RuntimeEnabledFeatures::colorCorrectRenderingEnabled()) { |
114 if (newIccProfile.isEmpty()) | 115 if (newIccProfile.isEmpty()) |
115 colorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named); | 116 colorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named); |
116 else | 117 else |
117 colorSpace = | 118 colorSpace = |
118 SkColorSpace::NewICC(newIccProfile.data(), newIccProfile.size()); | 119 SkColorSpace::NewICC(newIccProfile.data(), newIccProfile.size()); |
119 DCHECK(colorSpace); | 120 DCHECK(colorSpace); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 // If the frame is not fully loaded, there will be transparent pixels, | 173 // If the frame is not fully loaded, there will be transparent pixels, |
173 // so we can't tell skia we're opaque, even for image types that logically | 174 // so we can't tell skia we're opaque, even for image types that logically |
174 // always are (e.g. jpeg). | 175 // always are (e.g. jpeg). |
175 if (!m_hasAlpha && m_status == FrameComplete) | 176 if (!m_hasAlpha && m_status == FrameComplete) |
176 return kOpaque_SkAlphaType; | 177 return kOpaque_SkAlphaType; |
177 | 178 |
178 return m_premultiplyAlpha ? kPremul_SkAlphaType : kUnpremul_SkAlphaType; | 179 return m_premultiplyAlpha ? kPremul_SkAlphaType : kUnpremul_SkAlphaType; |
179 } | 180 } |
180 | 181 |
181 } // namespace blink | 182 } // namespace blink |
OLD | NEW |