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 |
(...skipping 25 matching lines...) Expand all Loading... |
36 class GrPipelineBuilder; | 36 class GrPipelineBuilder; |
37 class GrResourceEntry; | 37 class GrResourceEntry; |
38 class GrResourceCache; | 38 class GrResourceCache; |
39 class GrResourceProvider; | 39 class GrResourceProvider; |
40 class GrTestTarget; | 40 class GrTestTarget; |
41 class GrTextBlobCache; | 41 class GrTextBlobCache; |
42 class GrTextContext; | 42 class GrTextContext; |
43 class GrTextureParams; | 43 class GrTextureParams; |
44 class GrVertexBuffer; | 44 class GrVertexBuffer; |
45 class GrStrokeInfo; | 45 class GrStrokeInfo; |
| 46 class GrSwizzle; |
46 class SkTraceMemoryDump; | 47 class SkTraceMemoryDump; |
47 | 48 |
48 class SK_API GrContext : public SkRefCnt { | 49 class SK_API GrContext : public SkRefCnt { |
49 public: | 50 public: |
50 /** | 51 /** |
51 * Creates a GrContext for a backend context. | 52 * Creates a GrContext for a backend context. |
52 */ | 53 */ |
53 static GrContext* Create(GrBackend, GrBackendContext, const GrContextOptions
& options); | 54 static GrContext* Create(GrBackend, GrBackendContext, const GrContextOptions
& options); |
54 static GrContext* Create(GrBackend, GrBackendContext); | 55 static GrContext* Create(GrBackend, GrBackendContext); |
55 | 56 |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 | 423 |
423 GrContext(); // init must be called after the constructor. | 424 GrContext(); // init must be called after the constructor. |
424 bool init(GrBackend, GrBackendContext, const GrContextOptions& options); | 425 bool init(GrBackend, GrBackendContext, const GrContextOptions& options); |
425 | 426 |
426 void initMockContext(); | 427 void initMockContext(); |
427 void initCommon(const GrContextOptions&); | 428 void initCommon(const GrContextOptions&); |
428 | 429 |
429 /** | 430 /** |
430 * These functions create premul <-> unpremul effects if it is possible to g
enerate a pair | 431 * These functions create premul <-> unpremul effects if it is possible to g
enerate a pair |
431 * of effects that make a readToUPM->writeToPM->readToUPM cycle invariant. O
therwise, they | 432 * of effects that make a readToUPM->writeToPM->readToUPM cycle invariant. O
therwise, they |
432 * return NULL. | 433 * return NULL. They also can perform a swizzle as part of the draw. |
433 */ | 434 */ |
434 const GrFragmentProcessor* createPMToUPMEffect(GrTexture*, bool swapRAndB, | 435 const GrFragmentProcessor* createPMToUPMEffect(GrTexture*, const GrSwizzle&, |
435 const SkMatrix&) const; | 436 const SkMatrix&) const; |
436 const GrFragmentProcessor* createUPMToPMEffect(GrTexture*, bool swapRAndB, | 437 const GrFragmentProcessor* createUPMToPMEffect(GrTexture*, const GrSwizzle&, |
437 const SkMatrix&) const; | 438 const SkMatrix&) const; |
438 /** Called before either of the above two functions to determine the appropr
iate fragment | 439 /** Called before either of the above two functions to determine the appropr
iate fragment |
439 processors for conversions. This must be called by readSurfacePixels bef
ore a mutex is | 440 processors for conversions. This must be called by readSurfacePixels bef
ore a mutex is |
440 taken, since testingvPM conversions itself will call readSurfacePixels *
/ | 441 taken, since testingvPM conversions itself will call readSurfacePixels *
/ |
441 void testPMConversionsIfNecessary(uint32_t flags); | 442 void testPMConversionsIfNecessary(uint32_t flags); |
442 /** Returns true if we've already determined that createPMtoUPMEffect and cr
eateUPMToPMEffect | 443 /** Returns true if we've already determined that createPMtoUPMEffect and cr
eateUPMToPMEffect |
443 will fail. In such cases fall back to SW conversion. */ | 444 will fail. In such cases fall back to SW conversion. */ |
444 bool didFailPMUPMConversionTest() const; | 445 bool didFailPMUPMConversionTest() const; |
445 | 446 |
446 /** | 447 /** |
447 * This callback allows the resource cache to callback into the GrContext | 448 * This callback allows the resource cache to callback into the GrContext |
448 * when the cache is still over budget after a purge. | 449 * when the cache is still over budget after a purge. |
449 */ | 450 */ |
450 static void OverBudgetCB(void* data); | 451 static void OverBudgetCB(void* data); |
451 | 452 |
452 /** | 453 /** |
453 * A callback similar to the above for use by the TextBlobCache | 454 * A callback similar to the above for use by the TextBlobCache |
454 * TODO move textblob draw calls below context so we can use the call above. | 455 * TODO move textblob draw calls below context so we can use the call above. |
455 */ | 456 */ |
456 static void TextBlobCacheOverBudgetCB(void* data); | 457 static void TextBlobCacheOverBudgetCB(void* data); |
457 | 458 |
458 typedef SkRefCnt INHERITED; | 459 typedef SkRefCnt INHERITED; |
459 }; | 460 }; |
460 | 461 |
461 #endif | 462 #endif |
OLD | NEW |