1 /*
2  * Copyright 2016 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #ifndef SkDeduper_DEFINED
9 #define SkDeduper_DEFINED
10 
11 #include "SkFlattenable.h"
12 
13 class SkImage;
14 class SkPicture;
15 class SkTypeface;
16 
17 class SkDeduper {
18 public:
19     virtual ~SkDeduper() {}
20 
21     // These return 0 on failure
22 
23     virtual int findOrDefineImage(SkImage*) = 0;
24     virtual int findOrDefinePicture(SkPicture*) = 0;
25     virtual int findOrDefineTypeface(SkTypeface*) = 0;
26     virtual int findOrDefineFactory(SkFlattenable*) = 0;
27 };
28 
29 class SkInflator {
30 public:
31     virtual ~SkInflator() {}
32 
33     virtual SkImage* getImage(int) = 0;
34     virtual SkPicture* getPicture(int) = 0;
35     virtual SkTypeface* getTypeface(int) = 0;
36     virtual SkFlattenable::Factory getFactory(int) = 0;
37 };
38 
39 #endif
40