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

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

Issue 1527433002: Deferred GIF image decodes should report decode failures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch for landing Created 5 years 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 if (info.width() != getInfo().width() || info.height() != getInfo().height() ) 63 if (info.width() != getInfo().width() || info.height() != getInfo().height() )
64 return false; 64 return false;
65 65
66 if (info.colorType() != getInfo().colorType()) { 66 if (info.colorType() != getInfo().colorType()) {
67 // blink::ImageFrame may have changed the owning SkBitmap to kOpaque_SkA lphaType after fully decoding the image frame, 67 // blink::ImageFrame may have changed the owning SkBitmap to kOpaque_SkA lphaType after fully decoding the image frame,
68 // so if we see a request for opaque, that is ok even if our initial alp ha type was not opaque. 68 // so if we see a request for opaque, that is ok even if our initial alp ha type was not opaque.
69 return false; 69 return false;
70 } 70 }
71 71
72 PlatformInstrumentation::willDecodeLazyPixelRef(m_generationId); 72 PlatformInstrumentation::willDecodeLazyPixelRef(m_generationId);
73 bool decoded = m_frameGenerator->decodeAndScale(getInfo(), m_frameIndex, pix els, rowBytes); 73 bool decoded = m_frameGenerator->decodeAndScale(m_frameIndex, getInfo(), pix els, rowBytes);
74 PlatformInstrumentation::didDecodeLazyPixelRef(); 74 PlatformInstrumentation::didDecodeLazyPixelRef();
75 75
76 return decoded; 76 return decoded;
77 } 77 }
78 78
79 bool DecodingImageGenerator::onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3], SkYUVColorSpace* colorSpace) 79 bool DecodingImageGenerator::onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3], SkYUVColorSpace* colorSpace)
80 { 80 {
81 if (!m_canYUVDecode) 81 if (!m_canYUVDecode)
82 return false; 82 return false;
83 83
84 bool requestingYUVSizes = !planes || !planes[0]; 84 bool requestingYUVSizes = !planes || !planes[0];
85 85
86 TRACE_EVENT1("blink", "DecodingImageGenerator::getYUV8Planes", requestingYUV Sizes ? "sizes" : "frame index", static_cast<int>(m_frameIndex)); 86 TRACE_EVENT1("blink", "DecodingImageGenerator::getYUV8Planes", requestingYUV Sizes ? "sizes" : "frame index", static_cast<int>(m_frameIndex));
87 87
88 if (requestingYUVSizes) 88 if (requestingYUVSizes)
89 return m_frameGenerator->getYUVComponentSizes(sizes); 89 return m_frameGenerator->getYUVComponentSizes(sizes);
90 90
91 if (colorSpace) 91 if (colorSpace)
92 *colorSpace = kJPEG_SkYUVColorSpace; 92 *colorSpace = kJPEG_SkYUVColorSpace;
93 93
94 PlatformInstrumentation::willDecodeLazyPixelRef(m_generationId); 94 PlatformInstrumentation::willDecodeLazyPixelRef(m_generationId);
95 bool decoded = m_frameGenerator->decodeToYUV(sizes, planes, rowBytes); 95 bool decoded = m_frameGenerator->decodeToYUV(m_frameIndex, sizes, planes, ro wBytes);
96 PlatformInstrumentation::didDecodeLazyPixelRef(); 96 PlatformInstrumentation::didDecodeLazyPixelRef();
97 97
98 return decoded; 98 return decoded;
99 } 99 }
100 100
101 SkImageGenerator* DecodingImageGenerator::create(SkData* data) 101 SkImageGenerator* DecodingImageGenerator::create(SkData* data)
102 { 102 {
103 RefPtr<SharedBuffer> buffer = SharedBuffer::create(data->bytes(), data->size ()); 103 RefPtr<SharedBuffer> buffer = SharedBuffer::create(data->bytes(), data->size ());
104 104
105 // We just need the size of the image, so we have to temporarily create an I mageDecoder. Since 105 // We just need the size of the image, so we have to temporarily create an I mageDecoder. Since
(...skipping 10 matching lines...) Expand all
116 const SkImageInfo info = SkImageInfo::MakeN32Premul(size.width(), size.heigh t()); 116 const SkImageInfo info = SkImageInfo::MakeN32Premul(size.width(), size.heigh t());
117 117
118 RefPtr<ImageFrameGenerator> frame = ImageFrameGenerator::create(SkISize::Mak e(size.width(), size.height()), buffer, true, false); 118 RefPtr<ImageFrameGenerator> frame = ImageFrameGenerator::create(SkISize::Mak e(size.width(), size.height()), buffer, true, false);
119 if (!frame) 119 if (!frame)
120 return 0; 120 return 0;
121 121
122 return new DecodingImageGenerator(frame, info, 0); 122 return new DecodingImageGenerator(frame, info, 0);
123 } 123 }
124 124
125 } // namespace blink 125 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698