Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e5bab865 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Remove dependence on SkTRegistry"

parents ab979869 0517766a
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -128,7 +128,6 @@ LOCAL_SRC_FILES:= \
    android/graphics/Matrix.cpp \
    android/graphics/Matrix.cpp \
    android/graphics/Movie.cpp \
    android/graphics/Movie.cpp \
    android/graphics/MovieImpl.cpp \
    android/graphics/MovieImpl.cpp \
    android/graphics/Movie_FactoryDefault.cpp \
    android/graphics/NinePatch.cpp \
    android/graphics/NinePatch.cpp \
    android/graphics/NinePatchPeeker.cpp \
    android/graphics/NinePatchPeeker.cpp \
    android/graphics/Paint.cpp \
    android/graphics/Paint.cpp \
+1 −5
Original line number Original line Diff line number Diff line
@@ -432,9 +432,7 @@ bool GIFMovie::onGetBitmap(SkBitmap* bm)


///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////


#include "SkTRegistry.h"
Movie* Movie::DecodeStream(SkStreamRewindable* stream) {

Movie* Factory(SkStreamRewindable* stream) {
    char buf[GIF_STAMP_LEN];
    char buf[GIF_STAMP_LEN];
    if (stream->read(buf, GIF_STAMP_LEN) == GIF_STAMP_LEN) {
    if (stream->read(buf, GIF_STAMP_LEN) == GIF_STAMP_LEN) {
        if (memcmp(GIF_STAMP,   buf, GIF_STAMP_LEN) == 0 ||
        if (memcmp(GIF_STAMP,   buf, GIF_STAMP_LEN) == 0 ||
@@ -447,5 +445,3 @@ Movie* Factory(SkStreamRewindable* stream) {
    }
    }
    return nullptr;
    return nullptr;
}
}

static SkTRegistry<Movie*(*)(SkStreamRewindable*)> gReg(Factory);
+0 −27
Original line number Original line Diff line number Diff line
/*
 * Copyright 2006 The Android Open Source Project
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include "Movie.h"
#include "SkStream.h"
#include "SkTRegistry.h"

typedef SkTRegistry<Movie*(*)(SkStreamRewindable*)> MovieReg;

Movie* Movie::DecodeStream(SkStreamRewindable* stream) {
    const MovieReg* curr = MovieReg::Head();
    while (curr) {
        Movie* movie = curr->factory()(stream);
        if (movie) {
            return movie;
        }
        // we must rewind only if we got nullptr, since we gave the stream to the
        // movie, who may have already started reading from it
        stream->rewind();
        curr = curr->next();
    }
    return nullptr;
}