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 |
11 #include "GrInOrderDrawBuffer.h" | 11 #include "GrInOrderDrawBuffer.h" |
12 #include "GrResourceCache.h" | 12 #include "GrResourceCache.h" |
13 | 13 |
14 void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target) { | 14 void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target) { |
15 SkASSERT(!fContext); | 15 SkASSERT(!fContext); |
16 | 16 |
17 fContext.reset(SkRef(ctx)); | 17 fContext.reset(SkRef(ctx)); |
18 fDrawTarget.reset(SkRef(target)); | 18 fDrawTarget.reset(SkRef(target)); |
19 | 19 |
20 SkNEW_IN_TLAZY(&fASR, GrDrawTarget::AutoStateRestore, (target, GrDrawTarget:
:kReset_ASRInit)); | |
21 SkNEW_IN_TLAZY(&fACR, GrDrawTarget::AutoClipRestore, (target)); | 20 SkNEW_IN_TLAZY(&fACR, GrDrawTarget::AutoClipRestore, (target)); |
22 SkNEW_IN_TLAZY(&fAGP, GrDrawTarget::AutoGeometryPush, (target)); | 21 SkNEW_IN_TLAZY(&fAGP, GrDrawTarget::AutoGeometryPush, (target)); |
23 } | 22 } |
24 | 23 |
25 void GrContext::getTestTarget(GrTestTarget* tar) { | 24 void GrContext::getTestTarget(GrTestTarget* tar) { |
26 this->flush(); | 25 this->flush(); |
27 // We could create a proxy GrDrawTarget that passes through to fGpu until ~G
rTextTarget() and | 26 // We could create a proxy GrDrawTarget that passes through to fGpu until ~G
rTextTarget() and |
28 // then disconnects. This would help prevent test writers from mixing using
the returned | 27 // then disconnects. This would help prevent test writers from mixing using
the returned |
29 // GrDrawTarget and regular drawing. We could also assert or fail in GrConte
xt drawing methods | 28 // GrDrawTarget and regular drawing. We could also assert or fail in GrConte
xt drawing methods |
30 // until ~GrTestTarget(). | 29 // until ~GrTestTarget(). |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 GrPixelConfig config, | 65 GrPixelConfig config, |
67 size_t rowBytes) const SK_OVERRIDE {
return false; } | 66 size_t rowBytes) const SK_OVERRIDE {
return false; } |
68 virtual void buildProgramDesc(const GrOptDrawState&, | 67 virtual void buildProgramDesc(const GrOptDrawState&, |
69 const GrProgramDesc::DescInfo&, | 68 const GrProgramDesc::DescInfo&, |
70 GrGpu::DrawType, | 69 GrGpu::DrawType, |
71 const GrDeviceCoordTexture* dstCopy, | 70 const GrDeviceCoordTexture* dstCopy, |
72 GrProgramDesc* desc) SK_OVERRIDE { } | 71 GrProgramDesc* desc) SK_OVERRIDE { } |
73 | 72 |
74 virtual void discard(GrRenderTarget*) SK_OVERRIDE { } | 73 virtual void discard(GrRenderTarget*) SK_OVERRIDE { } |
75 | 74 |
76 virtual bool canCopySurface(GrSurface* dst, | 75 virtual bool canCopySurface(const GrSurface* dst, |
77 GrSurface* src, | 76 const GrSurface* src, |
78 const SkIRect& srcRect, | 77 const SkIRect& srcRect, |
79 const SkIPoint& dstPoint) SK_OVERRIDE { return f
alse; }; | 78 const SkIPoint& dstPoint) SK_OVERRIDE { return f
alse; }; |
80 | 79 |
81 virtual bool copySurface(GrSurface* dst, | 80 virtual bool copySurface(GrSurface* dst, |
82 GrSurface* src, | 81 GrSurface* src, |
83 const SkIRect& srcRect, | 82 const SkIRect& srcRect, |
84 const SkIPoint& dstPoint) SK_OVERRIDE { return fals
e; }; | 83 const SkIPoint& dstPoint) SK_OVERRIDE { return fals
e; }; |
85 | 84 |
86 private: | 85 private: |
87 virtual void onResetContext(uint32_t resetBits) { }; | 86 virtual void onResetContext(uint32_t resetBits) { }; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 // these objects are required for any of tests that use this context. TODO:
make stop allocating | 180 // these objects are required for any of tests that use this context. TODO:
make stop allocating |
182 // resources in the buffer pools. | 181 // resources in the buffer pools. |
183 SkDELETE(fDrawBuffer); | 182 SkDELETE(fDrawBuffer); |
184 SkDELETE(fDrawBufferVBAllocPool); | 183 SkDELETE(fDrawBufferVBAllocPool); |
185 SkDELETE(fDrawBufferIBAllocPool); | 184 SkDELETE(fDrawBufferIBAllocPool); |
186 | 185 |
187 fDrawBuffer = NULL; | 186 fDrawBuffer = NULL; |
188 fDrawBufferVBAllocPool = NULL; | 187 fDrawBufferVBAllocPool = NULL; |
189 fDrawBufferIBAllocPool = NULL; | 188 fDrawBufferIBAllocPool = NULL; |
190 } | 189 } |
OLD | NEW |