mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Allows for reference counting of images before disposal. This will allow multiple callers to hold a reference to an image and dispose of their reference without disposing the underlying image until all handles have been disposed. This will be used by the framework to help resolve some of the kludge I was trying to introduce in flutter/flutter#64582
43 lines
1.1 KiB
C++
43 lines
1.1 KiB
C++
// Copyright 2013 The Flutter Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef FLUTTER_LIB_UI_PAINTING_CODEC_H_
|
|
#define FLUTTER_LIB_UI_PAINTING_CODEC_H_
|
|
|
|
#include "flutter/lib/ui/dart_wrapper.h"
|
|
#include "flutter/lib/ui/ui_dart_state.h"
|
|
#include "third_party/skia/include/codec/SkCodec.h"
|
|
#include "third_party/skia/include/core/SkBitmap.h"
|
|
#include "third_party/skia/include/core/SkImage.h"
|
|
|
|
using tonic::DartPersistentValue;
|
|
|
|
namespace tonic {
|
|
class DartLibraryNatives;
|
|
} // namespace tonic
|
|
|
|
namespace flutter {
|
|
|
|
// A handle to an SkCodec object.
|
|
//
|
|
// Doesn't mirror SkCodec's API but provides a simple sequential access API.
|
|
class Codec : public RefCountedDartWrappable<Codec> {
|
|
DEFINE_WRAPPERTYPEINFO();
|
|
|
|
public:
|
|
virtual int frameCount() const = 0;
|
|
|
|
virtual int repetitionCount() const = 0;
|
|
|
|
virtual Dart_Handle getNextFrame(Dart_Handle callback_handle) = 0;
|
|
|
|
void dispose();
|
|
|
|
static void RegisterNatives(tonic::DartLibraryNatives* natives);
|
|
};
|
|
|
|
} // namespace flutter
|
|
|
|
#endif // FLUTTER_LIB_UI_PAINTING_CODEC_H_
|