| 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 #include "GrContext.h" | 9 #include "GrContext.h" |
| 10 | 10 |
| 11 #include "GrBatchFontCache.h" | 11 #include "GrBatchFontCache.h" |
| 12 #include "GrBatchFlushState.h" | 12 #include "GrBatchFlushState.h" |
| 13 #include "GrBatchTest.h" | 13 #include "GrBatchTest.h" |
| 14 #include "GrBufferedDrawTarget.h" | |
| 15 #include "GrCaps.h" | 14 #include "GrCaps.h" |
| 16 #include "GrContextOptions.h" | 15 #include "GrContextOptions.h" |
| 17 #include "GrDefaultGeoProcFactory.h" | 16 #include "GrDefaultGeoProcFactory.h" |
| 18 #include "GrDrawContext.h" | 17 #include "GrDrawContext.h" |
| 18 #include "GrDrawTarget.h" |
| 19 #include "GrGpuResource.h" | 19 #include "GrGpuResource.h" |
| 20 #include "GrGpuResourcePriv.h" | 20 #include "GrGpuResourcePriv.h" |
| 21 #include "GrGpu.h" | 21 #include "GrGpu.h" |
| 22 #include "GrImmediateDrawTarget.h" | |
| 23 #include "GrIndexBuffer.h" | 22 #include "GrIndexBuffer.h" |
| 24 #include "GrLayerCache.h" | 23 #include "GrLayerCache.h" |
| 25 #include "GrOvalRenderer.h" | 24 #include "GrOvalRenderer.h" |
| 26 #include "GrPathRenderer.h" | 25 #include "GrPathRenderer.h" |
| 27 #include "GrPathUtils.h" | 26 #include "GrPathUtils.h" |
| 28 #include "GrRenderTargetPriv.h" | 27 #include "GrRenderTargetPriv.h" |
| 29 #include "GrResourceCache.h" | 28 #include "GrResourceCache.h" |
| 30 #include "GrResourceProvider.h" | 29 #include "GrResourceProvider.h" |
| 31 #include "GrSoftwarePathRenderer.h" | 30 #include "GrSoftwarePathRenderer.h" |
| 32 #include "GrStrokeInfo.h" | 31 #include "GrStrokeInfo.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 54 #define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == this) | 53 #define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == this) |
| 55 #define RETURN_IF_ABANDONED if (fDrawingMgr.abandoned()) { return; } | 54 #define RETURN_IF_ABANDONED if (fDrawingMgr.abandoned()) { return; } |
| 56 #define RETURN_FALSE_IF_ABANDONED if (fDrawingMgr.abandoned()) { return false; } | 55 #define RETURN_FALSE_IF_ABANDONED if (fDrawingMgr.abandoned()) { return false; } |
| 57 #define RETURN_NULL_IF_ABANDONED if (fDrawingMgr.abandoned()) { return nullptr;
} | 56 #define RETURN_NULL_IF_ABANDONED if (fDrawingMgr.abandoned()) { return nullptr;
} |
| 58 | 57 |
| 59 | 58 |
| 60 //////////////////////////////////////////////////////////////////////////////// | 59 //////////////////////////////////////////////////////////////////////////////// |
| 61 | 60 |
| 62 void GrContext::DrawingMgr::init(GrContext* context) { | 61 void GrContext::DrawingMgr::init(GrContext* context) { |
| 63 fContext = context; | 62 fContext = context; |
| 64 | 63 fDrawTarget = new GrClipTarget(context); |
| 65 #ifdef IMMEDIATE_MODE | |
| 66 fDrawTarget = new GrImmediateDrawTarget(context); | |
| 67 #else | |
| 68 fDrawTarget = new GrBufferedDrawTarget(context); | |
| 69 #endif | |
| 70 } | 64 } |
| 71 | 65 |
| 72 void GrContext::DrawingMgr::cleanup() { | 66 void GrContext::DrawingMgr::cleanup() { |
| 73 SkSafeSetNull(fDrawTarget); | 67 SkSafeSetNull(fDrawTarget); |
| 74 for (int i = 0; i < kNumPixelGeometries; ++i) { | 68 for (int i = 0; i < kNumPixelGeometries; ++i) { |
| 75 SkSafeSetNull(fDrawContext[i][0]); | 69 SkSafeSetNull(fDrawContext[i][0]); |
| 76 SkSafeSetNull(fDrawContext[i][1]); | 70 SkSafeSetNull(fDrawContext[i][1]); |
| 77 } | 71 } |
| 78 } | 72 } |
| 79 | 73 |
| (...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 744 } | 738 } |
| 745 if (maxTextureBytes) { | 739 if (maxTextureBytes) { |
| 746 *maxTextureBytes = fResourceCache->getMaxResourceBytes(); | 740 *maxTextureBytes = fResourceCache->getMaxResourceBytes(); |
| 747 } | 741 } |
| 748 } | 742 } |
| 749 | 743 |
| 750 void GrContext::setResourceCacheLimits(int maxTextures, size_t maxTextureBytes)
{ | 744 void GrContext::setResourceCacheLimits(int maxTextures, size_t maxTextureBytes)
{ |
| 751 fResourceCache->setLimits(maxTextures, maxTextureBytes); | 745 fResourceCache->setLimits(maxTextures, maxTextureBytes); |
| 752 } | 746 } |
| 753 | 747 |
| OLD | NEW |