Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/DecodingImageGenerator.cpp

Issue 1719533002: Modify YUV codecs to match Skia's API change (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ASSERT in base class YUV implementations, Use ArrayBuffer Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 return false; 68 return false;
69 } 69 }
70 70
71 PlatformInstrumentation::willDecodeLazyPixelRef(m_generationId); 71 PlatformInstrumentation::willDecodeLazyPixelRef(m_generationId);
72 bool decoded = m_frameGenerator->decodeAndScale(m_frameIndex, getInfo(), pix els, rowBytes); 72 bool decoded = m_frameGenerator->decodeAndScale(m_frameIndex, getInfo(), pix els, rowBytes);
73 PlatformInstrumentation::didDecodeLazyPixelRef(); 73 PlatformInstrumentation::didDecodeLazyPixelRef();
74 74
75 return decoded; 75 return decoded;
76 } 76 }
77 77
78 bool DecodingImageGenerator::onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3], SkYUVColorSpace* colorSpace) 78 bool DecodingImageGenerator::onQueryYUV8(SkYUVSizeInfo* sizeInfo, SkYUVColorSpac e* colorSpace) const
79 { 79 {
80 if (!m_canYUVDecode) 80 if (!m_canYUVDecode)
81 return false; 81 return false;
82 82
83 bool requestingYUVSizes = !planes || !planes[0]; 83 TRACE_EVENT1("blink", "DecodingImageGenerator::getYUV8Planes", "sizes", stat ic_cast<int>(m_frameIndex));
Noel Gordon 2016/03/01 02:27:48 DecodingImageGenerator::getYUV8Planes -> DecodingI
msarett 2016/03/01 18:00:37 Yes nice catch!
84
85 TRACE_EVENT1("blink", "DecodingImageGenerator::getYUV8Planes", requestingYUV Sizes ? "sizes" : "frame index", static_cast<int>(m_frameIndex));
86
87 if (requestingYUVSizes)
88 return m_frameGenerator->getYUVComponentSizes(sizes);
89 84
90 if (colorSpace) 85 if (colorSpace)
91 *colorSpace = kJPEG_SkYUVColorSpace; 86 *colorSpace = kJPEG_SkYUVColorSpace;
92 87
88 return m_frameGenerator->getYUVComponentSizes(sizeInfo);
89 }
90
91 bool DecodingImageGenerator::onGetYUV8Planes(const SkYUVSizeInfo& sizeInfo, void * planes[3])
92 {
93 ASSERT(m_canYUVDecode);
94
95 TRACE_EVENT1("blink", "DecodingImageGenerator::getYUV8Planes", "frame index" , static_cast<int>(m_frameIndex));
96
93 PlatformInstrumentation::willDecodeLazyPixelRef(m_generationId); 97 PlatformInstrumentation::willDecodeLazyPixelRef(m_generationId);
94 bool decoded = m_frameGenerator->decodeToYUV(m_frameIndex, sizes, planes, ro wBytes); 98 bool decoded = m_frameGenerator->decodeToYUV(m_frameIndex, sizeInfo.fSizes, planes, sizeInfo.fWidthBytes);
95 PlatformInstrumentation::didDecodeLazyPixelRef(); 99 PlatformInstrumentation::didDecodeLazyPixelRef();
96 100
97 return decoded; 101 return decoded;
98 } 102 }
99 103
100 SkImageGenerator* DecodingImageGenerator::create(SkData* data) 104 SkImageGenerator* DecodingImageGenerator::create(SkData* data)
101 { 105 {
102 RefPtr<SharedBuffer> buffer = SharedBuffer::create(data->bytes(), data->size ()); 106 RefPtr<SharedBuffer> buffer = SharedBuffer::create(data->bytes(), data->size ());
103 107
104 // We just need the size of the image, so we have to temporarily create an I mageDecoder. Since 108 // We just need the size of the image, so we have to temporarily create an I mageDecoder. Since
(...skipping 10 matching lines...) Expand all
115 const SkImageInfo info = SkImageInfo::MakeN32Premul(size.width(), size.heigh t()); 119 const SkImageInfo info = SkImageInfo::MakeN32Premul(size.width(), size.heigh t());
116 120
117 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);
118 if (!frame) 122 if (!frame)
119 return 0; 123 return 0;
120 124
121 return new DecodingImageGenerator(frame, info, 0); 125 return new DecodingImageGenerator(frame, info, 0);
122 } 126 }
123 127
124 } // namespace blink 128 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698