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

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

Issue 22686002: Implement path cover with nv_path_rendering (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: addressing review comments 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
OLDNEW
1 /* 1 /*
2 * Copyright 2010 Google Inc. 2 * Copyright 2010 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 GrDrawTarget_DEFINED 8 #ifndef GrDrawTarget_DEFINED
9 #define GrDrawTarget_DEFINED 9 #define GrDrawTarget_DEFINED
10 10
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 const SkRect* devBounds = NULL); 322 const SkRect* devBounds = NULL);
323 323
324 /** 324 /**
325 * Draws path into the stencil buffer. The fill must be either even/odd or 325 * Draws path into the stencil buffer. The fill must be either even/odd or
326 * winding (not inverse or hairline). It will respect the HW antialias flag 326 * winding (not inverse or hairline). It will respect the HW antialias flag
327 * on the draw state (if possible in the 3D API). 327 * on the draw state (if possible in the 3D API).
328 */ 328 */
329 void stencilPath(const GrPath*, const SkStrokeRec& stroke, SkPath::FillType fill); 329 void stencilPath(const GrPath*, const SkStrokeRec& stroke, SkPath::FillType fill);
330 330
331 /** 331 /**
332 * Fills a path. Fill must not be a hairline. It will respect the HW
333 * antialias flag on the draw state (if possible in the 3D API).
334 */
335 void fillPath(const GrPath*, const SkStrokeRec& stroke, SkPath::FillType fil l);
336
337 /**
332 * Helper function for drawing rects. It performs a geometry src push and po p 338 * Helper function for drawing rects. It performs a geometry src push and po p
333 * and thus will finalize any reserved geometry. 339 * and thus will finalize any reserved geometry.
334 * 340 *
335 * @param rect the rect to draw 341 * @param rect the rect to draw
336 * @param matrix optional matrix applied to rect (before viewMatrix) 342 * @param matrix optional matrix applied to rect (before viewMatrix)
337 * @param localRect optional rect that specifies local coords to map onto 343 * @param localRect optional rect that specifies local coords to map onto
338 * rect. If NULL then rect serves as the local coords. 344 * rect. If NULL then rect serves as the local coords.
339 * @param localMatrix optional matrix applied to localRect. If 345 * @param localMatrix optional matrix applied to localRect. If
340 * srcRect is non-NULL and srcMatrix is non-NULL 346 * srcRect is non-NULL and srcMatrix is non-NULL
341 * then srcRect will be transformed by srcMatrix. 347 * then srcRect will be transformed by srcMatrix.
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 void adjustStartVertex(int vertexOffset); 760 void adjustStartVertex(int vertexOffset);
755 // shifts the start index 761 // shifts the start index
756 void adjustStartIndex(int indexOffset); 762 void adjustStartIndex(int indexOffset);
757 763
758 void setDevBounds(const SkRect& bounds) { 764 void setDevBounds(const SkRect& bounds) {
759 fDevBoundsStorage = bounds; 765 fDevBoundsStorage = bounds;
760 fDevBounds = &fDevBoundsStorage; 766 fDevBounds = &fDevBoundsStorage;
761 } 767 }
762 const SkRect* getDevBounds() const { return fDevBounds; } 768 const SkRect* getDevBounds() const { return fDevBounds; }
763 769
764 bool getDevIBounds(SkIRect* bounds) const {
765 if (NULL != fDevBounds) {
766 fDevBounds->roundOut(bounds);
767 return true;
768 } else {
769 return false;
770 }
771 }
772
773 // NULL if no copy of the dst is needed for the draw. 770 // NULL if no copy of the dst is needed for the draw.
774 const GrDeviceCoordTexture* getDstCopy() const { 771 const GrDeviceCoordTexture* getDstCopy() const {
775 if (NULL != fDstCopy.texture()) { 772 if (NULL != fDstCopy.texture()) {
776 return &fDstCopy; 773 return &fDstCopy;
777 } else { 774 } else {
778 return NULL; 775 return NULL;
779 } 776 }
780 } 777 }
781 778
782 private: 779 private:
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 // be saved before this is called and restored afterwards. A subclass may ov erride 824 // be saved before this is called and restored afterwards. A subclass may ov erride
828 // this to perform more optimal rect rendering. Its draws should be funneled through 825 // this to perform more optimal rect rendering. Its draws should be funneled through
829 // one of the public GrDrawTarget draw methods (e.g. drawNonIndexed, 826 // one of the public GrDrawTarget draw methods (e.g. drawNonIndexed,
830 // drawIndexedInstances, ...). The base class draws a two triangle fan using 827 // drawIndexedInstances, ...). The base class draws a two triangle fan using
831 // drawNonIndexed from reserved vertex space. 828 // drawNonIndexed from reserved vertex space.
832 virtual void onDrawRect(const SkRect& rect, 829 virtual void onDrawRect(const SkRect& rect,
833 const SkMatrix* matrix, 830 const SkMatrix* matrix,
834 const SkRect* localRect, 831 const SkRect* localRect,
835 const SkMatrix* localMatrix); 832 const SkMatrix* localMatrix);
836 virtual void onStencilPath(const GrPath*, const SkStrokeRec& stroke, SkPath: :FillType fill) = 0; 833 virtual void onStencilPath(const GrPath*, const SkStrokeRec& stroke, SkPath: :FillType fill) = 0;
834 virtual void onFillPath(const GrPath*, const SkStrokeRec& stroke, SkPath::Fi llType fill,
835 const GrDeviceCoordTexture* dstCopy) = 0;
837 836
838 // helpers for reserving vertex and index space. 837 // helpers for reserving vertex and index space.
839 bool reserveVertexSpace(size_t vertexSize, 838 bool reserveVertexSpace(size_t vertexSize,
840 int vertexCount, 839 int vertexCount,
841 void** vertices); 840 void** vertices);
842 bool reserveIndexSpace(int indexCount, void** indices); 841 bool reserveIndexSpace(int indexCount, void** indices);
843 842
844 // called by drawIndexed and drawNonIndexed. Use a negative indexCount to 843 // called by drawIndexed and drawNonIndexed. Use a negative indexCount to
845 // indicate non-indexed drawing. 844 // indicate non-indexed drawing.
846 bool checkDraw(GrPrimitiveType type, int startVertex, 845 bool checkDraw(GrPrimitiveType type, int startVertex,
847 int startIndex, int vertexCount, 846 int startIndex, int vertexCount,
848 int indexCount) const; 847 int indexCount) const;
849 // called when setting a new vert/idx source to unref prev vb/ib 848 // called when setting a new vert/idx source to unref prev vb/ib
850 void releasePreviousVertexSource(); 849 void releasePreviousVertexSource();
851 void releasePreviousIndexSource(); 850 void releasePreviousIndexSource();
852 851
853 // Makes a copy of the dst if it is necessary for the draw. Returns false if a copy is required 852 // Makes a copy of the dst if it is necessary for the draw. Returns false if a copy is required
854 // but couldn't be made. Otherwise, returns true. 853 // but couldn't be made. Otherwise, returns true.
855 bool setupDstReadIfNecessary(DrawInfo* info); 854 bool setupDstReadIfNecessary(DrawInfo* info) {
855 return setupDstReadIfNecessary(&info->fDstCopy, info->getDevBounds());
bsalomon 2013/10/08 14:05:08 nit: this->setup...
Kimmo Kinnunen 2013/10/09 07:07:01 Done.
856 }
857 bool setupDstReadIfNecessary(GrDeviceCoordTexture* dstCopy, const SkRect* dr awBounds);
856 858
857 // Check to see if this set of draw commands has been sent out 859 // Check to see if this set of draw commands has been sent out
858 virtual bool isIssued(uint32_t drawID) { return true; } 860 virtual bool isIssued(uint32_t drawID) { return true; }
859 861
860 enum { 862 enum {
861 kPreallocGeoSrcStateStackCnt = 4, 863 kPreallocGeoSrcStateStackCnt = 4,
862 }; 864 };
863 SkSTArray<kPreallocGeoSrcStateStackCnt, GeometrySrcState, true> fGeoSrcState Stack; 865 SkSTArray<kPreallocGeoSrcStateStackCnt, GeometrySrcState, true> fGeoSrcState Stack;
864 const GrClipData* fClip; 866 const GrClipData* fClip;
865 GrDrawState* fDrawState; 867 GrDrawState* fDrawState;
866 GrDrawState fDefaultDraw State; 868 GrDrawState fDefaultDraw State;
867 // The context owns us, not vice-versa, so this ptr is not ref'ed by DrawTar get. 869 // The context owns us, not vice-versa, so this ptr is not ref'ed by DrawTar get.
868 GrContext* fContext; 870 GrContext* fContext;
869 871
870 typedef SkRefCnt INHERITED; 872 typedef SkRefCnt INHERITED;
871 }; 873 };
872 874
873 #endif 875 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrClipMaskManager.cpp ('k') | src/gpu/GrDrawTarget.cpp » ('j') | src/gpu/GrGpu.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698