| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #include "GrContext.h" | 10 #include "GrContext.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 ~AutoCheckFlush() { | 77 ~AutoCheckFlush() { |
| 78 if (fContext->fFlushToReduceCacheSize) { | 78 if (fContext->fFlushToReduceCacheSize) { |
| 79 fContext->flush(); | 79 fContext->flush(); |
| 80 } | 80 } |
| 81 } | 81 } |
| 82 | 82 |
| 83 private: | 83 private: |
| 84 GrContext* fContext; | 84 GrContext* fContext; |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 GrContext* GrContext::Create(GrBackend backend, GrBackendContext backendContext)
{ | 87 GrContext* GrContext::Create(GrBackend backend, GrBackendContext backendContext, |
| 88 GrContext* context = SkNEW(GrContext); | 88 const Options* opts) { |
| 89 GrContext* context; |
| 90 if (NULL == opts) { |
| 91 context = SkNEW_ARGS(GrContext, (Options())); |
| 92 } else { |
| 93 context = SkNEW_ARGS(GrContext, (*opts)); |
| 94 } |
| 95 |
| 89 if (context->init(backend, backendContext)) { | 96 if (context->init(backend, backendContext)) { |
| 90 return context; | 97 return context; |
| 91 } else { | 98 } else { |
| 92 context->unref(); | 99 context->unref(); |
| 93 return NULL; | 100 return NULL; |
| 94 } | 101 } |
| 95 } | 102 } |
| 96 | 103 |
| 97 GrContext::GrContext() { | 104 GrContext::GrContext(const Options& opts) : fOptions(opts) { |
| 98 fDrawState = NULL; | 105 fDrawState = NULL; |
| 99 fGpu = NULL; | 106 fGpu = NULL; |
| 100 fClip = NULL; | 107 fClip = NULL; |
| 101 fPathRendererChain = NULL; | 108 fPathRendererChain = NULL; |
| 102 fSoftwarePathRenderer = NULL; | 109 fSoftwarePathRenderer = NULL; |
| 103 fResourceCache = NULL; | 110 fResourceCache = NULL; |
| 104 fFontCache = NULL; | 111 fFontCache = NULL; |
| 105 fDrawBuffer = NULL; | 112 fDrawBuffer = NULL; |
| 106 fDrawBufferVBAllocPool = NULL; | 113 fDrawBufferVBAllocPool = NULL; |
| 107 fDrawBufferIBAllocPool = NULL; | 114 fDrawBufferIBAllocPool = NULL; |
| (...skipping 1839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1947 fDrawBuffer->removeGpuTraceMarker(marker); | 1954 fDrawBuffer->removeGpuTraceMarker(marker); |
| 1948 } | 1955 } |
| 1949 } | 1956 } |
| 1950 | 1957 |
| 1951 /////////////////////////////////////////////////////////////////////////////// | 1958 /////////////////////////////////////////////////////////////////////////////// |
| 1952 #if GR_CACHE_STATS | 1959 #if GR_CACHE_STATS |
| 1953 void GrContext::printCacheStats() const { | 1960 void GrContext::printCacheStats() const { |
| 1954 fResourceCache->printStats(); | 1961 fResourceCache->printStats(); |
| 1955 } | 1962 } |
| 1956 #endif | 1963 #endif |
| OLD | NEW |