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 GrMockStencilAttachment_DEFINED
9#define GrMockStencilAttachment_DEFINED
10
11#include "src/gpu/GrStencilAttachment.h"
12#include "src/gpu/mock/GrMockGpu.h"
13
14class GrMockStencilAttachment : public GrStencilAttachment {
15public:
16 GrMockStencilAttachment(GrMockGpu* gpu, int width, int height, int bits, int sampleCnt)
17 : INHERITED(gpu, width, height, bits, sampleCnt) {
18 this->registerWithCache(SkBudgeted::kYes);
19 }
20
21private:
22 size_t onGpuMemorySize() const override {
23 return std::max(1, (int)(this->bits() / sizeof(char))) * this->width() * this->height();
24 }
25
26 typedef GrStencilAttachment INHERITED;
27};
28
29#endif
30