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

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

Issue 23440049: Implement stroking a path with nv_path_rendering (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 7 years, 2 months 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 | Annotate | Revision Log
« no previous file with comments | « src/gpu/GrDrawTarget.cpp ('k') | src/gpu/GrGpu.cpp » ('j') | 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 * GrIndexBuffer::updateData. 117 * GrIndexBuffer::updateData.
118 * 118 *
119 * @return The index buffer if successful, otherwise NULL. 119 * @return The index buffer if successful, otherwise NULL.
120 */ 120 */
121 GrIndexBuffer* createIndexBuffer(uint32_t size, bool dynamic); 121 GrIndexBuffer* createIndexBuffer(uint32_t size, bool dynamic);
122 122
123 /** 123 /**
124 * Creates a path object that can be stenciled using stencilPath(). It is 124 * Creates a path object that can be stenciled using stencilPath(). It is
125 * only legal to call this if the caps report support for path stenciling. 125 * only legal to call this if the caps report support for path stenciling.
126 */ 126 */
127 GrPath* createPath(const SkPath& path); 127 GrPath* createPath(const SkPath& path, const SkStrokeRec& stroke);
128 128
129 /** 129 /**
130 * Returns an index buffer that can be used to render quads. 130 * Returns an index buffer that can be used to render quads.
131 * Six indices per quad: 0, 1, 2, 0, 2, 3, etc. 131 * Six indices per quad: 0, 1, 2, 0, 2, 3, etc.
132 * The max number of quads can be queried using GrIndexBuffer::maxQuads(). 132 * The max number of quads can be queried using GrIndexBuffer::maxQuads().
133 * Draw with kTriangles_GrPrimitiveType 133 * Draw with kTriangles_GrPrimitiveType
134 * @ return the quad index buffer 134 * @ return the quad index buffer
135 */ 135 */
136 const GrIndexBuffer* getQuadIndexBuffer() const; 136 const GrIndexBuffer* getQuadIndexBuffer() const;
137 137
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 }; 336 };
337 337
338 void getPathStencilSettingsForFillType(SkPath::FillType fill, GrStencilSetti ngs* outStencilSettings); 338 void getPathStencilSettingsForFillType(SkPath::FillType fill, GrStencilSetti ngs* outStencilSettings);
339 339
340 protected: 340 protected:
341 enum DrawType { 341 enum DrawType {
342 kDrawPoints_DrawType, 342 kDrawPoints_DrawType,
343 kDrawLines_DrawType, 343 kDrawLines_DrawType,
344 kDrawTriangles_DrawType, 344 kDrawTriangles_DrawType,
345 kStencilPath_DrawType, 345 kStencilPath_DrawType,
346 kFillPath_DrawType, 346 kDrawPath_DrawType,
347 }; 347 };
348 348
349 DrawType PrimTypeToDrawType(GrPrimitiveType type) { 349 DrawType PrimTypeToDrawType(GrPrimitiveType type) {
350 switch (type) { 350 switch (type) {
351 case kTriangles_GrPrimitiveType: 351 case kTriangles_GrPrimitiveType:
352 case kTriangleStrip_GrPrimitiveType: 352 case kTriangleStrip_GrPrimitiveType:
353 case kTriangleFan_GrPrimitiveType: 353 case kTriangleFan_GrPrimitiveType:
354 return kDrawTriangles_DrawType; 354 return kDrawTriangles_DrawType;
355 case kPoints_GrPrimitiveType: 355 case kPoints_GrPrimitiveType:
356 return kDrawPoints_DrawType; 356 return kDrawPoints_DrawType;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 virtual void onResetContext(uint32_t resetBits) = 0; 428 virtual void onResetContext(uint32_t resetBits) = 0;
429 429
430 // overridden by backend-specific derived class to create objects. 430 // overridden by backend-specific derived class to create objects.
431 virtual GrTexture* onCreateTexture(const GrTextureDesc& desc, 431 virtual GrTexture* onCreateTexture(const GrTextureDesc& desc,
432 const void* srcData, 432 const void* srcData,
433 size_t rowBytes) = 0; 433 size_t rowBytes) = 0;
434 virtual GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&) = 0; 434 virtual GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&) = 0;
435 virtual GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTarge tDesc&) = 0; 435 virtual GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTarge tDesc&) = 0;
436 virtual GrVertexBuffer* onCreateVertexBuffer(uint32_t size, bool dynamic) = 0; 436 virtual GrVertexBuffer* onCreateVertexBuffer(uint32_t size, bool dynamic) = 0;
437 virtual GrIndexBuffer* onCreateIndexBuffer(uint32_t size, bool dynamic) = 0; 437 virtual GrIndexBuffer* onCreateIndexBuffer(uint32_t size, bool dynamic) = 0;
438 virtual GrPath* onCreatePath(const SkPath& path) = 0; 438 virtual GrPath* onCreatePath(const SkPath& path, const SkStrokeRec&) = 0;
439 439
440 // overridden by backend-specific derived class to perform the clear and 440 // overridden by backend-specific derived class to perform the clear and
441 // clearRect. NULL rect means clear whole target. 441 // clearRect. NULL rect means clear whole target.
442 virtual void onClear(const SkIRect* rect, GrColor color) = 0; 442 virtual void onClear(const SkIRect* rect, GrColor color) = 0;
443 443
444 // overridden by backend-specific derived class to perform the draw call. 444 // overridden by backend-specific derived class to perform the draw call.
445 virtual void onGpuDraw(const DrawInfo&) = 0; 445 virtual void onGpuDraw(const DrawInfo&) = 0;
446 446
447 // overridden by backend-specific derived class to perform the path stencili ng. 447 // overridden by backend-specific derived class to perform the path stencili ng.
448 virtual void onGpuStencilPath(const GrPath*, SkPath::FillType) = 0; 448 virtual void onGpuStencilPath(const GrPath*, SkPath::FillType) = 0;
449 virtual void onGpuFillPath(const GrPath*, SkPath::FillType) = 0; 449 virtual void onGpuDrawPath(const GrPath*, SkPath::FillType) = 0;
450 450
451 // overridden by backend-specific derived class to perform flush 451 // overridden by backend-specific derived class to perform flush
452 virtual void onForceRenderTargetFlush() = 0; 452 virtual void onForceRenderTargetFlush() = 0;
453 453
454 // overridden by backend-specific derived class to perform the read pixels. 454 // overridden by backend-specific derived class to perform the read pixels.
455 virtual bool onReadPixels(GrRenderTarget* target, 455 virtual bool onReadPixels(GrRenderTarget* target,
456 int left, int top, int width, int height, 456 int left, int top, int width, int height,
457 GrPixelConfig, 457 GrPixelConfig,
458 void* buffer, 458 void* buffer,
459 size_t rowBytes) = 0; 459 size_t rowBytes) = 0;
(...skipping 22 matching lines...) Expand all
482 virtual bool flushGraphicsState(DrawType, const GrDeviceCoordTexture* dstCop y) = 0; 482 virtual bool flushGraphicsState(DrawType, const GrDeviceCoordTexture* dstCop y) = 0;
483 483
484 // clears the entire stencil buffer to 0 484 // clears the entire stencil buffer to 0
485 virtual void clearStencil() = 0; 485 virtual void clearStencil() = 0;
486 486
487 // Given a rt, find or create a stencil buffer and attach it 487 // Given a rt, find or create a stencil buffer and attach it
488 bool attachStencilBufferToRenderTarget(GrRenderTarget* target); 488 bool attachStencilBufferToRenderTarget(GrRenderTarget* target);
489 489
490 // GrDrawTarget overrides 490 // GrDrawTarget overrides
491 virtual void onDraw(const DrawInfo&) SK_OVERRIDE; 491 virtual void onDraw(const DrawInfo&) SK_OVERRIDE;
492 virtual void onStencilPath(const GrPath* path, const SkStrokeRec& stroke, 492 virtual void onStencilPath(const GrPath*, SkPath::FillType) SK_OVERRIDE;
493 SkPath::FillType) SK_OVERRIDE; 493 virtual void onDrawPath(const GrPath*, SkPath::FillType,
494
495 virtual void onFillPath(const GrPath* path, const SkStrokeRec& stroke, SkPat h::FillType,
496 const GrDeviceCoordTexture* dstCopy) SK_OVERRIDE; 494 const GrDeviceCoordTexture* dstCopy) SK_OVERRIDE;
497 495
498 // readies the pools to provide vertex/index data. 496 // readies the pools to provide vertex/index data.
499 void prepareVertexPool(); 497 void prepareVertexPool();
500 void prepareIndexPool(); 498 void prepareIndexPool();
501 499
502 void resetContext() { 500 void resetContext() {
503 // We call this because the client may have messed with the 501 // We call this because the client may have messed with the
504 // stencil buffer. Perhaps we should detect whether it is a 502 // stencil buffer. Perhaps we should detect whether it is a
505 // internally created stencil buffer and if so skip the invalidate. 503 // internally created stencil buffer and if so skip the invalidate.
(...skipping 24 matching lines...) Expand all
530 // these are mutable so they can be created on-demand 528 // these are mutable so they can be created on-demand
531 mutable GrIndexBuffer* fQuadInd exBuffer; 529 mutable GrIndexBuffer* fQuadInd exBuffer;
532 // Used to abandon/release all resources created by this GrGpu. TODO: Move t his 530 // Used to abandon/release all resources created by this GrGpu. TODO: Move t his
533 // functionality to GrResourceCache. 531 // functionality to GrResourceCache.
534 ResourceList fResourc eList; 532 ResourceList fResourc eList;
535 533
536 typedef GrDrawTarget INHERITED; 534 typedef GrDrawTarget INHERITED;
537 }; 535 };
538 536
539 #endif 537 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrDrawTarget.cpp ('k') | src/gpu/GrGpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698