michael@0: michael@0: /* michael@0: * Copyright 2006 The Android Open Source Project michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: michael@0: #include "SkImageDecoder.h" michael@0: #include "SkMovie.h" michael@0: #include "SkStream.h" michael@0: michael@0: extern SkImageDecoder* image_decoder_from_stream(SkStreamRewindable*); michael@0: michael@0: SkImageDecoder* SkImageDecoder::Factory(SkStreamRewindable* stream) { michael@0: return image_decoder_from_stream(stream); michael@0: } michael@0: michael@0: ///////////////////////////////////////////////////////////////////////// michael@0: michael@0: typedef SkTRegistry MovieReg; michael@0: michael@0: SkMovie* SkMovie::DecodeStream(SkStreamRewindable* stream) { michael@0: const MovieReg* curr = MovieReg::Head(); michael@0: while (curr) { michael@0: SkMovie* movie = curr->factory()(stream); michael@0: if (movie) { michael@0: return movie; michael@0: } michael@0: // we must rewind only if we got NULL, since we gave the stream to the michael@0: // movie, who may have already started reading from it michael@0: stream->rewind(); michael@0: curr = curr->next(); michael@0: } michael@0: return NULL; michael@0: }