| 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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 void clearStencilClip(const SkIRect& rect, bool insideClip, GrRenderTarget*
renderTarget); | 271 void clearStencilClip(const SkIRect& rect, bool insideClip, GrRenderTarget*
renderTarget); |
| 272 | 272 |
| 273 /** | 273 /** |
| 274 * Discards the contents render target. NULL indicates that the current rend
er target should | 274 * Discards the contents render target. NULL indicates that the current rend
er target should |
| 275 * be discarded. | 275 * be discarded. |
| 276 **/ | 276 **/ |
| 277 virtual void discard(GrRenderTarget* = NULL) = 0; | 277 virtual void discard(GrRenderTarget* = NULL) = 0; |
| 278 | 278 |
| 279 /** | 279 /** |
| 280 * This is can be called before allocating a texture to be a dst for copySur
face. It will | 280 * This is can be called before allocating a texture to be a dst for copySur
face. It will |
| 281 * populate the origin, config, and flags fields of the desc such that copyS
urface is more | 281 * populate the origin, config, and flags fields of the desc such that copyS
urface can |
| 282 * likely to succeed and be efficient. | 282 * efficiently succeed. It should only succeed if it can allow copySurface t
o perform a copy |
| 283 * that would be more effecient than drawing the src to a dst render target. |
| 283 */ | 284 */ |
| 284 virtual void initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* des
c); | 285 virtual bool initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* des
c) = 0; |
| 285 | 286 |
| 286 // After the client interacts directly with the 3D context state the GrGpu | 287 // After the client interacts directly with the 3D context state the GrGpu |
| 287 // must resync its internal state and assumptions about 3D context state. | 288 // must resync its internal state and assumptions about 3D context state. |
| 288 // Each time this occurs the GrGpu bumps a timestamp. | 289 // Each time this occurs the GrGpu bumps a timestamp. |
| 289 // state of the 3D context | 290 // state of the 3D context |
| 290 // At 10 resets / frame and 60fps a 64bit timestamp will overflow in about | 291 // At 10 resets / frame and 60fps a 64bit timestamp will overflow in about |
| 291 // a billion years. | 292 // a billion years. |
| 292 typedef uint64_t ResetTimestamp; | 293 typedef uint64_t ResetTimestamp; |
| 293 | 294 |
| 294 // This timestamp is always older than the current timestamp | 295 // This timestamp is always older than the current timestamp |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 * Takes the current active set of markers and stores them for later use. An
y current marker | 331 * Takes the current active set of markers and stores them for later use. An
y current marker |
| 331 * in the active set is removed from the active set and the targets remove f
unction is called. | 332 * in the active set is removed from the active set and the targets remove f
unction is called. |
| 332 * These functions do not work as a stack so you cannot call save a second t
ime before calling | 333 * These functions do not work as a stack so you cannot call save a second t
ime before calling |
| 333 * restore. Also, it is assumed that when restore is called the current acti
ve set of markers | 334 * restore. Also, it is assumed that when restore is called the current acti
ve set of markers |
| 334 * is empty. When the stored markers are added back into the active set, the
targets add marker | 335 * is empty. When the stored markers are added back into the active set, the
targets add marker |
| 335 * is called. | 336 * is called. |
| 336 */ | 337 */ |
| 337 void saveActiveTraceMarkers(); | 338 void saveActiveTraceMarkers(); |
| 338 void restoreActiveTraceMarkers(); | 339 void restoreActiveTraceMarkers(); |
| 339 | 340 |
| 340 // Called to determine whether an onCopySurface call would succeed or not. T
his is useful for | 341 // Called to determine whether a copySurface call would succeed or not. Deri
ved |
| 341 // proxy subclasses to test whether the copy would succeed without executing
it yet. Derived | 342 // classes must keep this consistent with their implementation of onCopySurf
ace(). Fallbacks |
| 342 // classes must keep this consistent with their implementation of onCopySurf
ace(). The inputs | 343 // to issuing a draw from the src to dst take place at the GrDrawTarget leve
l and this function |
| 343 // are the same as onCopySurface(), i.e. srcRect and dstPoint are clipped to
be inside the src | 344 // should only return true if a faster copy path exists. The rect and point
are pre-clipped. The |
| 344 // and dst bounds. | 345 // src rect and implied dst rect are guaranteed to be within the src/dst bou
nds and non-empty. |
| 345 virtual bool canCopySurface(const GrSurface* dst, | 346 virtual bool canCopySurface(const GrSurface* dst, |
| 346 const GrSurface* src, | 347 const GrSurface* src, |
| 347 const SkIRect& srcRect, | 348 const SkIRect& srcRect, |
| 348 const SkIPoint& dstPoint) = 0; | 349 const SkIPoint& dstPoint) = 0; |
| 349 | 350 |
| 350 // This method is called by copySurface The srcRect is guaranteed to be ent
irely within the | 351 // Called to perform a surface to surface copy. Fallbacks to issuing a draw
from the src to dst |
| 351 // src bounds. Likewise, the dst rect implied by dstPoint and srcRect's widt
h and height falls | 352 // take place at the GrDrawTarget level and this function implement faster c
opy paths. The rect |
| 352 // entirely within the dst. The default implementation will draw a rect from
the src to the | 353 // and point are pre-clipped. The src rect and implied dst rect are guarante
ed to be within the |
| 353 // dst if the src is a texture and the dst is a render target and fail other
wise. | 354 // src/dst bounds and non-empty. |
| 354 virtual bool copySurface(GrSurface* dst, | 355 virtual bool copySurface(GrSurface* dst, |
| 355 GrSurface* src, | 356 GrSurface* src, |
| 356 const SkIRect& srcRect, | 357 const SkIRect& srcRect, |
| 357 const SkIPoint& dstPoint) = 0; | 358 const SkIPoint& dstPoint) = 0; |
| 358 | 359 |
| 359 virtual void draw(const GrOptDrawState&, const GrDrawTarget::DrawInfo&); | 360 virtual void draw(const GrOptDrawState&, const GrDrawTarget::DrawInfo&); |
| 360 virtual void stencilPath(const GrOptDrawState&, | 361 virtual void stencilPath(const GrOptDrawState&, |
| 361 const GrPath*, | 362 const GrPath*, |
| 362 const GrStencilSettings&); | 363 const GrStencilSettings&); |
| 363 virtual void drawPath(const GrOptDrawState&, | 364 virtual void drawPath(const GrOptDrawState&, |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 int fGpuTrac
eMarkerCount; | 500 int fGpuTrac
eMarkerCount; |
| 500 GrTraceMarkerSet fActiveT
raceMarkers; | 501 GrTraceMarkerSet fActiveT
raceMarkers; |
| 501 GrTraceMarkerSet fStoredT
raceMarkers; | 502 GrTraceMarkerSet fStoredT
raceMarkers; |
| 502 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. | 503 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. |
| 503 GrContext* fContext
; | 504 GrContext* fContext
; |
| 504 | 505 |
| 505 typedef SkRefCnt INHERITED; | 506 typedef SkRefCnt INHERITED; |
| 506 }; | 507 }; |
| 507 | 508 |
| 508 #endif | 509 #endif |
| OLD | NEW |