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

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

Issue 459033002: Change GR_COMPRESS_ALPHA_MASK from compile-time flag to run-time flag (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Pass options struct to GrContext Created 6 years, 4 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
« no previous file with comments | « gyp/gpu.gyp ('k') | src/gpu/GrContext.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 GrContext_DEFINED 8 #ifndef GrContext_DEFINED
9 #define GrContext_DEFINED 9 #define GrContext_DEFINED
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 class GrVertexBuffer; 42 class GrVertexBuffer;
43 class GrVertexBufferAllocPool; 43 class GrVertexBufferAllocPool;
44 class GrStrokeInfo; 44 class GrStrokeInfo;
45 class GrSoftwarePathRenderer; 45 class GrSoftwarePathRenderer;
46 class SkStrokeRec; 46 class SkStrokeRec;
47 47
48 class SK_API GrContext : public SkRefCnt { 48 class SK_API GrContext : public SkRefCnt {
49 public: 49 public:
50 SK_DECLARE_INST_COUNT(GrContext) 50 SK_DECLARE_INST_COUNT(GrContext)
51 51
52 struct Options {
53 Options();
54 bool fDrawPathToCompressedTexture;
bsalomon 2014/08/11 19:00:47 Should we label this field experimental or somethi
krajcevski 2014/08/11 19:09:55 Done.
55 };
56
52 /** 57 /**
53 * Creates a GrContext for a backend context. 58 * Creates a GrContext for a backend context.
54 */ 59 */
55 static GrContext* Create(GrBackend, GrBackendContext); 60 static GrContext* Create(GrBackend, GrBackendContext, const Options* opts = NULL);
56 61
57 virtual ~GrContext(); 62 virtual ~GrContext();
58 63
59 /** 64 /**
60 * The GrContext normally assumes that no outsider is setting state 65 * The GrContext normally assumes that no outsider is setting state
61 * within the underlying 3D API's context/device/whatever. This call informs 66 * within the underlying 3D API's context/device/whatever. This call informs
62 * the context that the state was modified and it should resend. Shouldn't 67 * the context that the state was modified and it should resend. Shouldn't
63 * be called frequently for good performance. 68 * be called frequently for good performance.
64 * The flag bits, state, is dpendent on which backend is used by the 69 * The flag bits, state, is dpendent on which backend is used by the
65 * context, either GL or D3D (possible in future). 70 * context, either GL or D3D (possible in future).
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 320
316 /** 321 /**
317 * Temporarily override the true max texture size. Note: an override 322 * Temporarily override the true max texture size. Note: an override
318 * larger then the true max texture size will have no effect. 323 * larger then the true max texture size will have no effect.
319 * This entry point is mainly meant for testing texture size dependent 324 * This entry point is mainly meant for testing texture size dependent
320 * features and is only available if defined outside of Skia (see 325 * features and is only available if defined outside of Skia (see
321 * bleed GM. 326 * bleed GM.
322 */ 327 */
323 void setMaxTextureSizeOverride(int maxTextureSizeOverride); 328 void setMaxTextureSizeOverride(int maxTextureSizeOverride);
324 329
330 /**
331 * This returns true if the underlying graphics device and system is
332 * capable of drawing paths to compressed textures. This generally provides
333 * a speedup on mobile devices with advanced GPUs, but it only gets turned
334 * on when there is a clear speedup benefit.
335 */
336 bool supportsDrawPathToCompressedTexture() const;
bsalomon 2014/08/11 19:00:47 Does this need to be public? It feels like we're e
krajcevski 2014/08/11 19:09:55 I moved it to the "for internal use only" section.
337
325 /////////////////////////////////////////////////////////////////////////// 338 ///////////////////////////////////////////////////////////////////////////
326 // Render targets 339 // Render targets
327 340
328 /** 341 /**
329 * Sets the render target. 342 * Sets the render target.
330 * @param target the render target to set. 343 * @param target the render target to set.
331 */ 344 */
332 void setRenderTarget(GrRenderTarget* target) { 345 void setRenderTarget(GrRenderTarget* target) {
333 fRenderTarget.reset(SkSafeRef(target)); 346 fRenderTarget.reset(SkSafeRef(target));
334 } 347 }
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 int fUPMToPMConversion; 992 int fUPMToPMConversion;
980 993
981 struct CleanUpData { 994 struct CleanUpData {
982 PFCleanUpFunc fFunc; 995 PFCleanUpFunc fFunc;
983 void* fInfo; 996 void* fInfo;
984 }; 997 };
985 998
986 SkTDArray<CleanUpData> fCleanUpData; 999 SkTDArray<CleanUpData> fCleanUpData;
987 1000
988 int fMaxTextureSizeOverride; 1001 int fMaxTextureSizeOverride;
1002 bool fSupportsDrawPathToCompressed;
989 1003
990 GrContext(); // init must be called after the constructor. 1004 GrContext(); // init must be called after the constructor.
991 bool init(GrBackend, GrBackendContext); 1005 bool init(GrBackend, GrBackendContext, const Options& opts);
992 1006
993 void setupDrawBuffer(); 1007 void setupDrawBuffer();
994 1008
995 class AutoRestoreEffects; 1009 class AutoRestoreEffects;
996 class AutoCheckFlush; 1010 class AutoCheckFlush;
997 /// Sets the paint and returns the target to draw into. The paint can be NUL L in which case the 1011 /// Sets the paint and returns the target to draw into. The paint can be NUL L in which case the
998 /// draw state is left unmodified. 1012 /// draw state is left unmodified.
999 GrDrawTarget* prepareToDraw(const GrPaint*, BufferedDraw, AutoRestoreEffects *, AutoCheckFlush*); 1013 GrDrawTarget* prepareToDraw(const GrPaint*, BufferedDraw, AutoRestoreEffects *, AutoCheckFlush*);
1000 1014
1001 void internalDrawPath(GrDrawTarget* target, bool useAA, const SkPath& path, 1015 void internalDrawPath(GrDrawTarget* target, bool useAA, const SkPath& path,
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1127 } 1141 }
1128 1142
1129 GrTexture* texture() { return fTexture; } 1143 GrTexture* texture() { return fTexture; }
1130 1144
1131 private: 1145 private:
1132 GrContext* fContext; 1146 GrContext* fContext;
1133 GrTexture* fTexture; 1147 GrTexture* fTexture;
1134 }; 1148 };
1135 1149
1136 #endif 1150 #endif
OLDNEW
« no previous file with comments | « gyp/gpu.gyp ('k') | src/gpu/GrContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698