| 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 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 #include "GrTextBlobCache.h" | 36 #include "GrTextBlobCache.h" |
| 37 #include "GrTexturePriv.h" | 37 #include "GrTexturePriv.h" |
| 38 #include "GrTraceMarker.h" | 38 #include "GrTraceMarker.h" |
| 39 #include "GrTracing.h" | 39 #include "GrTracing.h" |
| 40 #include "GrVertices.h" | 40 #include "GrVertices.h" |
| 41 #include "SkDashPathPriv.h" | 41 #include "SkDashPathPriv.h" |
| 42 #include "SkConfig8888.h" | 42 #include "SkConfig8888.h" |
| 43 #include "SkGr.h" | 43 #include "SkGr.h" |
| 44 #include "SkRRect.h" | 44 #include "SkRRect.h" |
| 45 #include "SkStrokeRec.h" | 45 #include "SkStrokeRec.h" |
| 46 #include "SkSurfacePriv.h" |
| 46 #include "SkTLazy.h" | 47 #include "SkTLazy.h" |
| 47 #include "SkTLS.h" | 48 #include "SkTLS.h" |
| 48 #include "SkTraceEvent.h" | 49 #include "SkTraceEvent.h" |
| 49 | 50 |
| 50 #include "effects/GrConfigConversionEffect.h" | 51 #include "effects/GrConfigConversionEffect.h" |
| 51 #include "effects/GrDashingEffect.h" | 52 #include "effects/GrDashingEffect.h" |
| 52 #include "effects/GrSingleTextureEffect.h" | 53 #include "effects/GrSingleTextureEffect.h" |
| 53 | 54 |
| 54 #define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == this) | 55 #define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == this) |
| 55 #define RETURN_IF_ABANDONED if (fDrawingMgr.abandoned()) { return; } | 56 #define RETURN_IF_ABANDONED if (fDrawingMgr.abandoned()) { return; } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 fDrawTarget->reset(); | 105 fDrawTarget->reset(); |
| 105 } | 106 } |
| 106 } | 107 } |
| 107 | 108 |
| 108 void GrContext::DrawingMgr::flush() { | 109 void GrContext::DrawingMgr::flush() { |
| 109 if (fDrawTarget) { | 110 if (fDrawTarget) { |
| 110 fDrawTarget->flush(); | 111 fDrawTarget->flush(); |
| 111 } | 112 } |
| 112 } | 113 } |
| 113 | 114 |
| 114 GrDrawContext* GrContext::DrawingMgr::drawContext(const SkDeviceProperties* devP
rops) { | 115 GrDrawContext* GrContext::DrawingMgr::drawContext(const SkSurfaceProps* surfaceP
rops) { |
| 115 if (this->abandoned()) { | 116 if (this->abandoned()) { |
| 116 return NULL; | 117 return NULL; |
| 117 } | 118 } |
| 118 | 119 |
| 119 const SkDeviceProperties defProps; | 120 const SkSurfaceProps props(SkSurfacePropsCopyOrDefault(surfaceProps)); |
| 120 if (!devProps) { | 121 |
| 121 devProps = &defProps; | 122 SkASSERT(props.pixelGeometry() < kNumPixelGeometries); |
| 123 if (!fDrawContext[props.pixelGeometry()][props.isUseDistanceFieldFonts()]) { |
| 124 fDrawContext[props.pixelGeometry()][props.isUseDistanceFieldFonts()] = |
| 125 SkNEW_ARGS(GrDrawContext, (fContext, fDrawTarget, props)); |
| 122 } | 126 } |
| 123 | 127 |
| 124 SkASSERT(devProps->pixelGeometry() < kNumPixelGeometries); | 128 return fDrawContext[props.pixelGeometry()][props.isUseDistanceFieldFonts()];
|
| 125 if (!fDrawContext[devProps->pixelGeometry()][devProps->useDFT()]) { | |
| 126 fDrawContext[devProps->pixelGeometry()][devProps->useDFT()] = | |
| 127 SkNEW_ARGS(GrDrawContext, (fContext, fDrawTarget, *devProps)); | |
| 128 } | |
| 129 | |
| 130 return fDrawContext[devProps->pixelGeometry()][devProps->useDFT()]; | |
| 131 } | 129 } |
| 132 | 130 |
| 133 //////////////////////////////////////////////////////////////////////////////// | 131 //////////////////////////////////////////////////////////////////////////////// |
| 134 | 132 |
| 135 | 133 |
| 136 GrContext* GrContext::Create(GrBackend backend, GrBackendContext backendContext)
{ | 134 GrContext* GrContext::Create(GrBackend backend, GrBackendContext backendContext)
{ |
| 137 GrContextOptions defaultOptions; | 135 GrContextOptions defaultOptions; |
| 138 return Create(backend, backendContext, defaultOptions); | 136 return Create(backend, backendContext, defaultOptions); |
| 139 } | 137 } |
| 140 | 138 |
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 ////////////////////////////////////////////////////////////////////////////// | 755 ////////////////////////////////////////////////////////////////////////////// |
| 758 | 756 |
| 759 void GrContext::addGpuTraceMarker(const GrGpuTraceMarker* marker) { | 757 void GrContext::addGpuTraceMarker(const GrGpuTraceMarker* marker) { |
| 760 fGpu->addGpuTraceMarker(marker); | 758 fGpu->addGpuTraceMarker(marker); |
| 761 } | 759 } |
| 762 | 760 |
| 763 void GrContext::removeGpuTraceMarker(const GrGpuTraceMarker* marker) { | 761 void GrContext::removeGpuTraceMarker(const GrGpuTraceMarker* marker) { |
| 764 fGpu->removeGpuTraceMarker(marker); | 762 fGpu->removeGpuTraceMarker(marker); |
| 765 } | 763 } |
| 766 | 764 |
| OLD | NEW |