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

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

Issue 1151603005: Revert of Store context options on caps. (Closed) Base URL: https://skia.googlesource.com/skia.git@onecaps
Patch Set: 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"
11 10
12 #include "GrGpuResourceCacheAccess.h" 11 #include "GrGpuResourceCacheAccess.h"
13 #include "GrInOrderDrawBuffer.h" 12 #include "GrInOrderDrawBuffer.h"
14 #include "GrResourceCache.h" 13 #include "GrResourceCache.h"
15 #include "SkString.h" 14 #include "SkString.h"
16 15
17 void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target) { 16 void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target) {
18 SkASSERT(!fContext); 17 SkASSERT(!fContext);
19 18
20 fContext.reset(SkRef(ctx)); 19 fContext.reset(SkRef(ctx));
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 // Code for the mock context. It's built on a mock GrGpu class that does nothing . 131 // Code for the mock context. It's built on a mock GrGpu class that does nothing .
133 //// 132 ////
134 133
135 #include "GrInOrderDrawBuffer.h" 134 #include "GrInOrderDrawBuffer.h"
136 #include "GrGpu.h" 135 #include "GrGpu.h"
137 136
138 class GrPipeline; 137 class GrPipeline;
139 138
140 class MockGpu : public GrGpu { 139 class MockGpu : public GrGpu {
141 public: 140 public:
142 MockGpu(GrContext* context, const GrContextOptions& options) : INHERITED(con text) { 141 MockGpu(GrContext* context) : INHERITED(context) { fCaps.reset(SkNEW(GrCaps) ); }
143 fCaps.reset(SkNEW_ARGS(GrCaps, (options)));
144 }
145 ~MockGpu() override {} 142 ~MockGpu() override {}
146 bool canWriteTexturePixels(const GrTexture*, GrPixelConfig srcConfig) const override { 143 bool canWriteTexturePixels(const GrTexture*, GrPixelConfig srcConfig) const override {
147 return true; 144 return true;
148 } 145 }
149 146
150 bool readPixelsWillPayForYFlip(GrRenderTarget* renderTarget, 147 bool readPixelsWillPayForYFlip(GrRenderTarget* renderTarget,
151 int left, int top, 148 int left, int top,
152 int width, int height, 149 int width, int height,
153 GrPixelConfig config, 150 GrPixelConfig config,
154 size_t rowBytes) const override { return fals e; } 151 size_t rowBytes) const override { return fals e; }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 void clearStencil(GrRenderTarget* target) override {} 242 void clearStencil(GrRenderTarget* target) override {}
246 243
247 void didAddGpuTraceMarker() override {} 244 void didAddGpuTraceMarker() override {}
248 245
249 void didRemoveGpuTraceMarker() override {} 246 void didRemoveGpuTraceMarker() override {}
250 247
251 typedef GrGpu INHERITED; 248 typedef GrGpu INHERITED;
252 }; 249 };
253 250
254 GrContext* GrContext::CreateMockContext() { 251 GrContext* GrContext::CreateMockContext() {
255 GrContext* context = SkNEW(GrContext); 252 GrContext* context = SkNEW_ARGS(GrContext, (Options()));
256 253
257 context->initMockContext(); 254 context->initMockContext();
258 return context; 255 return context;
259 } 256 }
260 257
261 void GrContext::initMockContext() { 258 void GrContext::initMockContext() {
262 GrContextOptions options;
263 SkASSERT(NULL == fGpu); 259 SkASSERT(NULL == fGpu);
264 fGpu = SkNEW_ARGS(MockGpu, (this, options)); 260 fGpu = SkNEW_ARGS(MockGpu, (this));
265 SkASSERT(fGpu); 261 SkASSERT(fGpu);
266 this->initCommon(); 262 this->initCommon();
267 263
268 // We delete these because we want to test the cache starting with zero reso urces. Also, none of 264 // We delete these because we want to test the cache starting with zero reso urces. Also, none of
269 // these objects are required for any of tests that use this context. TODO: make stop allocating 265 // these objects are required for any of tests that use this context. TODO: make stop allocating
270 // resources in the buffer pools. 266 // resources in the buffer pools.
271 SkDELETE(fDrawBuffer); 267 SkDELETE(fDrawBuffer);
272 fDrawBuffer = NULL; 268 fDrawBuffer = NULL;
273 269
274 } 270 }
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