Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: src/gpu/GrTest.cpp

Issue 763593002: Revert of some cleanup around GrGpu/GrDrawTarget copySurface (Closed) Base URL: https://skia.googlesource.com/skia.git@isSameAs
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrInOrderDrawBuffer.cpp ('k') | src/gpu/gl/GrGpuGL.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 #include "GrBufferAllocPool.h" 47 #include "GrBufferAllocPool.h"
48 #include "GrInOrderDrawBuffer.h" 48 #include "GrInOrderDrawBuffer.h"
49 #include "GrGpu.h" 49 #include "GrGpu.h"
50 50
51 class GrOptDrawState; 51 class GrOptDrawState;
52 52
53 class MockGpu : public GrGpu { 53 class MockGpu : public GrGpu {
54 public: 54 public:
55 MockGpu(GrContext* context) : INHERITED(context) { fCaps.reset(SkNEW(GrDrawT argetCaps)); } 55 MockGpu(GrContext* context) : INHERITED(context) { fCaps.reset(SkNEW(GrDrawT argetCaps)); }
56 ~MockGpu() SK_OVERRIDE {} 56 virtual ~MockGpu() { }
57 bool canWriteTexturePixels(const GrTexture*, GrPixelConfig srcConfig) const SK_OVERRIDE { 57 virtual bool canWriteTexturePixels(const GrTexture*,
58 GrPixelConfig srcConfig) const SK_OVERRID E {
58 return true; 59 return true;
59 } 60 }
60 61
61 bool readPixelsWillPayForYFlip(GrRenderTarget* renderTarget, 62 virtual bool readPixelsWillPayForYFlip(GrRenderTarget* renderTarget,
62 int left, int top, 63 int left, int top,
63 int width, int height, 64 int width, int height,
64 GrPixelConfig config, 65 GrPixelConfig config,
65 size_t rowBytes) const SK_OVERRIDE { return f alse; } 66 size_t rowBytes) const SK_OVERRIDE { return false; }
66 void buildProgramDesc(const GrOptDrawState&, 67 virtual void buildProgramDesc(const GrOptDrawState&,
67 const GrProgramDesc::DescInfo&, 68 const GrProgramDesc::DescInfo&,
68 GrGpu::DrawType, 69 GrGpu::DrawType,
69 GrProgramDesc* desc) SK_OVERRIDE {} 70 GrProgramDesc* desc) SK_OVERRIDE { }
70 71
71 void discard(GrRenderTarget*) SK_OVERRIDE {} 72 virtual void discard(GrRenderTarget*) SK_OVERRIDE { }
72 73
73 bool canCopySurface(const GrSurface* dst, 74 virtual bool canCopySurface(const GrSurface* dst,
74 const GrSurface* src, 75 const GrSurface* src,
75 const SkIRect& srcRect, 76 const SkIRect& srcRect,
76 const SkIPoint& dstPoint) SK_OVERRIDE { return false; }; 77 const SkIPoint& dstPoint) SK_OVERRIDE { return f alse; };
77 78
78 bool copySurface(GrSurface* dst, 79 virtual bool copySurface(GrSurface* dst,
79 GrSurface* src, 80 GrSurface* src,
80 const SkIRect& srcRect, 81 const SkIRect& srcRect,
81 const SkIPoint& dstPoint) SK_OVERRIDE { return false; }; 82 const SkIPoint& dstPoint) SK_OVERRIDE { return fals e; };
82 83
83 bool initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc) SK_OV ERRIDE { 84 private:
85 virtual void onResetContext(uint32_t resetBits) { };
86 virtual GrTexture* onCreateTexture(const GrSurfaceDesc& desc,
87 const void* srcData,
88 size_t rowBytes) SK_OVERRIDE {
89 return NULL;
90 }
91
92 virtual GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc,
93 const void* srcData) SK_OVERRI DE {
94 return NULL;
95 }
96
97 virtual GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&) SK_OVE RRIDE {
98 return NULL;
99 }
100
101 virtual GrRenderTarget* onWrapBackendRenderTarget(
102 const GrBackendRenderTargetDesc&) SK_OVERRID E {
103 return NULL;
104 }
105
106 virtual GrVertexBuffer* onCreateVertexBuffer(size_t size, bool dynamic) SK_ OVERRIDE {
107 return NULL;
108 }
109
110 virtual GrIndexBuffer* onCreateIndexBuffer(size_t size, bool dynamic) SK_OV ERRIDE {
111 return NULL;
112 }
113
114 virtual void onClear(GrRenderTarget*, const SkIRect* rect, GrColor color,
115 bool canIgnoreRect) SK_OVERRIDE { }
116
117 virtual void onClearStencilClip(GrRenderTarget*,
118 const SkIRect& rect,
119 bool insideClip) SK_OVERRIDE { }
120
121 virtual void onDraw(const GrOptDrawState&, const GrDrawTarget::DrawInfo&) S K_OVERRIDE { }
122 virtual bool onReadPixels(GrRenderTarget* target,
123 int left, int top, int width, int height,
124 GrPixelConfig,
125 void* buffer,
126 size_t rowBytes) SK_OVERRIDE {
84 return false; 127 return false;
85 } 128 }
86 129
87 private: 130 virtual bool onWriteTexturePixels(GrTexture* texture,
88 void onResetContext(uint32_t resetBits) SK_OVERRIDE {} 131 int left, int top, int width, int height,
89 132 GrPixelConfig config, const void* buffer,
90 GrTexture* onCreateTexture(const GrSurfaceDesc& desc, 133 size_t rowBytes) SK_OVERRIDE {
91 const void* srcData,
92 size_t rowBytes) SK_OVERRIDE {
93 return NULL;
94 }
95
96 GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc,
97 const void* srcData) SK_OVERRIDE {
98 return NULL;
99 }
100
101 GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&) SK_OVERRIDE { r eturn NULL; }
102
103 GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&) SK_OVERRIDE {
104 return NULL;
105 }
106
107 GrVertexBuffer* onCreateVertexBuffer(size_t size, bool dynamic) SK_OVERRIDE { return NULL; }
108
109 GrIndexBuffer* onCreateIndexBuffer(size_t size, bool dynamic) SK_OVERRIDE { return NULL; }
110
111 void onClear(GrRenderTarget*, const SkIRect* rect, GrColor color,
112 bool canIgnoreRect) SK_OVERRIDE {}
113
114 void onClearStencilClip(GrRenderTarget*, const SkIRect& rect, bool insideCli p) SK_OVERRIDE {}
115
116 void onDraw(const GrOptDrawState&, const GrDrawTarget::DrawInfo&) SK_OVERRID E {}
117
118 bool onReadPixels(GrRenderTarget* target,
119 int left, int top, int width, int height,
120 GrPixelConfig,
121 void* buffer,
122 size_t rowBytes) SK_OVERRIDE {
123 return false; 134 return false;
124 } 135 }
125 136
126 bool onWriteTexturePixels(GrTexture* texture, 137 virtual void onResolveRenderTarget(GrRenderTarget* target) SK_OVERRIDE {
127 int left, int top, int width, int height, 138 return;
128 GrPixelConfig config, const void* buffer, 139 }
129 size_t rowBytes) SK_OVERRIDE { 140
141 virtual bool createStencilBufferForRenderTarget(GrRenderTarget*, int width,
142 int height) SK_OVERRIDE {
130 return false; 143 return false;
131 } 144 }
132 145
133 void onResolveRenderTarget(GrRenderTarget* target) SK_OVERRIDE { return; } 146 virtual bool attachStencilBufferToRenderTarget(GrStencilBuffer*, GrRenderTar get*) SK_OVERRIDE {
134
135 bool createStencilBufferForRenderTarget(GrRenderTarget*, int width, int heig ht) SK_OVERRIDE {
136 return false; 147 return false;
137 } 148 }
138 149
139 bool attachStencilBufferToRenderTarget(GrStencilBuffer*, GrRenderTarget*) SK _OVERRIDE { 150 virtual bool flushGraphicsState(const GrOptDrawState&, DrawType) SK_OVERRID E {
140 return false; 151 return false;
141 } 152 }
142 153
143 bool flushGraphicsState(const GrOptDrawState&, DrawType) SK_OVERRIDE { retur n false; } 154 virtual void clearStencil(GrRenderTarget* target) SK_OVERRIDE { }
144 155
145 void clearStencil(GrRenderTarget* target) SK_OVERRIDE {} 156 virtual void didAddGpuTraceMarker() SK_OVERRIDE { }
146 157 virtual void didRemoveGpuTraceMarker() SK_OVERRIDE { }
147 void didAddGpuTraceMarker() SK_OVERRIDE { }
148
149 void didRemoveGpuTraceMarker() SK_OVERRIDE { }
150 158
151 typedef GrGpu INHERITED; 159 typedef GrGpu INHERITED;
152 }; 160 };
153 161
154 GrContext* GrContext::CreateMockContext() { 162 GrContext* GrContext::CreateMockContext() {
155 GrContext* context = SkNEW_ARGS(GrContext, (Options())); 163 GrContext* context = SkNEW_ARGS(GrContext, (Options()));
156 164
157 context->initMockContext(); 165 context->initMockContext();
158 return context; 166 return context;
159 } 167 }
160 168
161 void GrContext::initMockContext() { 169 void GrContext::initMockContext() {
162 SkASSERT(NULL == fGpu); 170 SkASSERT(NULL == fGpu);
163 fGpu = SkNEW_ARGS(MockGpu, (this)); 171 fGpu = SkNEW_ARGS(MockGpu, (this));
164 SkASSERT(fGpu); 172 SkASSERT(fGpu);
165 this->initCommon(); 173 this->initCommon();
166 174
167 // We delete these because we want to test the cache starting with zero reso urces. Also, none of 175 // 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 176 // these objects are required for any of tests that use this context. TODO: make stop allocating
169 // resources in the buffer pools. 177 // resources in the buffer pools.
170 SkDELETE(fDrawBuffer); 178 SkDELETE(fDrawBuffer);
171 SkDELETE(fDrawBufferVBAllocPool); 179 SkDELETE(fDrawBufferVBAllocPool);
172 SkDELETE(fDrawBufferIBAllocPool); 180 SkDELETE(fDrawBufferIBAllocPool);
173 181
174 fDrawBuffer = NULL; 182 fDrawBuffer = NULL;
175 fDrawBufferVBAllocPool = NULL; 183 fDrawBufferVBAllocPool = NULL;
176 fDrawBufferIBAllocPool = NULL; 184 fDrawBufferIBAllocPool = NULL;
177 } 185 }
OLDNEW
« no previous file with comments | « src/gpu/GrInOrderDrawBuffer.cpp ('k') | src/gpu/gl/GrGpuGL.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698