• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 GrMockCaps_DEFINED
9 #define GrMockCaps_DEFINED
10 
11 #include "GrCaps.h"
12 #include "mock/GrMockTypes.h"
13 
14 class GrMockCaps : public GrCaps {
15 public:
GrMockCaps(const GrContextOptions & contextOptions,const GrMockOptions & options)16     GrMockCaps(const GrContextOptions& contextOptions, const GrMockOptions& options)
17             : INHERITED(contextOptions), fOptions(options) {
18         fBufferMapThreshold = SK_MaxS32;
19         fMaxTextureSize = options.fMaxTextureSize;
20         fMaxRenderTargetSize = SkTMin(options.fMaxRenderTargetSize, fMaxTextureSize);
21         fMaxVertexAttributes = options.fMaxVertexAttributes;
22         fShaderCaps.reset(new GrShaderCaps(contextOptions));
23         this->applyOptionsOverrides(contextOptions);
24     }
getSampleCount(int,GrPixelConfig)25     int getSampleCount(int /*requestCount*/, GrPixelConfig /*config*/) const override {
26         return 0;
27     }
isConfigTexturable(GrPixelConfig config)28     bool isConfigTexturable(GrPixelConfig config) const override {
29         return fOptions.fConfigOptions[config].fTexturable;
30     }
isConfigRenderable(GrPixelConfig config,bool withMSAA)31     bool isConfigRenderable(GrPixelConfig config, bool withMSAA) const override {
32         return fOptions.fConfigOptions[config].fRenderable[withMSAA];
33     }
canConfigBeImageStorage(GrPixelConfig)34     bool canConfigBeImageStorage(GrPixelConfig) const override { return false; }
initDescForDstCopy(const GrRenderTargetProxy * src,GrSurfaceDesc * desc,bool * rectsMustMatch,bool * disallowSubrect)35     bool initDescForDstCopy(const GrRenderTargetProxy* src, GrSurfaceDesc* desc,
36                             bool* rectsMustMatch, bool* disallowSubrect) const override {
37         return false;
38     }
39 
40 private:
41     GrMockOptions fOptions;
42     typedef GrCaps INHERITED;
43 };
44 
45 #endif
46