| 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 GrGpu_DEFINED | 8 #ifndef GrGpu_DEFINED |
| 9 #define GrGpu_DEFINED | 9 #define GrGpu_DEFINED |
| 10 | 10 |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 * @param buffer memory to read pixels from | 242 * @param buffer memory to read pixels from |
| 243 * @param rowBytes number of bytes between consecutive rows. Zero | 243 * @param rowBytes number of bytes between consecutive rows. Zero |
| 244 * means rows are tightly packed. | 244 * means rows are tightly packed. |
| 245 */ | 245 */ |
| 246 bool writeTexturePixels(GrTexture* texture, | 246 bool writeTexturePixels(GrTexture* texture, |
| 247 int left, int top, int width, int height, | 247 int left, int top, int width, int height, |
| 248 GrPixelConfig config, const void* buffer, | 248 GrPixelConfig config, const void* buffer, |
| 249 size_t rowBytes); | 249 size_t rowBytes); |
| 250 | 250 |
| 251 /** | 251 /** |
| 252 * Called to tell GrGpu that all GrGpuObjects have been lost and should | 252 * Called to tell GrGpu that all GrGpuResources have been lost and should |
| 253 * be abandoned. Overrides must call INHERITED::abandonResources(). | 253 * be abandoned. Overrides must call INHERITED::abandonResources(). |
| 254 */ | 254 */ |
| 255 virtual void abandonResources(); | 255 virtual void abandonResources(); |
| 256 | 256 |
| 257 /** | 257 /** |
| 258 * Called to tell GrGpu to release all GrGpuObjects. Overrides must call | 258 * Called to tell GrGpu to release all GrGpuResources. Overrides must call |
| 259 * INHERITED::releaseResources(). | 259 * INHERITED::releaseResources(). |
| 260 */ | 260 */ |
| 261 void releaseResources(); | 261 void releaseResources(); |
| 262 | 262 |
| 263 /** | 263 /** |
| 264 * Add object to list of objects. Should only be called by GrGpuObject. | 264 * Add object to list of objects. Should only be called by GrGpuResource. |
| 265 * @param resource the resource to add. | 265 * @param resource the resource to add. |
| 266 */ | 266 */ |
| 267 void insertObject(GrGpuObject* object); | 267 void insertObject(GrGpuResource* object); |
| 268 | 268 |
| 269 /** | 269 /** |
| 270 * Remove object from list of objects. Should only be called by GrGpuObject. | 270 * Remove object from list of objects. Should only be called by GrGpuResourc
e. |
| 271 * @param resource the resource to remove. | 271 * @param resource the resource to remove. |
| 272 */ | 272 */ |
| 273 void removeObject(GrGpuObject* object); | 273 void removeObject(GrGpuResource* object); |
| 274 | 274 |
| 275 // GrDrawTarget overrides | 275 // GrDrawTarget overrides |
| 276 virtual void clear(const SkIRect* rect, | 276 virtual void clear(const SkIRect* rect, |
| 277 GrColor color, | 277 GrColor color, |
| 278 bool canIgnoreRect, | 278 bool canIgnoreRect, |
| 279 GrRenderTarget* renderTarget = NULL) SK_OVERRIDE; | 279 GrRenderTarget* renderTarget = NULL) SK_OVERRIDE; |
| 280 | 280 |
| 281 virtual void purgeResources() SK_OVERRIDE { | 281 virtual void purgeResources() SK_OVERRIDE { |
| 282 // The clip mask manager can rebuild all its clip masks so just | 282 // The clip mask manager can rebuild all its clip masks so just |
| 283 // get rid of them all. | 283 // get rid of them all. |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 | 519 |
| 520 void handleDirtyContext() { | 520 void handleDirtyContext() { |
| 521 if (fResetBits) { | 521 if (fResetBits) { |
| 522 this->resetContext(); | 522 this->resetContext(); |
| 523 } | 523 } |
| 524 } | 524 } |
| 525 | 525 |
| 526 enum { | 526 enum { |
| 527 kPreallocGeomPoolStateStackCnt = 4, | 527 kPreallocGeomPoolStateStackCnt = 4, |
| 528 }; | 528 }; |
| 529 typedef SkTInternalLList<GrGpuObject> ObjectList; | 529 typedef SkTInternalLList<GrGpuResource> ObjectList; |
| 530 SkSTArray<kPreallocGeomPoolStateStackCnt, GeometryPoolState, true> fGeomPoo
lStateStack; | 530 SkSTArray<kPreallocGeomPoolStateStackCnt, GeometryPoolState, true> fGeomPoo
lStateStack; |
| 531 ResetTimestamp fResetTi
mestamp; | 531 ResetTimestamp fResetTi
mestamp; |
| 532 uint32_t fResetBi
ts; | 532 uint32_t fResetBi
ts; |
| 533 GrVertexBufferAllocPool* fVertexP
ool; | 533 GrVertexBufferAllocPool* fVertexP
ool; |
| 534 GrIndexBufferAllocPool* fIndexPo
ol; | 534 GrIndexBufferAllocPool* fIndexPo
ol; |
| 535 // counts number of uses of vertex/index pool in the geometry stack | 535 // counts number of uses of vertex/index pool in the geometry stack |
| 536 int fVertexP
oolUseCnt; | 536 int fVertexP
oolUseCnt; |
| 537 int fIndexPo
olUseCnt; | 537 int fIndexPo
olUseCnt; |
| 538 // these are mutable so they can be created on-demand | 538 // these are mutable so they can be created on-demand |
| 539 mutable GrIndexBuffer* fQuadInd
exBuffer; | 539 mutable GrIndexBuffer* fQuadInd
exBuffer; |
| 540 // Used to abandon/release all resources created by this GrGpu. TODO: Move t
his | 540 // Used to abandon/release all resources created by this GrGpu. TODO: Move t
his |
| 541 // functionality to GrResourceCache. | 541 // functionality to GrResourceCache. |
| 542 ObjectList fObjectL
ist; | 542 ObjectList fObjectL
ist; |
| 543 | 543 |
| 544 typedef GrDrawTarget INHERITED; | 544 typedef GrDrawTarget INHERITED; |
| 545 }; | 545 }; |
| 546 | 546 |
| 547 #endif | 547 #endif |
| OLD | NEW |