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

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

Issue 2930513004: [WIP] Move ImageDecoders to SkCodec
Patch Set: Adding check for decoder creation Created 3 years, 6 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) 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
3 * Copyright (C) 2007 Alp Toker <alp.toker@collabora.co.uk> 3 * Copyright (C) 2007 Alp Toker <alp.toker@collabora.co.uk>
4 * Copyright (C) 2008, Google Inc. All rights reserved. 4 * Copyright (C) 2008, Google Inc. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 decoder_->SetData(std::move(data), all_data_received); 53 decoder_->SetData(std::move(data), all_data_received);
54 // If the decoder is pre-instantiated, it means we've already validated the 54 // If the decoder is pre-instantiated, it means we've already validated the
55 // data/signature at some point. 55 // data/signature at some point.
56 return true; 56 return true;
57 } 57 }
58 58
59 decoder_ = DeferredImageDecoder::Create(data, all_data_received, 59 decoder_ = DeferredImageDecoder::Create(data, all_data_received,
60 ImageDecoder::kAlphaPremultiplied, 60 ImageDecoder::kAlphaPremultiplied,
61 decoder_color_behavior_); 61 decoder_color_behavior_);
62 62
63 // Insufficient data is not a failure. 63 return decoder_ ? true : false;
64 return decoder_ || !ImageDecoder::HasSufficientDataToSniffImageType(*data);
65 } 64 }
66 65
67 String ImageSource::FilenameExtension() const { 66 String ImageSource::FilenameExtension() const {
68 return decoder_ ? decoder_->FilenameExtension() : String(); 67 return decoder_ ? decoder_->FilenameExtension() : String();
69 } 68 }
70 69
71 bool ImageSource::IsSizeAvailable() { 70 bool ImageSource::IsSizeAvailable() {
72 return decoder_ && decoder_->IsSizeAvailable(); 71 return decoder_ && decoder_->IsSizeAvailable();
73 } 72 }
74 73
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 150
152 bool ImageSource::FrameIsCompleteAtIndex(size_t index) const { 151 bool ImageSource::FrameIsCompleteAtIndex(size_t index) const {
153 return decoder_ && decoder_->FrameIsCompleteAtIndex(index); 152 return decoder_ && decoder_->FrameIsCompleteAtIndex(index);
154 } 153 }
155 154
156 size_t ImageSource::FrameBytesAtIndex(size_t index) const { 155 size_t ImageSource::FrameBytesAtIndex(size_t index) const {
157 return decoder_ ? decoder_->FrameBytesAtIndex(index) : 0; 156 return decoder_ ? decoder_->FrameBytesAtIndex(index) : 0;
158 } 157 }
159 158
160 } // namespace blink 159 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698