aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkUnitMapper.h
blob: 57a8b8332e90051caad2f8342b297ccf9af035fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37

/*
 * 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.
 */


#ifndef SkUnitMapper_DEFINED
#define SkUnitMapper_DEFINED

#include "SkRefCnt.h"
#include "SkScalar.h"

#include "SkFlattenable.h"

class SkUnitMapper : public SkFlattenable {
public:
    SK_DECLARE_INST_COUNT(SkUnitMapper)

    SkUnitMapper() {}

    /** Given a value in [0..0xFFFF], return a value in the same range.
    */
    virtual uint16_t mapUnit16(uint16_t x) = 0;

    SK_DEFINE_FLATTENABLE_TYPE(SkUnitMapper)

protected:
    SkUnitMapper(SkFlattenableReadBuffer& rb) : SkFlattenable(rb) {}

private:
    typedef SkFlattenable INHERITED;
};

#endif