OLD | NEW |
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 #ifndef PictureRenderer_DEFINED | 8 #ifndef PictureRenderer_DEFINED |
9 #define PictureRenderer_DEFINED | 9 #define PictureRenderer_DEFINED |
10 | 10 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 156 |
157 /** | 157 /** |
158 * Remove all decoded textures from the CPU caches and all uploaded textures | 158 * Remove all decoded textures from the CPU caches and all uploaded textures |
159 * from the GPU. | 159 * from the GPU. |
160 */ | 160 */ |
161 void purgeTextures(); | 161 void purgeTextures(); |
162 | 162 |
163 /** | 163 /** |
164 * Set the backend type. Returns true on success and false on failure. | 164 * Set the backend type. Returns true on success and false on failure. |
165 */ | 165 */ |
| 166 #if SK_SUPPORT_GPU |
| 167 bool setDeviceType(SkDeviceTypes deviceType, GrGLStandard gpuAPI = kNone_GrG
LStandard) { |
| 168 #else |
166 bool setDeviceType(SkDeviceTypes deviceType) { | 169 bool setDeviceType(SkDeviceTypes deviceType) { |
| 170 #endif |
167 fDeviceType = deviceType; | 171 fDeviceType = deviceType; |
168 #if SK_SUPPORT_GPU | 172 #if SK_SUPPORT_GPU |
169 // In case this function is called more than once | 173 // In case this function is called more than once |
170 SkSafeUnref(fGrContext); | 174 SkSafeUnref(fGrContext); |
171 fGrContext = NULL; | 175 fGrContext = NULL; |
172 // Set to Native so it will have an initial value. | 176 // Set to Native so it will have an initial value. |
173 GrContextFactory::GLContextType glContextType = GrContextFactory::kNativ
e_GLContextType; | 177 GrContextFactory::GLContextType glContextType = GrContextFactory::kNativ
e_GLContextType; |
174 #endif | 178 #endif |
175 switch(deviceType) { | 179 switch(deviceType) { |
176 case kBitmap_DeviceType: | 180 case kBitmap_DeviceType: |
(...skipping 14 matching lines...) Expand all Loading... |
191 case kMesa_DeviceType: | 195 case kMesa_DeviceType: |
192 glContextType = GrContextFactory::kMESA_GLContextType; | 196 glContextType = GrContextFactory::kMESA_GLContextType; |
193 break; | 197 break; |
194 #endif | 198 #endif |
195 #endif | 199 #endif |
196 default: | 200 default: |
197 // Invalid device type. | 201 // Invalid device type. |
198 return false; | 202 return false; |
199 } | 203 } |
200 #if SK_SUPPORT_GPU | 204 #if SK_SUPPORT_GPU |
201 fGrContext = fGrContextFactory.get(glContextType); | 205 fGrContext = fGrContextFactory.get(glContextType, gpuAPI); |
202 if (NULL == fGrContext) { | 206 if (NULL == fGrContext) { |
203 return false; | 207 return false; |
204 } else { | 208 } else { |
205 fGrContext->ref(); | 209 fGrContext->ref(); |
206 return true; | 210 return true; |
207 } | 211 } |
208 #endif | 212 #endif |
209 } | 213 } |
210 | 214 |
211 #if SK_SUPPORT_GPU | 215 #if SK_SUPPORT_GPU |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 virtual SkString getConfigNameInternal() SK_OVERRIDE; | 673 virtual SkString getConfigNameInternal() SK_OVERRIDE; |
670 | 674 |
671 typedef PictureRenderer INHERITED; | 675 typedef PictureRenderer INHERITED; |
672 }; | 676 }; |
673 | 677 |
674 extern PictureRenderer* CreateGatherPixelRefsRenderer(); | 678 extern PictureRenderer* CreateGatherPixelRefsRenderer(); |
675 | 679 |
676 } | 680 } |
677 | 681 |
678 #endif // PictureRenderer_DEFINED | 682 #endif // PictureRenderer_DEFINED |
OLD | NEW |