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