| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 GrVertexBuffer* onCreateVertexBuffer(size_t size, bool dynamic) override; | 150 GrVertexBuffer* onCreateVertexBuffer(size_t size, bool dynamic) override; |
| 151 GrIndexBuffer* onCreateIndexBuffer(size_t size, bool dynamic) override; | 151 GrIndexBuffer* onCreateIndexBuffer(size_t size, bool dynamic) override; |
| 152 GrTransferBuffer* onCreateTransferBuffer(size_t size, TransferType type) ove
rride; | 152 GrTransferBuffer* onCreateTransferBuffer(size_t size, TransferType type) ove
rride; |
| 153 GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&, GrWrapOwnership
) override; | 153 GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&, GrWrapOwnership
) override; |
| 154 GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&, | 154 GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&, |
| 155 GrWrapOwnership) override; | 155 GrWrapOwnership) override; |
| 156 // Given a GrPixelConfig return the index into the stencil format array on G
rGLCaps to a | 156 // Given a GrPixelConfig return the index into the stencil format array on G
rGLCaps to a |
| 157 // compatible stencil format, or negative if there is no compatible stencil
format. | 157 // compatible stencil format, or negative if there is no compatible stencil
format. |
| 158 int getCompatibleStencilIndex(GrPixelConfig config); | 158 int getCompatibleStencilIndex(GrPixelConfig config); |
| 159 | 159 |
| 160 // If |desc.fTextureStorageAllocator| exists, use that to create the | |
| 161 // texture. Otherwise, create the texture directly. | |
| 162 // Returns whether the texture is successfully created. On success, the | |
| 163 // result is stored in |info|. | |
| 164 // The texture is populated with |srcData|, if it exists. | |
| 165 // The texture parameters are cached in |initialTexParams|. | |
| 166 bool createTextureImpl(const GrSurfaceDesc& desc, GrGLTextureInfo* info, | |
| 167 bool renderTarget, const void* srcData, | |
| 168 GrGLTexture::TexParams* initialTexParams, size_t rowB
ytes); | |
| 169 bool createTextureExternalAllocatorImpl(const GrSurfaceDesc& desc, GrGLTextu
reInfo* info, | |
| 170 const void* srcData, size_t rowBytes
); | |
| 171 | |
| 172 void onClear(GrRenderTarget*, const SkIRect& rect, GrColor color) override; | 160 void onClear(GrRenderTarget*, const SkIRect& rect, GrColor color) override; |
| 173 | 161 |
| 174 void onClearStencilClip(GrRenderTarget*, const SkIRect& rect, bool insideCli
p) override; | 162 void onClearStencilClip(GrRenderTarget*, const SkIRect& rect, bool insideCli
p) override; |
| 175 | 163 |
| 176 bool onMakeCopyForTextureParams(GrTexture*, const GrTextureParams&, | 164 bool onMakeCopyForTextureParams(GrTexture*, const GrTextureParams&, |
| 177 GrTextureProducer::CopyParams*) const overri
de; | 165 GrTextureProducer::CopyParams*) const overri
de; |
| 178 | 166 |
| 179 // Checks whether glReadPixels can be called to get pixel values in readConf
ig from the | 167 // Checks whether glReadPixels can be called to get pixel values in readConf
ig from the |
| 180 // render target. | 168 // render target. |
| 181 bool readPixelsSupported(GrRenderTarget* target, GrPixelConfig readConfig); | 169 bool readPixelsSupported(GrRenderTarget* target, GrPixelConfig readConfig); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 void flushStencil(const GrStencilSettings&); | 305 void flushStencil(const GrStencilSettings&); |
| 318 void flushHWAAState(GrRenderTarget* rt, bool useHWAA); | 306 void flushHWAAState(GrRenderTarget* rt, bool useHWAA); |
| 319 | 307 |
| 320 // helper for onCreateTexture and writeTexturePixels | 308 // helper for onCreateTexture and writeTexturePixels |
| 321 enum UploadType { | 309 enum UploadType { |
| 322 kNewTexture_UploadType, // we are creating a new texture | 310 kNewTexture_UploadType, // we are creating a new texture |
| 323 kWrite_UploadType, // we are using TexSubImage2D to copy data to
an existing texture | 311 kWrite_UploadType, // we are using TexSubImage2D to copy data to
an existing texture |
| 324 kTransfer_UploadType, // we are using a transfer buffer to copy dat
a | 312 kTransfer_UploadType, // we are using a transfer buffer to copy dat
a |
| 325 }; | 313 }; |
| 326 bool uploadTexData(const GrSurfaceDesc& desc, | 314 bool uploadTexData(const GrSurfaceDesc& desc, |
| 327 GrGLTextureInfo* info, | 315 GrGLenum target, |
| 328 UploadType uploadType, | 316 UploadType uploadType, |
| 329 int left, int top, int width, int height, | 317 int left, int top, int width, int height, |
| 330 GrPixelConfig dataConfig, | 318 GrPixelConfig dataConfig, |
| 331 const void* data, | 319 const void* data, |
| 332 size_t rowBytes); | 320 size_t rowBytes); |
| 333 | 321 |
| 334 // helper for onCreateCompressedTexture. If width and height are | 322 // helper for onCreateCompressedTexture. If width and height are |
| 335 // set to -1, then this function will use desc.fWidth and desc.fHeight | 323 // set to -1, then this function will use desc.fWidth and desc.fHeight |
| 336 // for the size of the data. The isNewTexture flag should be set to true | 324 // for the size of the data. The isNewTexture flag should be set to true |
| 337 // whenever a new texture needs to be created. Otherwise, we assume that | 325 // whenever a new texture needs to be created. Otherwise, we assume that |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 SkFAIL("Unexpected texture target type."); | 563 SkFAIL("Unexpected texture target type."); |
| 576 return 0; | 564 return 0; |
| 577 } | 565 } |
| 578 } | 566 } |
| 579 | 567 |
| 580 typedef GrGpu INHERITED; | 568 typedef GrGpu INHERITED; |
| 581 friend class GrGLPathRendering; // For accessing setTextureUnit. | 569 friend class GrGLPathRendering; // For accessing setTextureUnit. |
| 582 }; | 570 }; |
| 583 | 571 |
| 584 #endif | 572 #endif |
| OLD | NEW |