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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 158 |
159 /** | 159 /** |
160 * Remove all decoded textures from the CPU caches and all uploaded textures | 160 * Remove all decoded textures from the CPU caches and all uploaded textures |
161 * from the GPU. | 161 * from the GPU. |
162 */ | 162 */ |
163 void purgeTextures(); | 163 void purgeTextures(); |
164 | 164 |
165 /** | 165 /** |
166 * Set the backend type. Returns true on success and false on failure. | 166 * Set the backend type. Returns true on success and false on failure. |
167 */ | 167 */ |
| 168 #if SK_SUPPORT_GPU |
| 169 bool setDeviceType(SkDeviceTypes deviceType, GrGLStandard gpuAPI = kNone_GrG
LStandard) { |
| 170 #else |
168 bool setDeviceType(SkDeviceTypes deviceType) { | 171 bool setDeviceType(SkDeviceTypes deviceType) { |
| 172 #endif |
169 fDeviceType = deviceType; | 173 fDeviceType = deviceType; |
170 #if SK_SUPPORT_GPU | 174 #if SK_SUPPORT_GPU |
171 // In case this function is called more than once | 175 // In case this function is called more than once |
172 SkSafeUnref(fGrContext); | 176 SkSafeUnref(fGrContext); |
173 fGrContext = NULL; | 177 fGrContext = NULL; |
174 // Set to Native so it will have an initial value. | 178 // Set to Native so it will have an initial value. |
175 GrContextFactory::GLContextType glContextType = GrContextFactory::kNativ
e_GLContextType; | 179 GrContextFactory::GLContextType glContextType = GrContextFactory::kNativ
e_GLContextType; |
176 #endif | 180 #endif |
177 switch(deviceType) { | 181 switch(deviceType) { |
178 case kBitmap_DeviceType: | 182 case kBitmap_DeviceType: |
(...skipping 14 matching lines...) Expand all Loading... |
193 case kMesa_DeviceType: | 197 case kMesa_DeviceType: |
194 glContextType = GrContextFactory::kMESA_GLContextType; | 198 glContextType = GrContextFactory::kMESA_GLContextType; |
195 break; | 199 break; |
196 #endif | 200 #endif |
197 #endif | 201 #endif |
198 default: | 202 default: |
199 // Invalid device type. | 203 // Invalid device type. |
200 return false; | 204 return false; |
201 } | 205 } |
202 #if SK_SUPPORT_GPU | 206 #if SK_SUPPORT_GPU |
203 fGrContext = fGrContextFactory.get(glContextType); | 207 fGrContext = fGrContextFactory.get(glContextType, gpuAPI); |
204 if (NULL == fGrContext) { | 208 if (NULL == fGrContext) { |
205 return false; | 209 return false; |
206 } else { | 210 } else { |
207 fGrContext->ref(); | 211 fGrContext->ref(); |
208 return true; | 212 return true; |
209 } | 213 } |
210 #endif | 214 #endif |
211 } | 215 } |
212 | 216 |
213 #if SK_SUPPORT_GPU | 217 #if SK_SUPPORT_GPU |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 | 656 |
653 typedef PictureRenderer INHERITED; | 657 typedef PictureRenderer INHERITED; |
654 }; | 658 }; |
655 | 659 |
656 extern PictureRenderer* CreateGatherPixelRefsRenderer(); | 660 extern PictureRenderer* CreateGatherPixelRefsRenderer(); |
657 extern PictureRenderer* CreatePictureCloneRenderer(); | 661 extern PictureRenderer* CreatePictureCloneRenderer(); |
658 | 662 |
659 } | 663 } |
660 | 664 |
661 #endif // PictureRenderer_DEFINED | 665 #endif // PictureRenderer_DEFINED |
OLD | NEW |