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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 93 |
94 PlatformInstrumentation::willDecodeLazyPixelRef(uniqueID()); | 94 PlatformInstrumentation::willDecodeLazyPixelRef(uniqueID()); |
95 bool decoded = m_frameGenerator->decodeAndScale( | 95 bool decoded = m_frameGenerator->decodeAndScale( |
96 m_data.get(), m_allDataReceived, m_frameIndex, getInfo(), pixels, | 96 m_data.get(), m_allDataReceived, m_frameIndex, getInfo(), pixels, |
97 rowBytes); | 97 rowBytes); |
98 PlatformInstrumentation::didDecodeLazyPixelRef(); | 98 PlatformInstrumentation::didDecodeLazyPixelRef(); |
99 | 99 |
100 return decoded; | 100 return decoded; |
101 } | 101 } |
102 | 102 |
| 103 bool DecodingImageGenerator::onGenerateScaledPixels( |
| 104 const SkISize& scaledSize, |
| 105 const SkIPoint& subsetOrigin, |
| 106 const SkPixmap& subsetPixels, |
| 107 SkFilterQuality quality) { |
| 108 TRACE_EVENT1("blink", "DecodingImageGenerator::onGenerateScaledPixels", |
| 109 "frame index", static_cast<int>(m_frameIndex)); |
| 110 // TODO(aleksandar.stojiljkovic): sub-rect decoding, see crbug.com/671821. |
| 111 if (!subsetOrigin.isZero() || subsetPixels.width() != scaledSize.width() || |
| 112 subsetPixels.height() != subsetPixels.height()) |
| 113 return false; |
| 114 PlatformInstrumentation::willDecodeLazyPixelRef(uniqueID()); |
| 115 bool decoded = m_frameGenerator->decodeAndScale( |
| 116 m_data.get(), m_allDataReceived, m_frameIndex, |
| 117 getInfo().makeWH(scaledSize.width(), scaledSize.height()), |
| 118 subsetPixels.writable_addr(), subsetPixels.rowBytes(), quality); |
| 119 PlatformInstrumentation::didDecodeLazyPixelRef(); |
| 120 return decoded; |
| 121 } |
| 122 |
103 bool DecodingImageGenerator::onQueryYUV8(SkYUVSizeInfo* sizeInfo, | 123 bool DecodingImageGenerator::onQueryYUV8(SkYUVSizeInfo* sizeInfo, |
104 SkYUVColorSpace* colorSpace) const { | 124 SkYUVColorSpace* colorSpace) const { |
105 // YUV decoding does not currently support progressive decoding. See comment | 125 // YUV decoding does not currently support progressive decoding. See comment |
106 // in ImageFrameGenerator.h. | 126 // in ImageFrameGenerator.h. |
107 if (!m_canYUVDecode || !m_allDataReceived) | 127 if (!m_canYUVDecode || !m_allDataReceived) |
108 return false; | 128 return false; |
109 | 129 |
110 TRACE_EVENT1("blink", "DecodingImageGenerator::queryYUV8", "sizes", | 130 TRACE_EVENT1("blink", "DecodingImageGenerator::queryYUV8", "sizes", |
111 static_cast<int>(m_frameIndex)); | 131 static_cast<int>(m_frameIndex)); |
112 | 132 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 ImageFrameGenerator::create(SkISize::Make(size.width(), size.height()), | 175 ImageFrameGenerator::create(SkISize::Make(size.width(), size.height()), |
156 false, decoder->colorBehavior()); | 176 false, decoder->colorBehavior()); |
157 if (!frame) | 177 if (!frame) |
158 return nullptr; | 178 return nullptr; |
159 | 179 |
160 return new DecodingImageGenerator(frame, info, segmentReader.release(), true, | 180 return new DecodingImageGenerator(frame, info, segmentReader.release(), true, |
161 0); | 181 0); |
162 } | 182 } |
163 | 183 |
164 } // namespace blink | 184 } // namespace blink |
OLD | NEW |