1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/trunk/src/images/SkImageDecoder_FactoryDefault.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,36 @@ 1.4 + 1.5 +/* 1.6 + * Copyright 2006 The Android Open Source Project 1.7 + * 1.8 + * Use of this source code is governed by a BSD-style license that can be 1.9 + * found in the LICENSE file. 1.10 + */ 1.11 + 1.12 +#include "SkImageDecoder.h" 1.13 +#include "SkMovie.h" 1.14 +#include "SkStream.h" 1.15 + 1.16 +extern SkImageDecoder* image_decoder_from_stream(SkStreamRewindable*); 1.17 + 1.18 +SkImageDecoder* SkImageDecoder::Factory(SkStreamRewindable* stream) { 1.19 + return image_decoder_from_stream(stream); 1.20 +} 1.21 + 1.22 +///////////////////////////////////////////////////////////////////////// 1.23 + 1.24 +typedef SkTRegistry<SkMovie*(*)(SkStreamRewindable*)> MovieReg; 1.25 + 1.26 +SkMovie* SkMovie::DecodeStream(SkStreamRewindable* stream) { 1.27 + const MovieReg* curr = MovieReg::Head(); 1.28 + while (curr) { 1.29 + SkMovie* movie = curr->factory()(stream); 1.30 + if (movie) { 1.31 + return movie; 1.32 + } 1.33 + // we must rewind only if we got NULL, since we gave the stream to the 1.34 + // movie, who may have already started reading from it 1.35 + stream->rewind(); 1.36 + curr = curr->next(); 1.37 + } 1.38 + return NULL; 1.39 +}