| 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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 273     MutexLocker lock(m_alphaMutex); | 273     MutexLocker lock(m_alphaMutex); | 
| 274     if (index >= m_hasAlpha.size()) { | 274     if (index >= m_hasAlpha.size()) { | 
| 275         const size_t oldSize = m_hasAlpha.size(); | 275         const size_t oldSize = m_hasAlpha.size(); | 
| 276         m_hasAlpha.resize(index + 1); | 276         m_hasAlpha.resize(index + 1); | 
| 277         for (size_t i = oldSize; i < m_hasAlpha.size(); ++i) | 277         for (size_t i = oldSize; i < m_hasAlpha.size(); ++i) | 
| 278             m_hasAlpha[i] = true; | 278             m_hasAlpha[i] = true; | 
| 279     } | 279     } | 
| 280     m_hasAlpha[index] = hasAlpha; | 280     m_hasAlpha[index] = hasAlpha; | 
| 281 } | 281 } | 
| 282 | 282 | 
|  | 283 void ImageFrameGenerator::setDeviceProfile(ColorSpaceProfile* profile) | 
|  | 284 { | 
|  | 285     fprintf(stderr, "ImageFrameGenerator set device profile %p\n", profile); | 
|  | 286     m_deviceProfile = profile; | 
|  | 287 } | 
|  | 288 | 
| 283 bool ImageFrameGenerator::decode(size_t index, ImageDecoder** decoder, SkBitmap*
      bitmap) | 289 bool ImageFrameGenerator::decode(size_t index, ImageDecoder** decoder, SkBitmap*
      bitmap) | 
| 284 { | 290 { | 
| 285     TRACE_EVENT2("blink", "ImageFrameGenerator::decode", "width", m_fullSize.wid
     th(), "height", m_fullSize.height()); | 291     TRACE_EVENT2("blink", "ImageFrameGenerator::decode", "width", m_fullSize.wid
     th(), "height", m_fullSize.height()); | 
| 286 | 292 | 
| 287     ASSERT(decoder); | 293     ASSERT(decoder); | 
| 288     SharedBuffer* data = 0; | 294     SharedBuffer* data = 0; | 
| 289     bool allDataReceived = false; | 295     bool allDataReceived = false; | 
| 290     bool newDecoder = false; | 296     bool newDecoder = false; | 
| 291     m_data.data(&data, &allDataReceived); | 297     m_data.data(&data, &allDataReceived); | 
| 292 | 298 | 
| 293     // Try to create an ImageDecoder if we are not given one. | 299     // Try to create an ImageDecoder if we are not given one. | 
| 294     if (!*decoder) { | 300     if (!*decoder) { | 
| 295         newDecoder = true; | 301         newDecoder = true; | 
| 296         if (m_imageDecoderFactory) | 302         if (m_imageDecoderFactory) | 
| 297             *decoder = m_imageDecoderFactory->create().leakPtr(); | 303             *decoder = m_imageDecoderFactory->create().leakPtr(); | 
| 298 | 304 | 
| 299         if (!*decoder) | 305         if (!*decoder) { | 
| 300             *decoder = ImageDecoder::create(*data, ImageDecoder::AlphaPremultipl
     ied, ImageDecoder::GammaAndColorProfileApplied).leakPtr(); | 306             *decoder = ImageDecoder::create(*data, ImageDecoder::AlphaPremultipl
     ied, ImageDecoder::GammaAndColorProfileApplied).leakPtr(); | 
|  | 307             fprintf(stderr, "ImageFrameGenerator %p created decoder\n", this); | 
|  | 308             (*decoder)->setDeviceProfile(m_deviceProfile.get()); | 
|  | 309         } | 
| 301 | 310 | 
| 302         if (!*decoder) | 311         if (!*decoder) | 
| 303             return false; | 312             return false; | 
| 304     } | 313     } | 
| 305 | 314 | 
| 306     if (!m_isMultiFrame && newDecoder && allDataReceived) { | 315     if (!m_isMultiFrame && newDecoder && allDataReceived) { | 
| 307         // If we're using an external memory allocator that means we're decoding | 316         // If we're using an external memory allocator that means we're decoding | 
| 308         // directly into the output memory and we can save one memcpy. | 317         // directly into the output memory and we can save one memcpy. | 
| 309         ASSERT(m_externalAllocator.get()); | 318         ASSERT(m_externalAllocator.get()); | 
| 310         (*decoder)->setMemoryAllocator(m_externalAllocator.get()); | 319         (*decoder)->setMemoryAllocator(m_externalAllocator.get()); | 
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 373 | 382 | 
| 374     // Setting a dummy ImagePlanes object signals to the decoder that we want to
      do YUV decoding. | 383     // Setting a dummy ImagePlanes object signals to the decoder that we want to
      do YUV decoding. | 
| 375     decoder->setData(data, allDataReceived); | 384     decoder->setData(data, allDataReceived); | 
| 376     OwnPtr<ImagePlanes> dummyImagePlanes = adoptPtr(new ImagePlanes); | 385     OwnPtr<ImagePlanes> dummyImagePlanes = adoptPtr(new ImagePlanes); | 
| 377     decoder->setImagePlanes(dummyImagePlanes.release()); | 386     decoder->setImagePlanes(dummyImagePlanes.release()); | 
| 378 | 387 | 
| 379     return updateYUVComponentSizes(decoder.get(), componentSizes, ImageDecoder::
     SizeForMemoryAllocation); | 388     return updateYUVComponentSizes(decoder.get(), componentSizes, ImageDecoder::
     SizeForMemoryAllocation); | 
| 380 } | 389 } | 
| 381 | 390 | 
| 382 } // namespace blink | 391 } // namespace blink | 
| OLD | NEW | 
|---|