Chromium Code Reviews| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 bool DecodingImageGenerator::onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, | 65 bool DecodingImageGenerator::onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, |
| 66 SkPMColor ctable[], int* ctableCount) | 66 SkPMColor ctable[], int* ctableCount) |
| 67 { | 67 { |
| 68 TRACE_EVENT1("blink", "DecodingImageGenerator::getPixels", "index", static_c ast<int>(m_frameIndex)); | 68 TRACE_EVENT1("blink", "DecodingImageGenerator::getPixels", "index", static_c ast<int>(m_frameIndex)); |
| 69 | 69 |
| 70 // Implementation doesn't support scaling yet so make sure we're not given a different size. | 70 // Implementation doesn't support scaling yet so make sure we're not given a different size. |
| 71 if (info.width() != getInfo().width() || info.height() != getInfo().height() ) | 71 if (info.width() != getInfo().width() || info.height() != getInfo().height() ) |
| 72 return false; | 72 return false; |
| 73 | 73 |
| 74 if (info.colorType() != getInfo().colorType()) { | 74 if (info.colorType() != getInfo().colorType()) { |
| 75 // ImageFrame may have changed the owning SkBitmap to kOpaque_SkAlphaTyp e after sniffing the encoded data, so if we see a request | 75 // So far, only one implemented is RGB565 |
| 76 // for opaque, that is ok even if our initial alphatype was not opaque. | 76 if (info.colorType() != kRGB_565_SkColorType) |
| 77 return false; | 77 return false; |
| 78 } | 78 } |
| 79 | 79 |
| 80 PlatformInstrumentation::willDecodeLazyPixelRef(m_generationId); | 80 PlatformInstrumentation::willDecodeLazyPixelRef(m_generationId); |
| 81 bool decoded = m_frameGenerator->decodeAndScale(getInfo(), m_frameIndex, pix els, rowBytes); | 81 bool decoded = m_frameGenerator->decodeAndScale(info, m_frameIndex, pixels, rowBytes); |
| 82 PlatformInstrumentation::didDecodeLazyPixelRef(); | 82 PlatformInstrumentation::didDecodeLazyPixelRef(); |
| 83 | 83 |
| 84 return decoded; | 84 return decoded; |
| 85 } | 85 } |
| 86 | 86 |
| 87 bool DecodingImageGenerator::onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3], SkYUVColorSpace* colorSpace) | 87 bool DecodingImageGenerator::onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3], SkYUVColorSpace* colorSpace) |
| 88 { | 88 { |
| 89 if (!RuntimeEnabledFeatures::decodeToYUVEnabled()) | 89 if (!RuntimeEnabledFeatures::decodeToYUVEnabled()) |
| 90 return false; | 90 return false; |
| 91 | 91 |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 118 const IntSize size = decoder->size(); | 118 const IntSize size = decoder->size(); |
| 119 const SkImageInfo info = SkImageInfo::MakeN32Premul(size.width(), size.heigh t()); | 119 const SkImageInfo info = SkImageInfo::MakeN32Premul(size.width(), size.heigh t()); |
| 120 | 120 |
| 121 RefPtr<ImageFrameGenerator> frame = ImageFrameGenerator::create(SkISize::Mak e(size.width(), size.height()), buffer, true, false); | 121 RefPtr<ImageFrameGenerator> frame = ImageFrameGenerator::create(SkISize::Mak e(size.width(), size.height()), buffer, true, false); |
| 122 if (!frame) | 122 if (!frame) |
| 123 return 0; | 123 return 0; |
| 124 | 124 |
| 125 return new DecodingImageGenerator(frame, info, 0); | 125 return new DecodingImageGenerator(frame, info, 0); |
| 126 } | 126 } |
| 127 | 127 |
| 128 bool DecodingImageGenerator::onCanDecodeAndScale(const SkColorType targetType, c onst SkScalar scale, SkISize *availableSize, SkISize *lowerSize) | |
|
scroggo_chromium
2015/10/19 20:41:36
nit: I believe the "*" should go next to the type,
aleksandar.stojiljkovic
2015/10/20 09:51:12
Done.
| |
| 129 { | |
| 130 if (targetType == kRGB_565_SkColorType && targetType != getInfo().colorType( ) && scale == SK_Scalar1) { | |
| 131 return m_frameGenerator->canDecodeToRGB565(); | |
| 132 } | |
| 133 return DecodingImageGenerator::onCanDecodeAndScale(targetType, scale, availa bleSize, lowerSize); | |
|
scroggo_chromium
2015/10/19 20:41:36
This looks like infinite recursion, unless I'm mis
aleksandar.stojiljkovic
2015/10/20 09:51:12
Done.
| |
| 134 } | |
| 135 | |
| 128 } // namespace blink | 136 } // namespace blink |
| 129 | 137 |
| OLD | NEW |