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 GrMockAttachment_DEFINED 9 #define GrMockAttachment_DEFINED 10 11 #include "src/gpu/GrAttachment.h" 12 #include "src/gpu/GrBackendUtils.h" 13 #include "src/gpu/mock/GrMockGpu.h" 14 15 class GrMockAttachment : public GrAttachment { 16 public: GrMockAttachment(GrMockGpu * gpu,SkISize dimensions,UsageFlags supportedUsages,int sampleCnt)17 GrMockAttachment(GrMockGpu* gpu, SkISize dimensions, UsageFlags supportedUsages, int sampleCnt) 18 : INHERITED(gpu, dimensions, supportedUsages, sampleCnt, GrMipmapped::kNo, 19 GrProtected::kNo) { 20 SkASSERT(supportedUsages == UsageFlags::kStencilAttachment); 21 this->registerWithCache(SkBudgeted::kYes); 22 } 23 backendFormat()24 GrBackendFormat backendFormat() const override { 25 return GrBackendFormat::MakeMock(GrColorType::kUnknown, SkImage::CompressionType::kNone, 26 /*isStencilFormat*/ true); 27 } 28 29 private: 30 using INHERITED = GrAttachment; 31 }; 32 33 #endif 34