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

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

Issue 694933002: Temporary fix to remove drawrect call from GpuGL (Closed) Base URL: https://skia.googlesource.com/skia.git@cleanupcontext
Patch Set: cleanup 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 | src/gpu/GrDrawTarget.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 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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 * Copies a pixel rectangle from one surface to another. This call may final ize 449 * Copies a pixel rectangle from one surface to another. This call may final ize
450 * reserved vertex/index data (as though a draw call was made). The src pixe ls 450 * reserved vertex/index data (as though a draw call was made). The src pixe ls
451 * copied are specified by srcRect. They are copied to a rect of the same 451 * copied are specified by srcRect. They are copied to a rect of the same
452 * size in dst with top left at dstPoint. If the src rect is clipped by the 452 * size in dst with top left at dstPoint. If the src rect is clipped by the
453 * src bounds then pixel values in the dst rect corresponding to area clipp ed 453 * src bounds then pixel values in the dst rect corresponding to area clipp ed
454 * by the src rect are not overwritten. This method can fail and return fals e 454 * by the src rect are not overwritten. This method can fail and return fals e
455 * depending on the type of surface, configs, etc, and the backend-specific 455 * depending on the type of surface, configs, etc, and the backend-specific
456 * limitations. If rect is clipped out entirely by the src or dst bounds the n 456 * limitations. If rect is clipped out entirely by the src or dst bounds the n
457 * true is returned since there is no actual copy necessary to succeed. 457 * true is returned since there is no actual copy necessary to succeed.
458 */ 458 */
459 bool copySurface(GrSurface* dst, 459 virtual bool copySurface(GrSurface* dst,
460 GrSurface* src, 460 GrSurface* src,
461 const SkIRect& srcRect, 461 const SkIRect& srcRect,
462 const SkIPoint& dstPoint); 462 const SkIPoint& dstPoint);
463 /** 463 /**
464 * Function that determines whether a copySurface call would succeed without 464 * Function that determines whether a copySurface call would succeed without
465 * performing the copy. 465 * performing the copy.
466 */ 466 */
467 bool canCopySurface(GrSurface* dst, 467 virtual bool canCopySurface(GrSurface* dst,
468 GrSurface* src, 468 GrSurface* src,
469 const SkIRect& srcRect, 469 const SkIRect& srcRect,
470 const SkIPoint& dstPoint); 470 const SkIPoint& dstPoint);
471 471
472 /** 472 /**
473 * This is can be called before allocating a texture to be a dst for copySur face. It will 473 * This is can be called before allocating a texture to be a dst for copySur face. It will
474 * populate the origin, config, and flags fields of the desc such that copyS urface is more 474 * populate the origin, config, and flags fields of the desc such that copyS urface is more
475 * likely to succeed and be efficient. 475 * likely to succeed and be efficient.
476 */ 476 */
477 virtual void initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* des c); 477 virtual void initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* des c);
478 478
479 479
480 /** 480 /**
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 case kArray_GeometrySrcType: 737 case kArray_GeometrySrcType:
738 return src.fIndexCount; 738 return src.fIndexCount;
739 case kBuffer_GeometrySrcType: 739 case kBuffer_GeometrySrcType:
740 return static_cast<int>(src.fIndexBuffer->gpuMemorySize() / size of(uint16_t)); 740 return static_cast<int>(src.fIndexBuffer->gpuMemorySize() / size of(uint16_t));
741 default: 741 default:
742 SkFAIL("Unexpected Index Source."); 742 SkFAIL("Unexpected Index Source.");
743 return 0; 743 return 0;
744 } 744 }
745 } 745 }
746 746
747 // This method is called by copySurface The srcRect is guaranteed to be ent irely within the
748 // src bounds. Likewise, the dst rect implied by dstPoint and srcRect's widt h and height falls
749 // entirely within the dst. The default implementation will draw a rect from the src to the
750 // dst if the src is a texture and the dst is a render target and fail other wise.
751 virtual bool onCopySurface(GrSurface* dst,
752 GrSurface* src,
753 const SkIRect& srcRect,
754 const SkIPoint& dstPoint);
755
756 // Called to determine whether an onCopySurface call would succeed or not. T his is useful for
757 // proxy subclasses to test whether the copy would succeed without executing it yet. Derived
758 // classes must keep this consistent with their implementation of onCopySurf ace(). The inputs
759 // are the same as onCopySurface(), i.e. srcRect and dstPoint are clipped to be inside the src
760 // and dst bounds.
761 virtual bool onCanCopySurface(GrSurface* dst,
762 GrSurface* src,
763 const SkIRect& srcRect,
764 const SkIPoint& dstPoint);
765
766 GrContext* getContext() { return fContext; } 747 GrContext* getContext() { return fContext; }
767 const GrContext* getContext() const { return fContext; } 748 const GrContext* getContext() const { return fContext; }
768 749
769 // A subclass may override this function if it wishes to be notified when th e clip is changed. 750 // A subclass may override this function if it wishes to be notified when th e clip is changed.
770 // The override should call INHERITED::clipWillBeSet(). 751 // The override should call INHERITED::clipWillBeSet().
771 virtual void clipWillBeSet(const GrClipData* clipData); 752 virtual void clipWillBeSet(const GrClipData* clipData);
772 753
773 // subclasses must call this in their destructors to ensure all vertex 754 // subclasses must call this in their destructors to ensure all vertex
774 // and index sources have been released (including those held by 755 // and index sources have been released (including those held by
775 // pushGeometrySource()) 756 // pushGeometrySource())
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
918 // indicate non-indexed drawing. 899 // indicate non-indexed drawing.
919 bool checkDraw(GrPrimitiveType type, int startVertex, 900 bool checkDraw(GrPrimitiveType type, int startVertex,
920 int startIndex, int vertexCount, 901 int startIndex, int vertexCount,
921 int indexCount) const; 902 int indexCount) const;
922 // called when setting a new vert/idx source to unref prev vb/ib 903 // called when setting a new vert/idx source to unref prev vb/ib
923 void releasePreviousVertexSource(); 904 void releasePreviousVertexSource();
924 void releasePreviousIndexSource(); 905 void releasePreviousIndexSource();
925 906
926 // Check to see if this set of draw commands has been sent out 907 // Check to see if this set of draw commands has been sent out
927 virtual bool isIssued(uint32_t drawID) { return true; } 908 virtual bool isIssued(uint32_t drawID) { return true; }
928 virtual GrClipMaskManager* getClipMaskManager() = 0; 909 virtual GrClipMaskManager* clipMaskManager() = 0;
929 910
930 enum { 911 enum {
931 kPreallocGeoSrcStateStackCnt = 4, 912 kPreallocGeoSrcStateStackCnt = 4,
932 }; 913 };
933 SkSTArray<kPreallocGeoSrcStateStackCnt, GeometrySrcState, true> fGeoSrcState Stack; 914 SkSTArray<kPreallocGeoSrcStateStackCnt, GeometrySrcState, true> fGeoSrcState Stack;
934 const GrClipData* fClip; 915 const GrClipData* fClip;
935 GrDrawState* fDrawState; 916 GrDrawState* fDrawState;
936 GrDrawState fDefaultDraw State; 917 GrDrawState fDefaultDraw State;
937 // The context owns us, not vice-versa, so this ptr is not ref'ed by DrawTar get. 918 // The context owns us, not vice-versa, so this ptr is not ref'ed by DrawTar get.
938 GrContext* fContext; 919 GrContext* fContext;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 virtual void purgeResources() SK_OVERRIDE { 955 virtual void purgeResources() SK_OVERRIDE {
975 // The clip mask manager can rebuild all its clip masks so just 956 // The clip mask manager can rebuild all its clip masks so just
976 // get rid of them all. 957 // get rid of them all.
977 fClipMaskManager.purgeResources(); 958 fClipMaskManager.purgeResources();
978 }; 959 };
979 960
980 protected: 961 protected:
981 GrClipMaskManager fClipMaskManager; 962 GrClipMaskManager fClipMaskManager;
982 963
983 private: 964 private:
984 GrClipMaskManager* getClipMaskManager() { return &fClipMaskManager; } 965 GrClipMaskManager* clipMaskManager() { return &fClipMaskManager; }
985 966
986 typedef GrDrawTarget INHERITED; 967 typedef GrDrawTarget INHERITED;
987 }; 968 };
988 969
989 #endif 970 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrDrawTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698