blob: 63b7b4e5441c3da763e990a9311cc8819e5ffde1 [file] [log] [blame]
Brian Salomoncfe910d2017-07-06 16:40:18 -04001/*
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
Mike Kleinc0bd9f92019-04-23 12:05:21 -050011#include "src/gpu/GrStencilAttachment.h"
12#include "src/gpu/mock/GrMockGpu.h"
Brian Salomoncfe910d2017-07-06 16:40:18 -040013
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 {
Brian Osman788b9162020-02-07 10:36:46 -050023 return std::max(1, (int)(this->bits() / sizeof(char))) * this->width() * this->height();
Brian Salomoncfe910d2017-07-06 16:40:18 -040024 }
25
26 typedef GrStencilAttachment INHERITED;
27};
28
29#endif