| 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 * | 7 * |
| 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 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 #include "SkData.h" | 29 #include "SkData.h" |
| 30 #include "SkImageInfo.h" | 30 #include "SkImageInfo.h" |
| 31 #include "platform/PlatformInstrumentation.h" | 31 #include "platform/PlatformInstrumentation.h" |
| 32 #include "platform/SharedBuffer.h" | 32 #include "platform/SharedBuffer.h" |
| 33 #include "platform/TraceEvent.h" | 33 #include "platform/TraceEvent.h" |
| 34 #include "platform/graphics/ImageFrameGenerator.h" | 34 #include "platform/graphics/ImageFrameGenerator.h" |
| 35 | 35 |
| 36 namespace blink { | 36 namespace blink { |
| 37 | 37 |
| 38 bool DecodingImageGenerator::s_decodeToYUVEnabled = false; |
| 39 |
| 40 void DecodingImageGenerator::setDecodeToYUVEnabled(bool enabled) |
| 41 { |
| 42 s_decodeToYUVEnabled = enabled; |
| 43 } |
| 44 |
| 45 bool DecodingImageGenerator::decodeToYUVEnabled() |
| 46 { |
| 47 return s_decodeToYUVEnabled; |
| 48 } |
| 49 |
| 38 DecodingImageGenerator::DecodingImageGenerator(PassRefPtr<ImageFrameGenerator> f
rameGenerator, const SkImageInfo& info, size_t index) | 50 DecodingImageGenerator::DecodingImageGenerator(PassRefPtr<ImageFrameGenerator> f
rameGenerator, const SkImageInfo& info, size_t index) |
| 39 : m_frameGenerator(frameGenerator) | 51 : m_frameGenerator(frameGenerator) |
| 40 , m_imageInfo(info) | 52 , m_imageInfo(info) |
| 41 , m_frameIndex(index) | 53 , m_frameIndex(index) |
| 42 , m_generationId(0) | 54 , m_generationId(0) |
| 43 { | 55 { |
| 44 } | 56 } |
| 45 | 57 |
| 46 DecodingImageGenerator::~DecodingImageGenerator() | 58 DecodingImageGenerator::~DecodingImageGenerator() |
| 47 { | 59 { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 78 } | 90 } |
| 79 | 91 |
| 80 PlatformInstrumentation::willDecodeLazyPixelRef(m_generationId); | 92 PlatformInstrumentation::willDecodeLazyPixelRef(m_generationId); |
| 81 bool decoded = m_frameGenerator->decodeAndScale(m_imageInfo, m_frameIndex, p
ixels, rowBytes); | 93 bool decoded = m_frameGenerator->decodeAndScale(m_imageInfo, m_frameIndex, p
ixels, rowBytes); |
| 82 PlatformInstrumentation::didDecodeLazyPixelRef(); | 94 PlatformInstrumentation::didDecodeLazyPixelRef(); |
| 83 return decoded; | 95 return decoded; |
| 84 } | 96 } |
| 85 | 97 |
| 86 bool DecodingImageGenerator::onGetYUV8Planes(SkISize sizes[3], void* planes[3],
size_t rowBytes[3], SkYUVColorSpace* colorSpace) | 98 bool DecodingImageGenerator::onGetYUV8Planes(SkISize sizes[3], void* planes[3],
size_t rowBytes[3], SkYUVColorSpace* colorSpace) |
| 87 { | 99 { |
| 88 if (!planes || !planes[0]) { | 100 if (!decodeToYUVEnabled()) |
| 101 return false; |
| 102 |
| 103 if (!planes || !planes[0]) |
| 89 return m_frameGenerator->getYUVComponentSizes(sizes); | 104 return m_frameGenerator->getYUVComponentSizes(sizes); |
| 90 } | |
| 91 | 105 |
| 92 TRACE_EVENT0("blink", "DecodingImageGenerator::onGetYUV8Planes"); | 106 TRACE_EVENT0("blink", "DecodingImageGenerator::onGetYUV8Planes"); |
| 93 PlatformInstrumentation::willDecodeLazyPixelRef(m_generationId); | 107 PlatformInstrumentation::willDecodeLazyPixelRef(m_generationId); |
| 94 bool decoded = m_frameGenerator->decodeToYUV(sizes, planes, rowBytes); | 108 bool decoded = m_frameGenerator->decodeToYUV(sizes, planes, rowBytes); |
| 95 PlatformInstrumentation::didDecodeLazyPixelRef(); | 109 PlatformInstrumentation::didDecodeLazyPixelRef(); |
| 96 if (colorSpace) | 110 if (colorSpace) |
| 97 *colorSpace = kJPEG_SkYUVColorSpace; | 111 *colorSpace = kJPEG_SkYUVColorSpace; |
| 98 return decoded; | 112 return decoded; |
| 99 } | 113 } |
| 100 | 114 |
| 101 } // namespace blink | 115 } // namespace blink |
| OLD | NEW |