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

Commit 0517766a authored by Leon Scroggins III's avatar Leon Scroggins III
Browse files

Remove dependence on SkTRegistry

Test: Existing CTS tests for Movie.

SkTRegistry was renamed and moved (with the intent of being private to
Skia) in https://skia-review.googlesource.com/c/6881.

There is only one class registred anyway, so make Movie::DecodeStream
just check GIF manually.

Change-Id: I7fa668cf13c902b49f2848bce4d86ad83020970f
parent e2327c0f
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -127,7 +127,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;
}