| OLD | NEW |
| 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 |
| 11 #include "GrCaps.h" |
| 11 #include "GrClip.h" | 12 #include "GrClip.h" |
| 12 #include "GrColor.h" | 13 #include "GrColor.h" |
| 13 #include "GrPaint.h" | 14 #include "GrPaint.h" |
| 14 #include "GrRenderTarget.h" | 15 #include "GrRenderTarget.h" |
| 15 #include "GrTextureProvider.h" | 16 #include "GrTextureProvider.h" |
| 16 #include "SkMatrix.h" | 17 #include "SkMatrix.h" |
| 17 #include "../private/SkMutex.h" | 18 #include "../private/SkMutex.h" |
| 18 #include "SkPathEffect.h" | 19 #include "SkPathEffect.h" |
| 19 #include "SkTypes.h" | 20 #include "SkTypes.h" |
| 20 | 21 |
| 21 struct GrBatchAtlasConfig; | 22 struct GrBatchAtlasConfig; |
| 22 class GrBatchFontCache; | 23 class GrBatchFontCache; |
| 23 class GrCaps; | |
| 24 struct GrContextOptions; | 24 struct GrContextOptions; |
| 25 class GrDrawingManager; | 25 class GrDrawingManager; |
| 26 class GrDrawContext; | 26 class GrDrawContext; |
| 27 class GrDrawTarget; | 27 class GrDrawTarget; |
| 28 class GrFragmentProcessor; | 28 class GrFragmentProcessor; |
| 29 class GrGpu; | 29 class GrGpu; |
| 30 class GrIndexBuffer; | 30 class GrIndexBuffer; |
| 31 class GrLayerCache; | 31 class GrLayerCache; |
| 32 class GrOvalRenderer; | 32 class GrOvalRenderer; |
| 33 class GrPath; | 33 class GrPath; |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 | 198 |
| 199 /** | 199 /** |
| 200 * Call to ensure all drawing to the context has been issued to the | 200 * Call to ensure all drawing to the context has been issued to the |
| 201 * underlying 3D API. | 201 * underlying 3D API. |
| 202 * @param flagsBitfield flags that control the flushing behavior. See | 202 * @param flagsBitfield flags that control the flushing behavior. See |
| 203 * FlushBits. | 203 * FlushBits. |
| 204 */ | 204 */ |
| 205 void flush(int flagsBitfield = 0); | 205 void flush(int flagsBitfield = 0); |
| 206 | 206 |
| 207 void flushIfNecessary() { | 207 void flushIfNecessary() { |
| 208 if (fFlushToReduceCacheSize) { | 208 if (fFlushToReduceCacheSize || this->caps()->immediateFlush()) { |
| 209 this->flush(); | 209 this->flush(); |
| 210 } | 210 } |
| 211 } | 211 } |
| 212 | 212 |
| 213 /** | 213 /** |
| 214 * These flags can be used with the read/write pixels functions below. | 214 * These flags can be used with the read/write pixels functions below. |
| 215 */ | 215 */ |
| 216 enum PixelOpsFlags { | 216 enum PixelOpsFlags { |
| 217 /** The GrContext will not be flushed before the surface read or write.
This means that | 217 /** The GrContext will not be flushed before the surface read or write.
This means that |
| 218 the read or write may occur before previous draws have executed. */ | 218 the read or write may occur before previous draws have executed. */ |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 | 399 |
| 400 // TODO: have the CMM use drawContexts and rm this friending | 400 // TODO: have the CMM use drawContexts and rm this friending |
| 401 friend class GrClipMaskManager; // the CMM is friended just so it can call '
drawingManager' | 401 friend class GrClipMaskManager; // the CMM is friended just so it can call '
drawingManager' |
| 402 friend class GrDrawingManager; // for access to drawingManager for ProgramU
nitTest | 402 friend class GrDrawingManager; // for access to drawingManager for ProgramU
nitTest |
| 403 GrDrawingManager* drawingManager() { return fDrawingManager; } | 403 GrDrawingManager* drawingManager() { return fDrawingManager; } |
| 404 | 404 |
| 405 GrContext(); // init must be called after the constructor. | 405 GrContext(); // init must be called after the constructor. |
| 406 bool init(GrBackend, GrBackendContext, const GrContextOptions& options); | 406 bool init(GrBackend, GrBackendContext, const GrContextOptions& options); |
| 407 | 407 |
| 408 void initMockContext(); | 408 void initMockContext(); |
| 409 void initCommon(const GrContextOptions& options); | 409 void initCommon(); |
| 410 | 410 |
| 411 /** | 411 /** |
| 412 * These functions create premul <-> unpremul effects if it is possible to g
enerate a pair | 412 * These functions create premul <-> unpremul effects if it is possible to g
enerate a pair |
| 413 * of effects that make a readToUPM->writeToPM->readToUPM cycle invariant. O
therwise, they | 413 * of effects that make a readToUPM->writeToPM->readToUPM cycle invariant. O
therwise, they |
| 414 * return NULL. | 414 * return NULL. |
| 415 */ | 415 */ |
| 416 const GrFragmentProcessor* createPMToUPMEffect(GrTexture*, bool swapRAndB, | 416 const GrFragmentProcessor* createPMToUPMEffect(GrTexture*, bool swapRAndB, |
| 417 const SkMatrix&) const; | 417 const SkMatrix&) const; |
| 418 const GrFragmentProcessor* createUPMToPMEffect(GrTexture*, bool swapRAndB, | 418 const GrFragmentProcessor* createUPMToPMEffect(GrTexture*, bool swapRAndB, |
| 419 const SkMatrix&) const; | 419 const SkMatrix&) const; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 434 /** | 434 /** |
| 435 * A callback similar to the above for use by the TextBlobCache | 435 * A callback similar to the above for use by the TextBlobCache |
| 436 * TODO move textblob draw calls below context so we can use the call above. | 436 * TODO move textblob draw calls below context so we can use the call above. |
| 437 */ | 437 */ |
| 438 static void TextBlobCacheOverBudgetCB(void* data); | 438 static void TextBlobCacheOverBudgetCB(void* data); |
| 439 | 439 |
| 440 typedef SkRefCnt INHERITED; | 440 typedef SkRefCnt INHERITED; |
| 441 }; | 441 }; |
| 442 | 442 |
| 443 #endif | 443 #endif |
| OLD | NEW |