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

Side by Side Diff: src/gpu/GrProcessor.cpp

Issue 751283002: Add XferProcessor factory in GrPaint and GrDrawState. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix comiple bug Created 6 years 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 | « src/gpu/GrProcOptInfo.h ('k') | src/gpu/SkGr.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 2012 Google Inc. 2 * Copyright 2012 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 #include "GrProcessor.h" 8 #include "GrProcessor.h"
9 #include "GrBackendProcessorFactory.h" 9 #include "GrBackendProcessorFactory.h"
10 #include "GrContext.h" 10 #include "GrContext.h"
(...skipping 10 matching lines...) Expand all
21 * problems on android. 21 * problems on android.
22 */ 22 */
23 template<> 23 template<>
24 SkTArray<GrProcessorTestFactory<GrFragmentProcessor>*, true>* 24 SkTArray<GrProcessorTestFactory<GrFragmentProcessor>*, true>*
25 GrProcessorTestFactory<GrFragmentProcessor>::GetFactories() { 25 GrProcessorTestFactory<GrFragmentProcessor>::GetFactories() {
26 static SkTArray<GrProcessorTestFactory<GrFragmentProcessor>*, true> gFactori es; 26 static SkTArray<GrProcessorTestFactory<GrFragmentProcessor>*, true> gFactori es;
27 return &gFactories; 27 return &gFactories;
28 } 28 }
29 29
30 template<> 30 template<>
31 SkTArray<GrProcessorTestFactory<GrXferProcessor>*, true>*
32 GrProcessorTestFactory<GrXferProcessor>::GetFactories() {
33 static SkTArray<GrProcessorTestFactory<GrXferProcessor>*, true> gFactories;
34 return &gFactories;
35 }
36
37 template<>
31 SkTArray<GrProcessorTestFactory<GrGeometryProcessor>*, true>* 38 SkTArray<GrProcessorTestFactory<GrGeometryProcessor>*, true>*
32 GrProcessorTestFactory<GrGeometryProcessor>::GetFactories() { 39 GrProcessorTestFactory<GrGeometryProcessor>::GetFactories() {
33 static SkTArray<GrProcessorTestFactory<GrGeometryProcessor>*, true> gFactori es; 40 static SkTArray<GrProcessorTestFactory<GrGeometryProcessor>*, true> gFactori es;
34 return &gFactories; 41 return &gFactories;
35 } 42 }
36 43
37 /* 44 /*
38 * To ensure we always have successful static initialization, before creating fr om the factories 45 * To ensure we always have successful static initialization, before creating fr om the factories
39 * we verify the count is as expected. If a new factory is added, then these nu mbers must be 46 * we verify the count is as expected. If a new factory is added, then these nu mbers must be
40 * manually adjusted. 47 * manually adjusted.
41 */ 48 */
42 static const int kFPFactoryCount = 37; 49 static const int kFPFactoryCount = 37;
43 static const int kGPFactoryCount = 14; 50 static const int kGPFactoryCount = 14;
51 static const int kXPFactoryCount = 0;
44 52
45 template<> 53 template<>
46 void GrProcessorTestFactory<GrFragmentProcessor>::VerifyFactoryCount() { 54 void GrProcessorTestFactory<GrFragmentProcessor>::VerifyFactoryCount() {
47 if (kFPFactoryCount != GetFactories()->count()) { 55 if (kFPFactoryCount != GetFactories()->count()) {
48 SkFAIL("Wrong number of fragment processor factories!"); 56 SkFAIL("Wrong number of fragment processor factories!");
49 } 57 }
50 } 58 }
51 59
52 template<> 60 template<>
53 void GrProcessorTestFactory<GrGeometryProcessor>::VerifyFactoryCount() { 61 void GrProcessorTestFactory<GrGeometryProcessor>::VerifyFactoryCount() {
54 if (kGPFactoryCount != GetFactories()->count()) { 62 if (kGPFactoryCount != GetFactories()->count()) {
55 SkFAIL("Wrong number of geometry processor factories!"); 63 SkFAIL("Wrong number of geometry processor factories!");
56 } 64 }
57 } 65 }
58 66
67 template<>
68 void GrProcessorTestFactory<GrXferProcessor>::VerifyFactoryCount() {
69 if (kXPFactoryCount != GetFactories()->count()) {
70 SkFAIL("Wrong number of xfer processor factories!");
71 }
72 }
73
59 #endif 74 #endif
60 75
61 namespace GrProcessorUnitTest { 76 namespace GrProcessorUnitTest {
62 const SkMatrix& TestMatrix(SkRandom* random) { 77 const SkMatrix& TestMatrix(SkRandom* random) {
63 static SkMatrix gMatrices[5]; 78 static SkMatrix gMatrices[5];
64 static bool gOnce; 79 static bool gOnce;
65 if (!gOnce) { 80 if (!gOnce) {
66 gMatrices[0].reset(); 81 gMatrices[0].reset();
67 gMatrices[1].setTranslate(SkIntToScalar(-100), SkIntToScalar(100)); 82 gMatrices[1].setTranslate(SkIntToScalar(-100), SkIntToScalar(100));
68 gMatrices[2].setRotate(SkIntToScalar(17)); 83 gMatrices[2].setRotate(SkIntToScalar(17));
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 * GrGeometryData shares the same pool so it lives in this file too 175 * GrGeometryData shares the same pool so it lives in this file too
161 */ 176 */
162 void* GrGeometryData::operator new(size_t size) { 177 void* GrGeometryData::operator new(size_t size) {
163 return GrProcessor_Globals::GetTLS()->allocate(size); 178 return GrProcessor_Globals::GetTLS()->allocate(size);
164 } 179 }
165 180
166 void GrGeometryData::operator delete(void* target) { 181 void GrGeometryData::operator delete(void* target) {
167 GrProcessor_Globals::GetTLS()->release(target); 182 GrProcessor_Globals::GetTLS()->release(target);
168 } 183 }
169 184
OLDNEW
« no previous file with comments | « src/gpu/GrProcOptInfo.h ('k') | src/gpu/SkGr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698