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

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

Issue 2434243003: Add onIsEncoded to image decoders. (Closed)
Patch Set: Created 4 years, 1 month 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 | « third_party/WebKit/Source/platform/graphics/DecodingImageGenerator.h ('k') | no next file » | 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 uint32_t uniqueID) 45 uint32_t uniqueID)
46 : SkImageGenerator(info, uniqueID), 46 : SkImageGenerator(info, uniqueID),
47 m_frameGenerator(frameGenerator), 47 m_frameGenerator(frameGenerator),
48 m_data(data), 48 m_data(data),
49 m_allDataReceived(allDataReceived), 49 m_allDataReceived(allDataReceived),
50 m_frameIndex(index), 50 m_frameIndex(index),
51 m_canYUVDecode(false) {} 51 m_canYUVDecode(false) {}
52 52
53 DecodingImageGenerator::~DecodingImageGenerator() {} 53 DecodingImageGenerator::~DecodingImageGenerator() {}
54 54
55 bool DecodingImageGenerator::onIsEncoded() const {
56 return true;
57 }
58
55 SkData* DecodingImageGenerator::onRefEncodedData(GrContext* ctx) { 59 SkData* DecodingImageGenerator::onRefEncodedData(GrContext* ctx) {
56 TRACE_EVENT0("blink", "DecodingImageGenerator::refEncodedData"); 60 TRACE_EVENT0("blink", "DecodingImageGenerator::refEncodedData");
57 61
58 // The GPU only wants the data if it has all been received, since the GPU 62 // The GPU only wants the data if it has all been received, since the GPU
59 // only wants a complete texture. getAsSkData() may require copying, so 63 // only wants a complete texture. getAsSkData() may require copying, so
60 // skip it and just return nullptr to avoid a slowdown. (See 64 // skip it and just return nullptr to avoid a slowdown. (See
61 // crbug.com/568016 for details about such a slowdown.) 65 // crbug.com/568016 for details about such a slowdown.)
62 // TODO (scroggo): Stop relying on the internal knowledge of how Skia uses 66 // TODO (scroggo): Stop relying on the internal knowledge of how Skia uses
63 // this. skbug.com/5485 67 // this. skbug.com/5485
64 if (ctx && !m_allDataReceived) 68 if (ctx && !m_allDataReceived)
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 RefPtr<ImageFrameGenerator> frame = ImageFrameGenerator::create( 157 RefPtr<ImageFrameGenerator> frame = ImageFrameGenerator::create(
154 SkISize::Make(size.width(), size.height()), false); 158 SkISize::Make(size.width(), size.height()), false);
155 if (!frame) 159 if (!frame)
156 return nullptr; 160 return nullptr;
157 161
158 return new DecodingImageGenerator(frame, info, segmentReader.release(), true, 162 return new DecodingImageGenerator(frame, info, segmentReader.release(), true,
159 0); 163 0);
160 } 164 }
161 165
162 } // namespace blink 166 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/DecodingImageGenerator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698