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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 108 |
109 GrIndexBuffer* onCreateIndexBuffer(size_t size, bool dynamic) SK_OVERRIDE {
return NULL; } | 109 GrIndexBuffer* onCreateIndexBuffer(size_t size, bool dynamic) SK_OVERRIDE {
return NULL; } |
110 | 110 |
111 void onClear(GrRenderTarget*, const SkIRect* rect, GrColor color, | 111 void onClear(GrRenderTarget*, const SkIRect* rect, GrColor color, |
112 bool canIgnoreRect) SK_OVERRIDE {} | 112 bool canIgnoreRect) SK_OVERRIDE {} |
113 | 113 |
114 void onClearStencilClip(GrRenderTarget*, const SkIRect& rect, bool insideCli
p) SK_OVERRIDE {} | 114 void onClearStencilClip(GrRenderTarget*, const SkIRect& rect, bool insideCli
p) SK_OVERRIDE {} |
115 | 115 |
116 void onDraw(const GrOptDrawState&, const GrDrawTarget::DrawInfo&) SK_OVERRID
E {} | 116 void onDraw(const GrOptDrawState&, const GrDrawTarget::DrawInfo&) SK_OVERRID
E {} |
117 | 117 |
| 118 void onStencilPath(const GrOptDrawState&, const GrPath*, const GrStencilSett
ings&) SK_OVERRIDE { |
| 119 } |
| 120 |
| 121 void onDrawPath(const GrOptDrawState&, const GrPath*, const GrStencilSetting
s&) SK_OVERRIDE {} |
| 122 |
| 123 void onDrawPaths(const GrOptDrawState&, |
| 124 const GrPathRange*, |
| 125 const void* indices, |
| 126 GrDrawTarget::PathIndexType, |
| 127 const float transformValues[], |
| 128 GrDrawTarget::PathTransformType, |
| 129 int count, |
| 130 const GrStencilSettings&) SK_OVERRIDE {} |
| 131 |
118 bool onReadPixels(GrRenderTarget* target, | 132 bool onReadPixels(GrRenderTarget* target, |
119 int left, int top, int width, int height, | 133 int left, int top, int width, int height, |
120 GrPixelConfig, | 134 GrPixelConfig, |
121 void* buffer, | 135 void* buffer, |
122 size_t rowBytes) SK_OVERRIDE { | 136 size_t rowBytes) SK_OVERRIDE { |
123 return false; | 137 return false; |
124 } | 138 } |
125 | 139 |
126 bool onWriteTexturePixels(GrTexture* texture, | 140 bool onWriteTexturePixels(GrTexture* texture, |
127 int left, int top, int width, int height, | 141 int left, int top, int width, int height, |
128 GrPixelConfig config, const void* buffer, | 142 GrPixelConfig config, const void* buffer, |
129 size_t rowBytes) SK_OVERRIDE { | 143 size_t rowBytes) SK_OVERRIDE { |
130 return false; | 144 return false; |
131 } | 145 } |
132 | 146 |
133 void onResolveRenderTarget(GrRenderTarget* target) SK_OVERRIDE { return; } | 147 void onResolveRenderTarget(GrRenderTarget* target) SK_OVERRIDE { return; } |
134 | 148 |
135 bool createStencilBufferForRenderTarget(GrRenderTarget*, int width, int heig
ht) SK_OVERRIDE { | 149 bool createStencilBufferForRenderTarget(GrRenderTarget*, int width, int heig
ht) SK_OVERRIDE { |
136 return false; | 150 return false; |
137 } | 151 } |
138 | 152 |
139 bool attachStencilBufferToRenderTarget(GrStencilBuffer*, GrRenderTarget*) SK
_OVERRIDE { | 153 bool attachStencilBufferToRenderTarget(GrStencilBuffer*, GrRenderTarget*) SK
_OVERRIDE { |
140 return false; | 154 return false; |
141 } | 155 } |
142 | 156 |
143 bool flushGraphicsState(const GrOptDrawState&) SK_OVERRIDE { return false; } | |
144 | |
145 void clearStencil(GrRenderTarget* target) SK_OVERRIDE {} | 157 void clearStencil(GrRenderTarget* target) SK_OVERRIDE {} |
146 | 158 |
147 void didAddGpuTraceMarker() SK_OVERRIDE { } | 159 void didAddGpuTraceMarker() SK_OVERRIDE {} |
148 | 160 |
149 void didRemoveGpuTraceMarker() SK_OVERRIDE { } | 161 void didRemoveGpuTraceMarker() SK_OVERRIDE {} |
150 | 162 |
151 typedef GrGpu INHERITED; | 163 typedef GrGpu INHERITED; |
152 }; | 164 }; |
153 | 165 |
154 GrContext* GrContext::CreateMockContext() { | 166 GrContext* GrContext::CreateMockContext() { |
155 GrContext* context = SkNEW_ARGS(GrContext, (Options())); | 167 GrContext* context = SkNEW_ARGS(GrContext, (Options())); |
156 | 168 |
157 context->initMockContext(); | 169 context->initMockContext(); |
158 return context; | 170 return context; |
159 } | 171 } |
160 | 172 |
161 void GrContext::initMockContext() { | 173 void GrContext::initMockContext() { |
162 SkASSERT(NULL == fGpu); | 174 SkASSERT(NULL == fGpu); |
163 fGpu = SkNEW_ARGS(MockGpu, (this)); | 175 fGpu = SkNEW_ARGS(MockGpu, (this)); |
164 SkASSERT(fGpu); | 176 SkASSERT(fGpu); |
165 this->initCommon(); | 177 this->initCommon(); |
166 | 178 |
167 // We delete these because we want to test the cache starting with zero reso
urces. Also, none of | 179 // We delete these because we want to test the cache starting with zero reso
urces. Also, none of |
168 // 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 |
169 // resources in the buffer pools. | 181 // resources in the buffer pools. |
170 SkDELETE(fDrawBuffer); | 182 SkDELETE(fDrawBuffer); |
171 SkDELETE(fDrawBufferVBAllocPool); | 183 SkDELETE(fDrawBufferVBAllocPool); |
172 SkDELETE(fDrawBufferIBAllocPool); | 184 SkDELETE(fDrawBufferIBAllocPool); |
173 | 185 |
174 fDrawBuffer = NULL; | 186 fDrawBuffer = NULL; |
175 fDrawBufferVBAllocPool = NULL; | 187 fDrawBufferVBAllocPool = NULL; |
176 fDrawBufferIBAllocPool = NULL; | 188 fDrawBufferIBAllocPool = NULL; |
177 } | 189 } |
OLD | NEW |