| 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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 * @param buffer memory to read pixels from | 259 * @param buffer memory to read pixels from |
| 260 * @param rowBytes number of bytes between consecutive rows. Zero | 260 * @param rowBytes number of bytes between consecutive rows. Zero |
| 261 * means rows are tightly packed. | 261 * means rows are tightly packed. |
| 262 */ | 262 */ |
| 263 bool writeTexturePixels(GrTexture* texture, | 263 bool writeTexturePixels(GrTexture* texture, |
| 264 int left, int top, int width, int height, | 264 int left, int top, int width, int height, |
| 265 GrPixelConfig config, const void* buffer, | 265 GrPixelConfig config, const void* buffer, |
| 266 size_t rowBytes); | 266 size_t rowBytes); |
| 267 | 267 |
| 268 // GrDrawTarget overrides | 268 // GrDrawTarget overrides |
| 269 virtual void clear(const SkIRect* rect, GrColor color, bool canIgnoreRect, | |
| 270 GrRenderTarget* renderTarget) SK_OVERRIDE; | |
| 271 | |
| 272 virtual void clearStencilClip(const SkIRect& rect, | 269 virtual void clearStencilClip(const SkIRect& rect, |
| 273 bool insideClip, | 270 bool insideClip, |
| 274 GrRenderTarget* renderTarget = NULL) SK_OVERRI
DE; | 271 GrRenderTarget* renderTarget = NULL) SK_OVERRI
DE; |
| 275 | 272 |
| 276 // After the client interacts directly with the 3D context state the GrGpu | 273 // After the client interacts directly with the 3D context state the GrGpu |
| 277 // must resync its internal state and assumptions about 3D context state. | 274 // must resync its internal state and assumptions about 3D context state. |
| 278 // Each time this occurs the GrGpu bumps a timestamp. | 275 // Each time this occurs the GrGpu bumps a timestamp. |
| 279 // state of the 3D context | 276 // state of the 3D context |
| 280 // At 10 resets / frame and 60fps a 64bit timestamp will overflow in about | 277 // At 10 resets / frame and 60fps a 64bit timestamp will overflow in about |
| 281 // a billion years. | 278 // a billion years. |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 SkAutoTDelete<GrPathRendering> fPathRendering; | 364 SkAutoTDelete<GrPathRendering> fPathRendering; |
| 368 | 365 |
| 369 private: | 366 private: |
| 370 // GrDrawTarget overrides | 367 // GrDrawTarget overrides |
| 371 virtual bool onReserveVertexSpace(size_t vertexSize, int vertexCount, void**
vertices) SK_OVERRIDE; | 368 virtual bool onReserveVertexSpace(size_t vertexSize, int vertexCount, void**
vertices) SK_OVERRIDE; |
| 372 virtual bool onReserveIndexSpace(int indexCount, void** indices) SK_OVERRIDE
; | 369 virtual bool onReserveIndexSpace(int indexCount, void** indices) SK_OVERRIDE
; |
| 373 virtual void releaseReservedVertexSpace() SK_OVERRIDE; | 370 virtual void releaseReservedVertexSpace() SK_OVERRIDE; |
| 374 virtual void releaseReservedIndexSpace() SK_OVERRIDE; | 371 virtual void releaseReservedIndexSpace() SK_OVERRIDE; |
| 375 virtual void geometrySourceWillPush() SK_OVERRIDE; | 372 virtual void geometrySourceWillPush() SK_OVERRIDE; |
| 376 virtual void geometrySourceWillPop(const GeometrySrcState& restoredState) SK
_OVERRIDE; | 373 virtual void geometrySourceWillPop(const GeometrySrcState& restoredState) SK
_OVERRIDE; |
| 377 | 374 virtual void onClear(const SkIRect* rect, GrColor color, bool canIgnoreRect, |
| 375 GrRenderTarget* renderTarget) SK_OVERRIDE; |
| 378 | 376 |
| 379 // called when the 3D context state is unknown. Subclass should emit any | 377 // called when the 3D context state is unknown. Subclass should emit any |
| 380 // assumed 3D context state and dirty any state cache. | 378 // assumed 3D context state and dirty any state cache. |
| 381 virtual void onResetContext(uint32_t resetBits) = 0; | 379 virtual void onResetContext(uint32_t resetBits) = 0; |
| 382 | 380 |
| 383 // overridden by backend-specific derived class to create objects. | 381 // overridden by backend-specific derived class to create objects. |
| 384 virtual GrTexture* onCreateTexture(const GrSurfaceDesc& desc, | 382 virtual GrTexture* onCreateTexture(const GrSurfaceDesc& desc, |
| 385 const void* srcData, | 383 const void* srcData, |
| 386 size_t rowBytes) = 0; | 384 size_t rowBytes) = 0; |
| 387 virtual GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc, | 385 virtual GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc, |
| 388 const void* srcData) = 0; | 386 const void* srcData) = 0; |
| 389 virtual GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&) = 0; | 387 virtual GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&) = 0; |
| 390 virtual GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTarge
tDesc&) = 0; | 388 virtual GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTarge
tDesc&) = 0; |
| 391 virtual GrVertexBuffer* onCreateVertexBuffer(size_t size, bool dynamic) = 0; | 389 virtual GrVertexBuffer* onCreateVertexBuffer(size_t size, bool dynamic) = 0; |
| 392 virtual GrIndexBuffer* onCreateIndexBuffer(size_t size, bool dynamic) = 0; | 390 virtual GrIndexBuffer* onCreateIndexBuffer(size_t size, bool dynamic) = 0; |
| 393 | 391 |
| 394 // overridden by backend-specific derived class to perform the clear and | 392 // overridden by backend-specific derived class to perform the clear. |
| 395 // clearRect. NULL rect means clear whole target. If canIgnoreRect is | 393 virtual void onGpuClear(GrRenderTarget*, const SkIRect* rect, GrColor color, |
| 396 // true, it is okay to perform a full clear instead of a partial clear | 394 bool canIgnoreRect) = 0; |
| 397 virtual void onClear(GrRenderTarget*, const SkIRect* rect, GrColor color, | |
| 398 bool canIgnoreRect) = 0; | |
| 399 | 395 |
| 400 | 396 |
| 401 // Overridden by backend specific classes to perform a clear of the stencil
clip bits. This is | 397 // Overridden by backend specific classes to perform a clear of the stencil
clip bits. This is |
| 402 // ONLY used by the the clip target | 398 // ONLY used by the the clip target |
| 403 virtual void onClearStencilClip(GrRenderTarget*, | 399 virtual void onClearStencilClip(GrRenderTarget*, |
| 404 const SkIRect& rect, | 400 const SkIRect& rect, |
| 405 bool insideClip) = 0; | 401 bool insideClip) = 0; |
| 406 | 402 |
| 407 // overridden by backend-specific derived class to perform the draw call. | 403 // overridden by backend-specific derived class to perform the draw call. |
| 408 virtual void onGpuDraw(const DrawInfo&) = 0; | 404 virtual void onGpuDraw(const DrawInfo&) = 0; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 // counts number of uses of vertex/index pool in the geometry stack | 478 // counts number of uses of vertex/index pool in the geometry stack |
| 483 int fVertexP
oolUseCnt; | 479 int fVertexP
oolUseCnt; |
| 484 int fIndexPo
olUseCnt; | 480 int fIndexPo
olUseCnt; |
| 485 // these are mutable so they can be created on-demand | 481 // these are mutable so they can be created on-demand |
| 486 mutable GrIndexBuffer* fQuadInd
exBuffer; | 482 mutable GrIndexBuffer* fQuadInd
exBuffer; |
| 487 | 483 |
| 488 typedef GrClipTarget INHERITED; | 484 typedef GrClipTarget INHERITED; |
| 489 }; | 485 }; |
| 490 | 486 |
| 491 #endif | 487 #endif |
| OLD | NEW |