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

Side by Side Diff: Source/platform/image-decoders/ImageDecoder.cpp

Issue 418653002: Allowing YUV data to be retrieved from the JPEG Decoder. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed changes to ImageFrameGenerator for now Created 6 years, 5 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) Research In Motion Limited 2009-2010. All rights reserved. 2 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 inline bool matchesICOSignature(char* contents) 75 inline bool matchesICOSignature(char* contents)
76 { 76 {
77 return !memcmp(contents, "\x00\x00\x01\x00", 4); 77 return !memcmp(contents, "\x00\x00\x01\x00", 4);
78 } 78 }
79 79
80 inline bool matchesCURSignature(char* contents) 80 inline bool matchesCURSignature(char* contents)
81 { 81 {
82 return !memcmp(contents, "\x00\x00\x02\x00", 4); 82 return !memcmp(contents, "\x00\x00\x02\x00", 4);
83 } 83 }
84 84
85 DecodingBuffers::DecodingBuffers()
Noel Gordon 2014/07/25 15:55:01 Not the best place to add this: please move all th
sugoi1 2014/07/25 16:56:47 Done.
86 {
87 for (int i = 0; i < 3; ++i) {
88 m_planes[i] = 0;
89 m_rowBytes[i] = 0;
90 }
91 }
92
93 void DecodingBuffers::set(void* planes[3], size_t rowBytes[3])
94 {
95 for (int i = 0; i < 3; ++i) {
96 m_planes[i] = planes[i];
97 m_rowBytes[i] = rowBytes[i];
98 }
99 }
100
101 void* DecodingBuffers::getPlane(int i)
102 {
103 ASSERT((i >= 0) && i < 3);
104 return m_planes[i];
105 }
106
107 size_t DecodingBuffers::getRowBytes(int i) const
108 {
109 ASSERT((i >= 0) && i < 3);
110 return m_rowBytes[i];
111 }
112
85 PassOwnPtr<ImageDecoder> ImageDecoder::create(const SharedBuffer& data, ImageSou rce::AlphaOption alphaOption, ImageSource::GammaAndColorProfileOption gammaAndCo lorProfileOption) 113 PassOwnPtr<ImageDecoder> ImageDecoder::create(const SharedBuffer& data, ImageSou rce::AlphaOption alphaOption, ImageSource::GammaAndColorProfileOption gammaAndCo lorProfileOption)
86 { 114 {
87 static const unsigned longestSignatureLength = sizeof("RIFF????WEBPVP") - 1; 115 static const unsigned longestSignatureLength = sizeof("RIFF????WEBPVP") - 1;
88 ASSERT(longestSignatureLength == 14); 116 ASSERT(longestSignatureLength == 14);
89 117
90 size_t maxDecodedBytes = blink::Platform::current()->maxDecodedImageBytes(); 118 size_t maxDecodedBytes = blink::Platform::current()->maxDecodedImageBytes();
91 119
92 char contents[longestSignatureLength]; 120 char contents[longestSignatureLength];
93 if (copyFromSharedBuffer(contents, longestSignatureLength, data, 0) < longes tSignatureLength) 121 if (copyFromSharedBuffer(contents, longestSignatureLength, data, 0) < longes tSignatureLength)
94 return nullptr; 122 return nullptr;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 // Otherwise, the previous frame contributes to this frame. 226 // Otherwise, the previous frame contributes to this frame.
199 return (prevBuffer->originalFrameRect().contains(IntRect(IntPoint(), siz e())) 227 return (prevBuffer->originalFrameRect().contains(IntRect(IntPoint(), siz e()))
200 || (prevBuffer->requiredPreviousFrameIndex() == kNotFound)) ? kNotFo und : prevFrame; 228 || (prevBuffer->requiredPreviousFrameIndex() == kNotFound)) ? kNotFo und : prevFrame;
201 default: 229 default:
202 ASSERT_NOT_REACHED(); 230 ASSERT_NOT_REACHED();
203 return kNotFound; 231 return kNotFound;
204 } 232 }
205 } 233 }
206 234
207 } // namespace blink 235 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698