| 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 #include "PictureRenderer.h" | 8 #include "PictureRenderer.h" |
| 9 #include "picture_utils.h" | 9 #include "picture_utils.h" |
| 10 #include "SamplePipeControllers.h" | 10 #include "SamplePipeControllers.h" |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 fPicture->cullRect().height()
, | 221 fPicture->cullRect().height()
, |
| 222 factory.get(), | 222 factory.get(), |
| 223 this->recordFlags()); | 223 this->recordFlags()); |
| 224 fPicture->playback(canvas); | 224 fPicture->playback(canvas); |
| 225 fPicture.reset(recorder.endRecording()); | 225 fPicture.reset(recorder.endRecording()); |
| 226 } | 226 } |
| 227 } | 227 } |
| 228 | 228 |
| 229 void PictureRenderer::resetState(bool callFinish) { | 229 void PictureRenderer::resetState(bool callFinish) { |
| 230 #if SK_SUPPORT_GPU | 230 #if SK_SUPPORT_GPU |
| 231 SkGLContext* glContext = this->getGLContext(); | 231 SkGLContextHelper* glContext = this->getGLContext(); |
| 232 if (NULL == glContext) { | 232 if (NULL == glContext) { |
| 233 SkASSERT(kBitmap_DeviceType == fDeviceType); | 233 SkASSERT(kBitmap_DeviceType == fDeviceType); |
| 234 return; | 234 return; |
| 235 } | 235 } |
| 236 | 236 |
| 237 fGrContext->flush(); | 237 fGrContext->flush(); |
| 238 glContext->swapBuffers(); | 238 glContext->swapBuffers(); |
| 239 if (callFinish) { | 239 if (callFinish) { |
| 240 SK_GL(*glContext, Finish()); | 240 SK_GL(*glContext, Finish()); |
| 241 } | 241 } |
| 242 #endif | 242 #endif |
| 243 } | 243 } |
| 244 | 244 |
| 245 void PictureRenderer::purgeTextures() { | 245 void PictureRenderer::purgeTextures() { |
| 246 SkDiscardableMemoryPool* pool = SkGetGlobalDiscardableMemoryPool(); | 246 SkDiscardableMemoryPool* pool = SkGetGlobalDiscardableMemoryPool(); |
| 247 | 247 |
| 248 pool->dumpPool(); | 248 pool->dumpPool(); |
| 249 | 249 |
| 250 #if SK_SUPPORT_GPU | 250 #if SK_SUPPORT_GPU |
| 251 SkGLContext* glContext = this->getGLContext(); | 251 SkGLContextHelper* glContext = this->getGLContext(); |
| 252 if (NULL == glContext) { | 252 if (NULL == glContext) { |
| 253 SkASSERT(kBitmap_DeviceType == fDeviceType); | 253 SkASSERT(kBitmap_DeviceType == fDeviceType); |
| 254 return; | 254 return; |
| 255 } | 255 } |
| 256 | 256 |
| 257 // resetState should've already done this | 257 // resetState should've already done this |
| 258 fGrContext->flush(); | 258 fGrContext->flush(); |
| 259 | 259 |
| 260 fGrContext->purgeAllUnlockedResources(); | 260 fGrContext->purgeAllUnlockedResources(); |
| 261 #endif | 261 #endif |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 PictureRenderer* CreateGatherPixelRefsRenderer(const GrContext::Options& opts) { | 781 PictureRenderer* CreateGatherPixelRefsRenderer(const GrContext::Options& opts) { |
| 782 return SkNEW_ARGS(GatherRenderer, (opts)); | 782 return SkNEW_ARGS(GatherRenderer, (opts)); |
| 783 } | 783 } |
| 784 #else | 784 #else |
| 785 PictureRenderer* CreateGatherPixelRefsRenderer() { | 785 PictureRenderer* CreateGatherPixelRefsRenderer() { |
| 786 return SkNEW(GatherRenderer); | 786 return SkNEW(GatherRenderer); |
| 787 } | 787 } |
| 788 #endif | 788 #endif |
| 789 | 789 |
| 790 } // namespace sk_tools | 790 } // namespace sk_tools |
| OLD | NEW |