aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/mock/GrMockStencilAttachment.h
blob: 697e44498d9f42c50e633bca6fe4532fe6594fce (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
/*
 * 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 GrMockStencilAttachment_DEFINED
#define GrMockStencilAttachment_DEFINED

#include "GrMockGpu.h"
#include "GrStencilAttachment.h"

class GrMockStencilAttachment : public GrStencilAttachment {
public:
    GrMockStencilAttachment(GrMockGpu* gpu, int width, int height, int bits, int sampleCnt)
            : INHERITED(gpu, width, height, bits, sampleCnt) {
        this->registerWithCache(SkBudgeted::kYes);
    }

private:
    size_t onGpuMemorySize() const override {
        return SkTMax(1, (int)(this->bits() / sizeof(char))) * this->width() * this->height();
    }

    typedef GrStencilAttachment INHERITED;
};

#endif