• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2017 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 SkAtlasTextContext_DEFINED
9 #define SkAtlasTextContext_DEFINED
10 
11 #include "SkRefCnt.h"
12 
13 class SkAtlasTextRenderer;
14 class SkInternalAtlasTextContext;
15 
16 SkAtlasTextRenderer* SkGetAtlasTextRendererFromInternalContext(class SkInternalAtlasTextContext&);
17 
18 /**
19  * Class that Atlas Text client uses to register their SkAtlasTextRenderer implementation and
20  * to create one or more SkAtlasTextTargets (destination surfaces for text rendering).
21  */
22 class SK_API SkAtlasTextContext : public SkRefCnt {
23 public:
24     static sk_sp<SkAtlasTextContext> Make(sk_sp<SkAtlasTextRenderer>);
25 
renderer()26     SkAtlasTextRenderer* renderer() const {
27         return SkGetAtlasTextRendererFromInternalContext(*fInternalContext);
28     }
29 
internal()30     SkInternalAtlasTextContext& internal() { return *fInternalContext; }
31 
32 private:
33     SkAtlasTextContext() = delete;
34     SkAtlasTextContext(const SkAtlasTextContext&) = delete;
35     SkAtlasTextContext& operator=(const SkAtlasTextContext&) = delete;
36 
37     SkAtlasTextContext(sk_sp<SkAtlasTextRenderer>);
38 
39     std::unique_ptr<SkInternalAtlasTextContext> fInternalContext;
40 };
41 
42 #endif
43