OLD | NEW |
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 | 10 |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 void GrResourceCache::changeTimestamp(uint32_t newTimestamp) { fTimestamp = newT
imestamp; } | 251 void GrResourceCache::changeTimestamp(uint32_t newTimestamp) { fTimestamp = newT
imestamp; } |
252 | 252 |
253 /////////////////////////////////////////////////////////////////////////////// | 253 /////////////////////////////////////////////////////////////////////////////// |
254 // Code for the mock context. It's built on a mock GrGpu class that does nothing
. | 254 // Code for the mock context. It's built on a mock GrGpu class that does nothing
. |
255 //// | 255 //// |
256 | 256 |
257 #include "GrGpu.h" | 257 #include "GrGpu.h" |
258 | 258 |
259 class GrPipeline; | 259 class GrPipeline; |
260 | 260 |
261 class MockCaps : public GrCaps { | |
262 public: | |
263 explicit MockCaps(const GrContextOptions& options) : INHERITED(options) {} | |
264 bool isConfigTexturable(GrPixelConfig config) const override { return false;
} | |
265 bool isConfigRenderable(GrPixelConfig config, bool withMSAA) const override
{ return false; } | |
266 private: | |
267 typedef GrCaps INHERITED; | |
268 }; | |
269 | |
270 class MockGpu : public GrGpu { | 261 class MockGpu : public GrGpu { |
271 public: | 262 public: |
272 MockGpu(GrContext* context, const GrContextOptions& options) : INHERITED(con
text) { | 263 MockGpu(GrContext* context, const GrContextOptions& options) : INHERITED(con
text) { |
273 fCaps.reset(new MockCaps(options)); | 264 fCaps.reset(new GrCaps(options)); |
274 } | 265 } |
275 ~MockGpu() override {} | 266 ~MockGpu() override {} |
276 | 267 |
277 bool onGetReadPixelsInfo(GrSurface* srcSurface, int readWidth, int readHeigh
t, size_t rowBytes, | 268 bool onGetReadPixelsInfo(GrSurface* srcSurface, int readWidth, int readHeigh
t, size_t rowBytes, |
278 GrPixelConfig readConfig, DrawPreference*, | 269 GrPixelConfig readConfig, DrawPreference*, |
279 ReadPixelTempDrawInfo*) override { return false; } | 270 ReadPixelTempDrawInfo*) override { return false; } |
280 | 271 |
281 bool onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height, size
_t rowBytes, | 272 bool onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height, size
_t rowBytes, |
282 GrPixelConfig srcConfig, DrawPreference*, | 273 GrPixelConfig srcConfig, DrawPreference*, |
283 WritePixelTempDrawInfo*) override { return false;
} | 274 WritePixelTempDrawInfo*) override { return false;
} |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 SkASSERT(nullptr == fGpu); | 379 SkASSERT(nullptr == fGpu); |
389 fGpu = new MockGpu(this, options); | 380 fGpu = new MockGpu(this, options); |
390 SkASSERT(fGpu); | 381 SkASSERT(fGpu); |
391 this->initCommon(options); | 382 this->initCommon(options); |
392 | 383 |
393 // We delete these because we want to test the cache starting with zero reso
urces. Also, none of | 384 // We delete these because we want to test the cache starting with zero reso
urces. Also, none of |
394 // these objects are required for any of tests that use this context. TODO:
make stop allocating | 385 // these objects are required for any of tests that use this context. TODO:
make stop allocating |
395 // resources in the buffer pools. | 386 // resources in the buffer pools. |
396 fDrawingManager->abandon(); | 387 fDrawingManager->abandon(); |
397 } | 388 } |
OLD | NEW |