aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/private/SkSurfaceCharacterization.h
blob: f3acb012364ad4b40434f5eb0a215f31ed69cd5f (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
 * Copyright 2017 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SkSurfaceCharacterization_DEFINED
#define SkSurfaceCharacterization_DEFINED

#include "GrTypes.h"

class SkSurface;

// This class captures all the pertinent data about an SkSurface required
// to perform cpu-preprocessing for gpu-rendering.
class SkSurfaceCharacterization {
public:
    SkSurfaceCharacterization()
            : fOrigin(kBottomLeft_GrSurfaceOrigin)
            , fWidth(0)
            , fHeight(0)
            , fConfig(kRGBA_8888_GrPixelConfig)
            , fSampleCnt(0) {
    }

    void set(GrSurfaceOrigin origin,
             int width, int height,
             GrPixelConfig config,
             int sampleCnt) {
        fOrigin = origin;
        fWidth = width;
        fHeight = height;
        fConfig = config;
        fSampleCnt = sampleCnt;
    }

    GrSurfaceOrigin origin() const { return fOrigin; }
    int width() const { return fWidth; }
    int height() const { return fHeight; }
    GrPixelConfig config() const { return fConfig; }
    int sampleCount() const { return fSampleCnt; }

private:
    GrSurfaceOrigin fOrigin;
    int             fWidth;
    int             fHeight;
    GrPixelConfig   fConfig;
    int             fSampleCnt;
    // TODO: need to include caps!
    // Maybe use GrContextThreadSafeProxy (it has the caps & the unique Context ID already)
};

#endif