Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: src/gpu/GrTest.cpp

Issue 1158433006: Store context options on caps. (Closed) Base URL: https://skia.googlesource.com/skia.git@onecaps
Patch Set: remove case statement accidentally checked in Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrSWMaskHelper.cpp ('k') | src/gpu/gl/GrGLCaps.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2013 Google Inc. 3 * Copyright 2013 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "GrTest.h" 9 #include "GrTest.h"
10 #include "GrContextOptions.h"
10 11
11 #include "GrGpuResourceCacheAccess.h" 12 #include "GrGpuResourceCacheAccess.h"
12 #include "GrInOrderDrawBuffer.h" 13 #include "GrInOrderDrawBuffer.h"
13 #include "GrResourceCache.h" 14 #include "GrResourceCache.h"
14 #include "SkString.h" 15 #include "SkString.h"
15 16
16 void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target) { 17 void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target) {
17 SkASSERT(!fContext); 18 SkASSERT(!fContext);
18 19
19 fContext.reset(SkRef(ctx)); 20 fContext.reset(SkRef(ctx));
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 // Code for the mock context. It's built on a mock GrGpu class that does nothing . 132 // Code for the mock context. It's built on a mock GrGpu class that does nothing .
132 //// 133 ////
133 134
134 #include "GrInOrderDrawBuffer.h" 135 #include "GrInOrderDrawBuffer.h"
135 #include "GrGpu.h" 136 #include "GrGpu.h"
136 137
137 class GrPipeline; 138 class GrPipeline;
138 139
139 class MockGpu : public GrGpu { 140 class MockGpu : public GrGpu {
140 public: 141 public:
141 MockGpu(GrContext* context) : INHERITED(context) { fCaps.reset(SkNEW(GrCaps) ); } 142 MockGpu(GrContext* context, const GrContextOptions& options) : INHERITED(con text) {
143 fCaps.reset(SkNEW_ARGS(GrCaps, (options)));
144 }
142 ~MockGpu() override {} 145 ~MockGpu() override {}
143 bool canWriteTexturePixels(const GrTexture*, GrPixelConfig srcConfig) const override { 146 bool canWriteTexturePixels(const GrTexture*, GrPixelConfig srcConfig) const override {
144 return true; 147 return true;
145 } 148 }
146 149
147 bool readPixelsWillPayForYFlip(GrRenderTarget* renderTarget, 150 bool readPixelsWillPayForYFlip(GrRenderTarget* renderTarget,
148 int left, int top, 151 int left, int top,
149 int width, int height, 152 int width, int height,
150 GrPixelConfig config, 153 GrPixelConfig config,
151 size_t rowBytes) const override { return fals e; } 154 size_t rowBytes) const override { return fals e; }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 void clearStencil(GrRenderTarget* target) override {} 245 void clearStencil(GrRenderTarget* target) override {}
243 246
244 void didAddGpuTraceMarker() override {} 247 void didAddGpuTraceMarker() override {}
245 248
246 void didRemoveGpuTraceMarker() override {} 249 void didRemoveGpuTraceMarker() override {}
247 250
248 typedef GrGpu INHERITED; 251 typedef GrGpu INHERITED;
249 }; 252 };
250 253
251 GrContext* GrContext::CreateMockContext() { 254 GrContext* GrContext::CreateMockContext() {
252 GrContext* context = SkNEW_ARGS(GrContext, (Options())); 255 GrContext* context = SkNEW(GrContext);
253 256
254 context->initMockContext(); 257 context->initMockContext();
255 return context; 258 return context;
256 } 259 }
257 260
258 void GrContext::initMockContext() { 261 void GrContext::initMockContext() {
262 GrContextOptions options;
259 SkASSERT(NULL == fGpu); 263 SkASSERT(NULL == fGpu);
260 fGpu = SkNEW_ARGS(MockGpu, (this)); 264 fGpu = SkNEW_ARGS(MockGpu, (this, options));
261 SkASSERT(fGpu); 265 SkASSERT(fGpu);
262 this->initCommon(); 266 this->initCommon();
263 267
264 // We delete these because we want to test the cache starting with zero reso urces. Also, none of 268 // We delete these because we want to test the cache starting with zero reso urces. Also, none of
265 // these objects are required for any of tests that use this context. TODO: make stop allocating 269 // these objects are required for any of tests that use this context. TODO: make stop allocating
266 // resources in the buffer pools. 270 // resources in the buffer pools.
267 SkDELETE(fDrawBuffer); 271 SkDELETE(fDrawBuffer);
268 fDrawBuffer = NULL; 272 fDrawBuffer = NULL;
269 273
270 } 274 }
OLDNEW
« no previous file with comments | « src/gpu/GrSWMaskHelper.cpp ('k') | src/gpu/gl/GrGLCaps.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698