| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 return ScaledImageFragment::createComplete(m_fullSize, index, fullSizeBi
tmap); | 306 return ScaledImageFragment::createComplete(m_fullSize, index, fullSizeBi
tmap); |
| 307 | 307 |
| 308 // If the image is progressively decoded we need to return a copy. | 308 // If the image is progressively decoded we need to return a copy. |
| 309 // This is to avoid future decode operations writing to the same bitmap. | 309 // This is to avoid future decode operations writing to the same bitmap. |
| 310 // FIXME: Note that discardable allocator is used. This is because the code | 310 // FIXME: Note that discardable allocator is used. This is because the code |
| 311 // is still used in the Android discardable memory path. When this code is | 311 // is still used in the Android discardable memory path. When this code is |
| 312 // used in the Skia discardable memory path |m_discardableAllocator| is empt
y. | 312 // used in the Skia discardable memory path |m_discardableAllocator| is empt
y. |
| 313 // This is confusing and should be cleaned up when we can deprecate the use | 313 // This is confusing and should be cleaned up when we can deprecate the use |
| 314 // case for Android discardable memory. | 314 // case for Android discardable memory. |
| 315 SkBitmap copyBitmap; | 315 SkBitmap copyBitmap; |
| 316 if (!fullSizeBitmap.copyTo(©Bitmap, fullSizeBitmap.config(), m_discardab
leAllocator.get())) | 316 if (!fullSizeBitmap.copyTo(©Bitmap, fullSizeBitmap.colorType(), m_discar
dableAllocator.get())) |
| 317 return nullptr; | 317 return nullptr; |
| 318 | 318 |
| 319 if (isCacheComplete) | 319 if (isCacheComplete) |
| 320 return ScaledImageFragment::createComplete(m_fullSize, index, copyBitmap
); | 320 return ScaledImageFragment::createComplete(m_fullSize, index, copyBitmap
); |
| 321 return ScaledImageFragment::createPartial(m_fullSize, index, nextGenerationI
d(), copyBitmap); | 321 return ScaledImageFragment::createPartial(m_fullSize, index, nextGenerationI
d(), copyBitmap); |
| 322 } | 322 } |
| 323 | 323 |
| 324 bool ImageFrameGenerator::hasAlpha(size_t index) | 324 bool ImageFrameGenerator::hasAlpha(size_t index) |
| 325 { | 325 { |
| 326 MutexLocker lock(m_alphaMutex); | 326 MutexLocker lock(m_alphaMutex); |
| 327 if (index < m_hasAlpha.size()) | 327 if (index < m_hasAlpha.size()) |
| 328 return m_hasAlpha[index]; | 328 return m_hasAlpha[index]; |
| 329 return true; | 329 return true; |
| 330 } | 330 } |
| 331 | 331 |
| 332 } // namespace | 332 } // namespace |
| OLD | NEW |