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

Side by Side Diff: include/gpu/GrContext.h

Issue 732693002: Drawstate on stack (Closed) Base URL: https://skia.googlesource.com/skia.git@real_def_gp
Patch Set: ready 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
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 GrContext_DEFINED 8 #ifndef GrContext_DEFINED
9 #define GrContext_DEFINED 9 #define GrContext_DEFINED
10 10
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 void removeGpuTraceMarker(const GrGpuTraceMarker* marker); 893 void removeGpuTraceMarker(const GrGpuTraceMarker* marker);
894 894
895 /** 895 /**
896 * Stencil buffers add themselves to the cache using addStencilBuffer. findS tencilBuffer is 896 * Stencil buffers add themselves to the cache using addStencilBuffer. findS tencilBuffer is
897 * called to check the cache for a SB that matches an RT's criteria. 897 * called to check the cache for a SB that matches an RT's criteria.
898 */ 898 */
899 void addStencilBuffer(GrStencilBuffer* sb); 899 void addStencilBuffer(GrStencilBuffer* sb);
900 GrStencilBuffer* findAndRefStencilBuffer(int width, int height, int sampleCn t); 900 GrStencilBuffer* findAndRefStencilBuffer(int width, int height, int sampleCn t);
901 901
902 GrPathRenderer* getPathRenderer( 902 GrPathRenderer* getPathRenderer(
903 const GrDrawTarget* target,
904 const GrDrawState*,
903 const SkPath& path, 905 const SkPath& path,
904 const SkStrokeRec& stroke, 906 const SkStrokeRec& stroke,
905 const GrDrawTarget* target,
906 bool allowSW, 907 bool allowSW,
907 GrPathRendererChain::DrawType drawType = GrPathRendererChain ::kColor_DrawType, 908 GrPathRendererChain::DrawType drawType = GrPathRendererChain ::kColor_DrawType,
908 GrPathRendererChain::StencilSupport* stencilSupport = NULL); 909 GrPathRendererChain::StencilSupport* stencilSupport = NULL);
909 910
910 /** 911 /**
911 * This returns a copy of the the GrContext::Options that was passed to the 912 * This returns a copy of the the GrContext::Options that was passed to the
912 * constructor of this class. 913 * constructor of this class.
913 */ 914 */
914 const Options& getOptions() const { return fOptions; } 915 const Options& getOptions() const { return fOptions; }
915 916
(...skipping 23 matching lines...) Expand all
939 940
940 #if GR_GPU_STATS 941 #if GR_GPU_STATS
941 const GPUStats* gpuStats() const; 942 const GPUStats* gpuStats() const;
942 #endif 943 #endif
943 944
944 private: 945 private:
945 GrGpu* fGpu; 946 GrGpu* fGpu;
946 SkMatrix fViewMatrix; 947 SkMatrix fViewMatrix;
947 SkAutoTUnref<GrRenderTarget> fRenderTarget; 948 SkAutoTUnref<GrRenderTarget> fRenderTarget;
948 const GrClipData* fClip; // TODO: make this ref counted 949 const GrClipData* fClip; // TODO: make this ref counted
949 GrDrawState* fDrawState;
950 950
951 GrResourceCache* fResourceCache; 951 GrResourceCache* fResourceCache;
952 GrResourceCache2* fResourceCache2; 952 GrResourceCache2* fResourceCache2;
953 GrFontCache* fFontCache; 953 GrFontCache* fFontCache;
954 SkAutoTDelete<GrLayerCache> fLayerCache; 954 SkAutoTDelete<GrLayerCache> fLayerCache;
955 955
956 GrPathRendererChain* fPathRendererChain; 956 GrPathRendererChain* fPathRendererChain;
957 GrSoftwarePathRenderer* fSoftwarePathRenderer; 957 GrSoftwarePathRenderer* fSoftwarePathRenderer;
958 958
959 GrVertexBufferAllocPool* fDrawBufferVBAllocPool; 959 GrVertexBufferAllocPool* fDrawBufferVBAllocPool;
(...skipping 21 matching lines...) Expand all
981 981
982 const Options fOptions; 982 const Options fOptions;
983 983
984 GrContext(const Options&); // init must be called after the constructor. 984 GrContext(const Options&); // init must be called after the constructor.
985 bool init(GrBackend, GrBackendContext); 985 bool init(GrBackend, GrBackendContext);
986 void initMockContext(); 986 void initMockContext();
987 void initCommon(); 987 void initCommon();
988 988
989 void setupDrawBuffer(); 989 void setupDrawBuffer();
990 990
991 class AutoRestoreEffects;
992 class AutoCheckFlush; 991 class AutoCheckFlush;
993 /// Sets the paint and returns the target to draw into. The paint can be NUL L in which case the 992 /// Sets the paint and returns the target to draw into. The paint can be NUL L in which case the
994 /// draw state is left unmodified. 993 /// draw state is left unmodified.
995 GrDrawTarget* prepareToDraw(const GrPaint*, AutoRestoreEffects*, AutoCheckFl ush*); 994 GrDrawTarget* prepareToDraw(GrDrawState* ds, const GrPaint* paint, const Aut oCheckFlush*);
996 995
997 void internalDrawPath(GrDrawTarget* target, bool useAA, const SkPath& path, 996 void internalDrawPath(GrDrawTarget*,
998 const GrStrokeInfo& stroke); 997 GrDrawState*,
998 bool useAA,
999 const SkPath&,
1000 const GrStrokeInfo&);
999 1001
1000 GrTexture* createResizedTexture(const GrSurfaceDesc& desc, 1002 GrTexture* createResizedTexture(const GrSurfaceDesc& desc,
1001 const GrCacheID& cacheID, 1003 const GrCacheID& cacheID,
1002 const void* srcData, 1004 const void* srcData,
1003 size_t rowBytes, 1005 size_t rowBytes,
1004 bool filter); 1006 bool filter);
1005 1007
1006 GrTexture* createNewScratchTexture(const GrSurfaceDesc& desc); 1008 GrTexture* createNewScratchTexture(const GrSurfaceDesc& desc);
1007 1009
1008 /** 1010 /**
1009 * These functions create premul <-> unpremul effects if it is possible to g enerate a pair 1011 * These functions create premul <-> unpremul effects if it is possible to g enerate a pair
1010 * of effects that make a readToUPM->writeToPM->readToUPM cycle invariant. O therwise, they 1012 * of effects that make a readToUPM->writeToPM->readToUPM cycle invariant. O therwise, they
1011 * return NULL. 1013 * return NULL.
1012 */ 1014 */
1013 const GrFragmentProcessor* createPMToUPMEffect(GrTexture*, bool swapRAndB, c onst SkMatrix&); 1015 const GrFragmentProcessor* createPMToUPMEffect(GrTexture*, bool swapRAndB, c onst SkMatrix&);
1014 const GrFragmentProcessor* createUPMToPMEffect(GrTexture*, bool swapRAndB, c onst SkMatrix&); 1016 const GrFragmentProcessor* createUPMToPMEffect(GrTexture*, bool swapRAndB, c onst SkMatrix&);
1015 1017
1016 /** 1018 /**
1017 * This callback allows the resource cache to callback into the GrContext 1019 * This callback allows the resource cache to callback into the GrContext
1018 * when the cache is still overbudget after a purge. 1020 * when the cache is still overbudget after a purge.
1019 */ 1021 */
1020 static bool OverbudgetCB(void* data); 1022 static bool OverbudgetCB(void* data);
1021 1023
1022 typedef SkRefCnt INHERITED; 1024 typedef SkRefCnt INHERITED;
1023 }; 1025 };
1024 1026
1025 #endif 1027 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698