| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 } | 42 } |
| 43 | 43 |
| 44 /////////////////////////////////////////////////////////////////////////////// | 44 /////////////////////////////////////////////////////////////////////////////// |
| 45 // Code for the mock context. It's built on a mock GrGpu class that does nothing
. | 45 // Code for the mock context. It's built on a mock GrGpu class that does nothing
. |
| 46 //// | 46 //// |
| 47 | 47 |
| 48 #include "GrBufferAllocPool.h" | 48 #include "GrBufferAllocPool.h" |
| 49 #include "GrInOrderDrawBuffer.h" | 49 #include "GrInOrderDrawBuffer.h" |
| 50 #include "GrGpu.h" | 50 #include "GrGpu.h" |
| 51 | 51 |
| 52 class GrOptDrawState; |
| 53 |
| 52 class MockGpu : public GrGpu { | 54 class MockGpu : public GrGpu { |
| 53 public: | 55 public: |
| 54 MockGpu(GrContext* context) : INHERITED(context) { fCaps.reset(SkNEW(GrDrawT
argetCaps)); } | 56 MockGpu(GrContext* context) : INHERITED(context) { fCaps.reset(SkNEW(GrDrawT
argetCaps)); } |
| 55 virtual ~MockGpu() { } | 57 virtual ~MockGpu() { } |
| 56 virtual bool canWriteTexturePixels(const GrTexture*, | 58 virtual bool canWriteTexturePixels(const GrTexture*, |
| 57 GrPixelConfig srcConfig) const SK_OVERRID
E { | 59 GrPixelConfig srcConfig) const SK_OVERRID
E { |
| 58 return true; | 60 return true; |
| 59 } | 61 } |
| 60 | 62 |
| 61 virtual bool readPixelsWillPayForYFlip(GrRenderTarget* renderTarget, | 63 virtual bool readPixelsWillPayForYFlip(GrRenderTarget* renderTarget, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 return NULL; | 113 return NULL; |
| 112 } | 114 } |
| 113 | 115 |
| 114 virtual void onClear(GrRenderTarget*, const SkIRect* rect, GrColor color, | 116 virtual void onClear(GrRenderTarget*, const SkIRect* rect, GrColor color, |
| 115 bool canIgnoreRect) SK_OVERRIDE { } | 117 bool canIgnoreRect) SK_OVERRIDE { } |
| 116 | 118 |
| 117 virtual void onClearStencilClip(GrRenderTarget*, | 119 virtual void onClearStencilClip(GrRenderTarget*, |
| 118 const SkIRect& rect, | 120 const SkIRect& rect, |
| 119 bool insideClip) SK_OVERRIDE { } | 121 bool insideClip) SK_OVERRIDE { } |
| 120 | 122 |
| 121 virtual void onDraw(const GrDrawTarget::DrawInfo&) SK_OVERRIDE { } | 123 virtual void onDraw(const GrOptDrawState&, const GrDrawTarget::DrawInfo&) S
K_OVERRIDE { } |
| 122 virtual bool onReadPixels(GrRenderTarget* target, | 124 virtual bool onReadPixels(GrRenderTarget* target, |
| 123 int left, int top, int width, int height, | 125 int left, int top, int width, int height, |
| 124 GrPixelConfig, | 126 GrPixelConfig, |
| 125 void* buffer, | 127 void* buffer, |
| 126 size_t rowBytes) SK_OVERRIDE { | 128 size_t rowBytes) SK_OVERRIDE { |
| 127 return false; | 129 return false; |
| 128 } | 130 } |
| 129 | 131 |
| 130 virtual bool onWriteTexturePixels(GrTexture* texture, | 132 virtual bool onWriteTexturePixels(GrTexture* texture, |
| 131 int left, int top, int width, int height, | 133 int left, int top, int width, int height, |
| 132 GrPixelConfig config, const void* buffer, | 134 GrPixelConfig config, const void* buffer, |
| 133 size_t rowBytes) SK_OVERRIDE { | 135 size_t rowBytes) SK_OVERRIDE { |
| 134 return false; | 136 return false; |
| 135 } | 137 } |
| 136 | 138 |
| 137 virtual void onResolveRenderTarget(GrRenderTarget* target) SK_OVERRIDE { | 139 virtual void onResolveRenderTarget(GrRenderTarget* target) SK_OVERRIDE { |
| 138 return; | 140 return; |
| 139 } | 141 } |
| 140 | 142 |
| 141 virtual bool createStencilBufferForRenderTarget(GrRenderTarget*, int width, | 143 virtual bool createStencilBufferForRenderTarget(GrRenderTarget*, int width, |
| 142 int height) SK_OVERRIDE { | 144 int height) SK_OVERRIDE { |
| 143 return false; | 145 return false; |
| 144 } | 146 } |
| 145 | 147 |
| 146 virtual bool attachStencilBufferToRenderTarget(GrStencilBuffer*, GrRenderTar
get*) SK_OVERRIDE { | 148 virtual bool attachStencilBufferToRenderTarget(GrStencilBuffer*, GrRenderTar
get*) SK_OVERRIDE { |
| 147 return false; | 149 return false; |
| 148 } | 150 } |
| 149 | 151 |
| 150 virtual bool flushGraphicsState(DrawType, | 152 virtual bool flushGraphicsState(const GrOptDrawState&, |
| 153 DrawType, |
| 151 const GrClipMaskManager::ScissorState&, | 154 const GrClipMaskManager::ScissorState&, |
| 152 const GrDeviceCoordTexture* dstCopy) SK_OVE
RRIDE { | 155 const GrDeviceCoordTexture* dstCopy) SK_OVE
RRIDE { |
| 153 return false; | 156 return false; |
| 154 } | 157 } |
| 155 | 158 |
| 156 virtual void clearStencil(GrRenderTarget* target) SK_OVERRIDE { } | 159 virtual void clearStencil(GrRenderTarget* target) SK_OVERRIDE { } |
| 157 | 160 |
| 158 virtual void didAddGpuTraceMarker() SK_OVERRIDE { } | 161 virtual void didAddGpuTraceMarker() SK_OVERRIDE { } |
| 159 virtual void didRemoveGpuTraceMarker() SK_OVERRIDE { } | 162 virtual void didRemoveGpuTraceMarker() SK_OVERRIDE { } |
| 160 | 163 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 178 // these objects are required for any of tests that use this context. TODO:
make stop allocating | 181 // these objects are required for any of tests that use this context. TODO:
make stop allocating |
| 179 // resources in the buffer pools. | 182 // resources in the buffer pools. |
| 180 SkDELETE(fDrawBuffer); | 183 SkDELETE(fDrawBuffer); |
| 181 SkDELETE(fDrawBufferVBAllocPool); | 184 SkDELETE(fDrawBufferVBAllocPool); |
| 182 SkDELETE(fDrawBufferIBAllocPool); | 185 SkDELETE(fDrawBufferIBAllocPool); |
| 183 | 186 |
| 184 fDrawBuffer = NULL; | 187 fDrawBuffer = NULL; |
| 185 fDrawBufferVBAllocPool = NULL; | 188 fDrawBufferVBAllocPool = NULL; |
| 186 fDrawBufferIBAllocPool = NULL; | 189 fDrawBufferIBAllocPool = NULL; |
| 187 } | 190 } |
| OLD | NEW |