Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(739)

Side by Side Diff: src/gpu/GrGpu.h

Issue 731073003: minor cleanup in GrGpu.h (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 * the GrGpu that the state was modified and it shouldn't make assumptions 76 * the GrGpu that the state was modified and it shouldn't make assumptions
77 * about the state. 77 * about the state.
78 */ 78 */
79 void markContextDirty(uint32_t state = kAll_GrBackendState) { 79 void markContextDirty(uint32_t state = kAll_GrBackendState) {
80 fResetBits |= state; 80 fResetBits |= state;
81 } 81 }
82 82
83 void unimpl(const char[]); 83 void unimpl(const char[]);
84 84
85 /** 85 /**
86 * Creates a texture object. If desc width or height is not a power of 86 * Creates a texture object. If kRenderTarget_GrSurfaceFlag the texture can
87 * two but underlying API requires a power of two texture then srcData 87 * be used as a render target by calling GrTexture::asRenderTarget(). Not al l
88 * will be embedded in a power of two texture. The extra width and height 88 * pixel configs can be used as render targets. Support for configs as textu res
89 * is filled as though srcData were rendered clamped into the texture. 89 * or render targets can be checked using GrDrawTargetCaps.
90 * The exception is when using compressed data formats. In this case, the
91 * desc width and height must be a multiple of the compressed format block
92 * size otherwise this function returns NULL. Similarly, if the underlying
93 * API requires a power of two texture and the source width and height are n ot
94 * a power of two, then this function returns NULL.
95 *
96 * If kRenderTarget_TextureFlag is specified the GrRenderTarget is
97 * accessible via GrTexture::asRenderTarget(). The texture will hold a ref
98 * on the render target until the texture is destroyed. Compressed textures
99 * cannot have the kRenderTarget_TextureFlag set.
100 * 90 *
101 * @param desc describes the texture to be created. 91 * @param desc describes the texture to be created.
102 * @param srcData texel data to load texture. Begins with full-size 92 * @param srcData texel data to load texture. Begins with full-size
103 * palette data for paletted textures. For compressed 93 * palette data for paletted textures. For compressed
104 * formats it contains the compressed pixel data. Otherwi se, 94 * formats it contains the compressed pixel data. Otherwi se,
105 * it contains width*height texels. If NULL texture data 95 * it contains width*height texels. If NULL texture data
106 * is uninitialized. 96 * is uninitialized.
107 * @param rowBytes the number of bytes between consecutive rows. Zero 97 * @param rowBytes the number of bytes between consecutive rows. Zero
108 * means rows are tightly packed. This field is ignored 98 * means rows are tightly packed. This field is ignored
109 * for compressed formats. 99 * for compressed formats.
110 * 100 *
111 * @return The texture object if successful, otherwise NULL. 101 * @return The texture object if successful, otherwise NULL.
112 */ 102 */
113 GrTexture* createTexture(const GrSurfaceDesc& desc, 103 GrTexture* createTexture(const GrSurfaceDesc& desc, const void* srcData, siz e_t rowBytes);
114 const void* srcData, size_t rowBytes);
115 104
116 /** 105 /**
117 * Implements GrContext::wrapBackendTexture 106 * Implements GrContext::wrapBackendTexture
118 */ 107 */
119 GrTexture* wrapBackendTexture(const GrBackendTextureDesc&); 108 GrTexture* wrapBackendTexture(const GrBackendTextureDesc&);
120 109
121 /** 110 /**
122 * Implements GrContext::wrapBackendTexture 111 * Implements GrContext::wrapBackendTexture
123 */ 112 */
124 GrRenderTarget* wrapBackendRenderTarget(const GrBackendRenderTargetDesc&); 113 GrRenderTarget* wrapBackendRenderTarget(const GrBackendRenderTargetDesc&);
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 bool writeTexturePixels(GrTexture* texture, 257 bool writeTexturePixels(GrTexture* texture,
269 int left, int top, int width, int height, 258 int left, int top, int width, int height,
270 GrPixelConfig config, const void* buffer, 259 GrPixelConfig config, const void* buffer,
271 size_t rowBytes); 260 size_t rowBytes);
272 261
273 /** 262 /**
274 * Clear the passed in render target. Ignores the draw state and clip. Clear s the whole thing if 263 * Clear the passed in render target. Ignores the draw state and clip. Clear s the whole thing if
275 * rect is NULL, otherwise just the rect. If canIgnoreRect is set then the e ntire render target 264 * rect is NULL, otherwise just the rect. If canIgnoreRect is set then the e ntire render target
276 * can be optionally cleared. 265 * can be optionally cleared.
277 */ 266 */
278 void clear(const SkIRect* rect, 267 void clear(const SkIRect* rect, GrColor color, bool canIgnoreRect,GrRenderTa rget* renderTarget);
279 GrColor color,
280 bool canIgnoreRect,
281 GrRenderTarget* renderTarget);
282 268
283 269
284 void clearStencilClip(const SkIRect& rect, 270 void clearStencilClip(const SkIRect& rect, bool insideClip, GrRenderTarget* renderTarget);
285 bool insideClip,
286 GrRenderTarget* renderTarget);
287 271
288 /** 272 /**
289 * Discards the contents render target. NULL indicates that the current rend er target should 273 * Discards the contents render target. NULL indicates that the current rend er target should
290 * be discarded. 274 * be discarded.
291 **/ 275 **/
292 virtual void discard(GrRenderTarget* = NULL) = 0; 276 virtual void discard(GrRenderTarget* = NULL) = 0;
293 277
294 /** 278 /**
295 * This is can be called before allocating a texture to be a dst for copySur face. It will 279 * This is can be called before allocating a texture to be a dst for copySur face. It will
296 * populate the origin, config, and flags fields of the desc such that copyS urface is more 280 * populate the origin, config, and flags fields of the desc such that copyS urface is more
297 * likely to succeed and be efficient. 281 * likely to succeed and be efficient.
298 */ 282 */
299 virtual void initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* des c); 283 virtual void initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* des c);
300 284
301 // After the client interacts directly with the 3D context state the GrGpu 285 // After the client interacts directly with the 3D context state the GrGpu
302 // must resync its internal state and assumptions about 3D context state. 286 // must resync its internal state and assumptions about 3D context state.
303 // Each time this occurs the GrGpu bumps a timestamp. 287 // Each time this occurs the GrGpu bumps a timestamp.
304 // state of the 3D context 288 // state of the 3D context
305 // At 10 resets / frame and 60fps a 64bit timestamp will overflow in about 289 // At 10 resets / frame and 60fps a 64bit timestamp will overflow in about
306 // a billion years. 290 // a billion years.
307 typedef uint64_t ResetTimestamp; 291 typedef uint64_t ResetTimestamp;
308 292
309 // This timestamp is always older than the current timestamp 293 // This timestamp is always older than the current timestamp
310 static const ResetTimestamp kExpiredTimestamp = 0; 294 static const ResetTimestamp kExpiredTimestamp = 0;
311 // Returns a timestamp based on the number of times the context was reset. 295 // Returns a timestamp based on the number of times the context was reset.
312 // This timestamp can be used to lazily detect when cached 3D context state 296 // This timestamp can be used to lazily detect when cached 3D context state
313 // is dirty. 297 // is dirty.
314 ResetTimestamp getResetTimestamp() const { 298 ResetTimestamp getResetTimestamp() const { return fResetTimestamp; }
315 return fResetTimestamp;
316 }
317 299
318 enum DrawType { 300 enum DrawType {
319 kDrawPoints_DrawType, 301 kDrawPoints_DrawType,
320 kDrawLines_DrawType, 302 kDrawLines_DrawType,
321 kDrawTriangles_DrawType, 303 kDrawTriangles_DrawType,
322 kStencilPath_DrawType, 304 kStencilPath_DrawType,
323 kDrawPath_DrawType, 305 kDrawPath_DrawType,
324 kDrawPaths_DrawType, 306 kDrawPaths_DrawType,
325 }; 307 };
326 308
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 int fGpuTrac eMarkerCount; 545 int fGpuTrac eMarkerCount;
564 GrTraceMarkerSet fActiveT raceMarkers; 546 GrTraceMarkerSet fActiveT raceMarkers;
565 GrTraceMarkerSet fStoredT raceMarkers; 547 GrTraceMarkerSet fStoredT raceMarkers;
566 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. 548 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu.
567 GrContext* fContext ; 549 GrContext* fContext ;
568 550
569 typedef SkRefCnt INHERITED; 551 typedef SkRefCnt INHERITED;
570 }; 552 };
571 553
572 #endif 554 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698