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 |
261 class MockGpu : public GrGpu { | 270 class MockGpu : public GrGpu { |
262 public: | 271 public: |
263 MockGpu(GrContext* context, const GrContextOptions& options) : INHERITED(con
text) { | 272 MockGpu(GrContext* context, const GrContextOptions& options) : INHERITED(con
text) { |
264 fCaps.reset(new GrCaps(options)); | 273 fCaps.reset(new MockCaps(options)); |
265 } | 274 } |
266 ~MockGpu() override {} | 275 ~MockGpu() override {} |
267 | 276 |
268 bool onGetReadPixelsInfo(GrSurface* srcSurface, int readWidth, int readHeigh
t, size_t rowBytes, | 277 bool onGetReadPixelsInfo(GrSurface* srcSurface, int readWidth, int readHeigh
t, size_t rowBytes, |
269 GrPixelConfig readConfig, DrawPreference*, | 278 GrPixelConfig readConfig, DrawPreference*, |
270 ReadPixelTempDrawInfo*) override { return false; } | 279 ReadPixelTempDrawInfo*) override { return false; } |
271 | 280 |
272 bool onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height, size
_t rowBytes, | 281 bool onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height, size
_t rowBytes, |
273 GrPixelConfig srcConfig, DrawPreference*, | 282 GrPixelConfig srcConfig, DrawPreference*, |
274 WritePixelTempDrawInfo*) override { return false;
} | 283 WritePixelTempDrawInfo*) override { return false;
} |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 SkASSERT(nullptr == fGpu); | 388 SkASSERT(nullptr == fGpu); |
380 fGpu = new MockGpu(this, options); | 389 fGpu = new MockGpu(this, options); |
381 SkASSERT(fGpu); | 390 SkASSERT(fGpu); |
382 this->initCommon(options); | 391 this->initCommon(options); |
383 | 392 |
384 // We delete these because we want to test the cache starting with zero reso
urces. Also, none of | 393 // We delete these because we want to test the cache starting with zero reso
urces. Also, none of |
385 // these objects are required for any of tests that use this context. TODO:
make stop allocating | 394 // these objects are required for any of tests that use this context. TODO:
make stop allocating |
386 // resources in the buffer pools. | 395 // resources in the buffer pools. |
387 fDrawingManager->abandon(); | 396 fDrawingManager->abandon(); |
388 } | 397 } |
OLD | NEW |