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

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

Issue 400713003: Add a GrPathRange class (Closed) Base URL: https://skia.googlesource.com/skia.git@clupload-ispath
Patch Set: Fix more windows trivial warningswq Created 6 years, 5 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
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
11 #include "GrDrawTarget.h" 11 #include "GrDrawTarget.h"
12 #include "GrClipMaskManager.h" 12 #include "GrClipMaskManager.h"
13 #include "SkPath.h" 13 #include "SkPath.h"
14 14
15 class GrContext; 15 class GrContext;
16 class GrGpuObject; 16 class GrGpuObject;
17 class GrIndexBufferAllocPool; 17 class GrIndexBufferAllocPool;
18 class GrPath; 18 class GrPath;
19 class GrPathRange;
19 class GrPathRenderer; 20 class GrPathRenderer;
20 class GrPathRendererChain; 21 class GrPathRendererChain;
21 class GrStencilBuffer; 22 class GrStencilBuffer;
22 class GrVertexBufferAllocPool; 23 class GrVertexBufferAllocPool;
23 24
24 class GrGpu : public GrDrawTarget { 25 class GrGpu : public GrDrawTarget {
25 public: 26 public:
26 27
27 /** 28 /**
28 * Additional blend coefficients for dual source blending, not exposed 29 * Additional blend coefficients for dual source blending, not exposed
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 */ 132 */
132 GrIndexBuffer* createIndexBuffer(size_t size, bool dynamic); 133 GrIndexBuffer* createIndexBuffer(size_t size, bool dynamic);
133 134
134 /** 135 /**
135 * Creates a path object that can be stenciled using stencilPath(). It is 136 * Creates a path object that can be stenciled using stencilPath(). It is
136 * only legal to call this if the caps report support for path stenciling. 137 * only legal to call this if the caps report support for path stenciling.
137 */ 138 */
138 GrPath* createPath(const SkPath& path, const SkStrokeRec& stroke); 139 GrPath* createPath(const SkPath& path, const SkStrokeRec& stroke);
139 140
140 /** 141 /**
142 * Creates a path range object that can be used to draw multiple paths via
143 * drawPaths(). It is only legal to call this if the caps report support for
144 * path rendering.
145 */
146 GrPathRange* createPathRange(size_t size, const SkStrokeRec&);
147
148 /**
141 * Returns an index buffer that can be used to render quads. 149 * Returns an index buffer that can be used to render quads.
142 * Six indices per quad: 0, 1, 2, 0, 2, 3, etc. 150 * Six indices per quad: 0, 1, 2, 0, 2, 3, etc.
143 * The max number of quads can be queried using GrIndexBuffer::maxQuads(). 151 * The max number of quads can be queried using GrIndexBuffer::maxQuads().
144 * Draw with kTriangles_GrPrimitiveType 152 * Draw with kTriangles_GrPrimitiveType
145 * @ return the quad index buffer 153 * @ return the quad index buffer
146 */ 154 */
147 const GrIndexBuffer* getQuadIndexBuffer() const; 155 const GrIndexBuffer* getQuadIndexBuffer() const;
148 156
149 /** 157 /**
150 * Resolves MSAA. 158 * Resolves MSAA.
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 virtual GrTexture* onCreateTexture(const GrTextureDesc& desc, 433 virtual GrTexture* onCreateTexture(const GrTextureDesc& desc,
426 const void* srcData, 434 const void* srcData,
427 size_t rowBytes) = 0; 435 size_t rowBytes) = 0;
428 virtual GrTexture* onCreateCompressedTexture(const GrTextureDesc& desc, 436 virtual GrTexture* onCreateCompressedTexture(const GrTextureDesc& desc,
429 const void* srcData) = 0; 437 const void* srcData) = 0;
430 virtual GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&) = 0; 438 virtual GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&) = 0;
431 virtual GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTarge tDesc&) = 0; 439 virtual GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTarge tDesc&) = 0;
432 virtual GrVertexBuffer* onCreateVertexBuffer(size_t size, bool dynamic) = 0; 440 virtual GrVertexBuffer* onCreateVertexBuffer(size_t size, bool dynamic) = 0;
433 virtual GrIndexBuffer* onCreateIndexBuffer(size_t size, bool dynamic) = 0; 441 virtual GrIndexBuffer* onCreateIndexBuffer(size_t size, bool dynamic) = 0;
434 virtual GrPath* onCreatePath(const SkPath& path, const SkStrokeRec&) = 0; 442 virtual GrPath* onCreatePath(const SkPath& path, const SkStrokeRec&) = 0;
443 virtual GrPathRange* onCreatePathRange(size_t size, const SkStrokeRec&) = 0;
435 444
436 // overridden by backend-specific derived class to perform the clear and 445 // overridden by backend-specific derived class to perform the clear and
437 // clearRect. NULL rect means clear whole target. If canIgnoreRect is 446 // clearRect. NULL rect means clear whole target. If canIgnoreRect is
438 // true, it is okay to perform a full clear instead of a partial clear 447 // true, it is okay to perform a full clear instead of a partial clear
439 virtual void onClear(const SkIRect* rect, GrColor color, bool canIgnoreRect) = 0; 448 virtual void onClear(const SkIRect* rect, GrColor color, bool canIgnoreRect) = 0;
440 449
441 // overridden by backend-specific derived class to perform the draw call. 450 // overridden by backend-specific derived class to perform the draw call.
442 virtual void onGpuDraw(const DrawInfo&) = 0; 451 virtual void onGpuDraw(const DrawInfo&) = 0;
443 452
444 // overridden by backend-specific derived class to perform the path stencili ng. 453 // overridden by backend-specific derived class to perform the path stencili ng.
445 virtual void onGpuStencilPath(const GrPath*, SkPath::FillType) = 0; 454 virtual void onGpuStencilPath(const GrPath*, SkPath::FillType) = 0;
446 virtual void onGpuDrawPath(const GrPath*, SkPath::FillType) = 0; 455 virtual void onGpuDrawPath(const GrPath*, SkPath::FillType) = 0;
447 virtual void onGpuDrawPaths(int, const GrPath**, const SkMatrix*, 456 virtual void onGpuDrawPaths(const GrPathRange*,
448 SkPath::FillType, SkStrokeRec::Style) = 0; 457 const uint32_t indices[], int count,
458 const float transforms[], PathTransformType,
459 SkPath::FillType) = 0;
449 460
450 // overridden by backend-specific derived class to perform the read pixels. 461 // overridden by backend-specific derived class to perform the read pixels.
451 virtual bool onReadPixels(GrRenderTarget* target, 462 virtual bool onReadPixels(GrRenderTarget* target,
452 int left, int top, int width, int height, 463 int left, int top, int width, int height,
453 GrPixelConfig, 464 GrPixelConfig,
454 void* buffer, 465 void* buffer,
455 size_t rowBytes) = 0; 466 size_t rowBytes) = 0;
456 467
457 // overridden by backend-specific derived class to perform the texture updat e 468 // overridden by backend-specific derived class to perform the texture updat e
458 virtual bool onWriteTexturePixels(GrTexture* texture, 469 virtual bool onWriteTexturePixels(GrTexture* texture,
(...skipping 22 matching lines...) Expand all
481 virtual void clearStencil() = 0; 492 virtual void clearStencil() = 0;
482 493
483 // Given a rt, find or create a stencil buffer and attach it 494 // Given a rt, find or create a stencil buffer and attach it
484 bool attachStencilBufferToRenderTarget(GrRenderTarget* target); 495 bool attachStencilBufferToRenderTarget(GrRenderTarget* target);
485 496
486 // GrDrawTarget overrides 497 // GrDrawTarget overrides
487 virtual void onDraw(const DrawInfo&) SK_OVERRIDE; 498 virtual void onDraw(const DrawInfo&) SK_OVERRIDE;
488 virtual void onStencilPath(const GrPath*, SkPath::FillType) SK_OVERRIDE; 499 virtual void onStencilPath(const GrPath*, SkPath::FillType) SK_OVERRIDE;
489 virtual void onDrawPath(const GrPath*, SkPath::FillType, 500 virtual void onDrawPath(const GrPath*, SkPath::FillType,
490 const GrDeviceCoordTexture* dstCopy) SK_OVERRIDE; 501 const GrDeviceCoordTexture* dstCopy) SK_OVERRIDE;
491 virtual void onDrawPaths(int, const GrPath**, const SkMatrix*, 502 virtual void onDrawPaths(const GrPathRange*,
492 SkPath::FillType, SkStrokeRec::Style, 503 const uint32_t indices[], int count,
493 const GrDeviceCoordTexture* dstCopy) SK_OVERRIDE; 504 const float transforms[], PathTransformType,
505 SkPath::FillType, const GrDeviceCoordTexture*) SK_O VERRIDE;
494 506
495 // readies the pools to provide vertex/index data. 507 // readies the pools to provide vertex/index data.
496 void prepareVertexPool(); 508 void prepareVertexPool();
497 void prepareIndexPool(); 509 void prepareIndexPool();
498 510
499 void resetContext() { 511 void resetContext() {
500 // We call this because the client may have messed with the 512 // We call this because the client may have messed with the
501 // stencil buffer. Perhaps we should detect whether it is a 513 // stencil buffer. Perhaps we should detect whether it is a
502 // internally created stencil buffer and if so skip the invalidate. 514 // internally created stencil buffer and if so skip the invalidate.
503 fClipMaskManager.invalidateStencilMask(); 515 fClipMaskManager.invalidateStencilMask();
(...skipping 23 matching lines...) Expand all
527 // these are mutable so they can be created on-demand 539 // these are mutable so they can be created on-demand
528 mutable GrIndexBuffer* fQuadInd exBuffer; 540 mutable GrIndexBuffer* fQuadInd exBuffer;
529 // Used to abandon/release all resources created by this GrGpu. TODO: Move t his 541 // Used to abandon/release all resources created by this GrGpu. TODO: Move t his
530 // functionality to GrResourceCache. 542 // functionality to GrResourceCache.
531 ObjectList fObjectL ist; 543 ObjectList fObjectL ist;
532 544
533 typedef GrDrawTarget INHERITED; 545 typedef GrDrawTarget INHERITED;
534 }; 546 };
535 547
536 #endif 548 #endif
OLDNEW
« src/gpu/GrDrawTarget.h ('K') | « src/gpu/GrDrawTarget.cpp ('k') | src/gpu/GrGpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698