Brian Salomon | cfe910d | 2017-07-06 16:40:18 -0400 | [diff] [blame] | 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 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 11 | #include "src/gpu/GrStencilAttachment.h" |
| 12 | #include "src/gpu/mock/GrMockGpu.h" |
Brian Salomon | cfe910d | 2017-07-06 16:40:18 -0400 | [diff] [blame] | 13 | |
| 14 | class GrMockStencilAttachment : public GrStencilAttachment { |
| 15 | public: |
| 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 | |
| 21 | private: |
| 22 | size_t onGpuMemorySize() const override { |
Brian Osman | 788b916 | 2020-02-07 10:36:46 -0500 | [diff] [blame] | 23 | return std::max(1, (int)(this->bits() / sizeof(char))) * this->width() * this->height(); |
Brian Salomon | cfe910d | 2017-07-06 16:40:18 -0400 | [diff] [blame] | 24 | } |
| 25 | |
| 26 | typedef GrStencilAttachment INHERITED; |
| 27 | }; |
| 28 | |
| 29 | #endif |