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