| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef GrGLGpu_DEFINED | 8 #ifndef GrGLGpu_DEFINED |
| 9 #define GrGLGpu_DEFINED | 9 #define GrGLGpu_DEFINED |
| 10 | 10 |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 int width, int height, | 165 int width, int height, |
| 166 GrPixelConfig, | 166 GrPixelConfig, |
| 167 void* buffer, | 167 void* buffer, |
| 168 size_t rowBytes) override; | 168 size_t rowBytes) override; |
| 169 | 169 |
| 170 bool onWritePixels(GrSurface*, | 170 bool onWritePixels(GrSurface*, |
| 171 int left, int top, int width, int height, | 171 int left, int top, int width, int height, |
| 172 GrPixelConfig config, const void* buffer, | 172 GrPixelConfig config, const void* buffer, |
| 173 size_t rowBytes) override; | 173 size_t rowBytes) override; |
| 174 | 174 |
| 175 bool onTransferPixels(GrSurface*, |
| 176 int left, int top, int width, int height, |
| 177 GrPixelConfig config, GrTransferBuffer* buffer, |
| 178 size_t offset, size_t rowBytes) override; |
| 179 |
| 175 void onResolveRenderTarget(GrRenderTarget* target) override; | 180 void onResolveRenderTarget(GrRenderTarget* target) override; |
| 176 | 181 |
| 177 void onDraw(const DrawArgs&, const GrNonInstancedVertices&) override; | 182 void onDraw(const DrawArgs&, const GrNonInstancedVertices&) override; |
| 178 | 183 |
| 179 bool onCopySurface(GrSurface* dst, | 184 bool onCopySurface(GrSurface* dst, |
| 180 GrSurface* src, | 185 GrSurface* src, |
| 181 const SkIRect& srcRect, | 186 const SkIRect& srcRect, |
| 182 const SkIPoint& dstPoint) override; | 187 const SkIPoint& dstPoint) override; |
| 183 | 188 |
| 184 // binds texture unit in GL | 189 // binds texture unit in GL |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 void setScratchTextureUnit(); | 282 void setScratchTextureUnit(); |
| 278 | 283 |
| 279 // bounds is region that may be modified and therefore has to be resolved. | 284 // bounds is region that may be modified and therefore has to be resolved. |
| 280 // nullptr means whole target. Can be an empty rect. | 285 // nullptr means whole target. Can be an empty rect. |
| 281 void flushRenderTarget(GrGLRenderTarget*, const SkIRect* bounds); | 286 void flushRenderTarget(GrGLRenderTarget*, const SkIRect* bounds); |
| 282 | 287 |
| 283 void flushStencil(const GrStencilSettings&); | 288 void flushStencil(const GrStencilSettings&); |
| 284 void flushHWAAState(GrRenderTarget* rt, bool useHWAA); | 289 void flushHWAAState(GrRenderTarget* rt, bool useHWAA); |
| 285 | 290 |
| 286 // helper for onCreateTexture and writeTexturePixels | 291 // helper for onCreateTexture and writeTexturePixels |
| 292 enum UploadType { |
| 293 kNewTexture_UploadType, // we are creating a new texture |
| 294 kWrite_UploadType, // we are using TexSubImage2D to copy data to
an existing texture |
| 295 kTransfer_UploadType, // we are using a transfer buffer to copy dat
a |
| 296 }; |
| 287 bool uploadTexData(const GrSurfaceDesc& desc, | 297 bool uploadTexData(const GrSurfaceDesc& desc, |
| 288 GrGLenum target, | 298 GrGLenum target, |
| 289 bool isNewTexture, | 299 UploadType uploadType, |
| 290 int left, int top, int width, int height, | 300 int left, int top, int width, int height, |
| 291 GrPixelConfig dataConfig, | 301 GrPixelConfig dataConfig, |
| 292 const void* data, | 302 const void* data, |
| 293 size_t rowBytes); | 303 size_t rowBytes); |
| 294 | 304 |
| 295 // helper for onCreateCompressedTexture. If width and height are | 305 // helper for onCreateCompressedTexture. If width and height are |
| 296 // set to -1, then this function will use desc.fWidth and desc.fHeight | 306 // set to -1, then this function will use desc.fWidth and desc.fHeight |
| 297 // for the size of the data. The isNewTexture flag should be set to true | 307 // for the size of the data. The isNewTexture flag should be set to true |
| 298 // whenever a new texture needs to be created. Otherwise, we assume that | 308 // whenever a new texture needs to be created. Otherwise, we assume that |
| 299 // the texture is already in GPU memory and that it's going to be updated | 309 // the texture is already in GPU memory and that it's going to be updated |
| 300 // with new data. | 310 // with new data. |
| 301 bool uploadCompressedTexData(const GrSurfaceDesc& desc, | 311 bool uploadCompressedTexData(const GrSurfaceDesc& desc, |
| 302 GrGLenum target, | 312 GrGLenum target, |
| 303 const void* data, | 313 const void* data, |
| 304 bool isNewTexture = true, | 314 UploadType uploadType = kNewTexture_UploadType, |
| 305 int left = 0, int top = 0, | 315 int left = 0, int top = 0, |
| 306 int width = -1, int height = -1); | 316 int width = -1, int height = -1); |
| 307 | 317 |
| 308 bool createRenderTargetObjects(const GrSurfaceDesc&, GrGpuResource::LifeCycl
e lifeCycle, | 318 bool createRenderTargetObjects(const GrSurfaceDesc&, GrGpuResource::LifeCycl
e lifeCycle, |
| 309 const GrGLTextureInfo& texInfo, GrGLRenderTar
get::IDDesc*); | 319 const GrGLTextureInfo& texInfo, GrGLRenderTar
get::IDDesc*); |
| 310 | 320 |
| 311 enum TempFBOTarget { | 321 enum TempFBOTarget { |
| 312 kSrc_TempFBOTarget, | 322 kSrc_TempFBOTarget, |
| 313 kDst_TempFBOTarget | 323 kDst_TempFBOTarget |
| 314 }; | 324 }; |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 SkASSERT(target == GR_GL_TEXTURE_EXTERNAL); | 541 SkASSERT(target == GR_GL_TEXTURE_EXTERNAL); |
| 532 return 1; | 542 return 1; |
| 533 } | 543 } |
| 534 } | 544 } |
| 535 | 545 |
| 536 typedef GrGpu INHERITED; | 546 typedef GrGpu INHERITED; |
| 537 friend class GrGLPathRendering; // For accessing setTextureUnit. | 547 friend class GrGLPathRendering; // For accessing setTextureUnit. |
| 538 }; | 548 }; |
| 539 | 549 |
| 540 #endif | 550 #endif |
| OLD | NEW |