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