| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 GrDrawingManager_DEFINED | 8 #ifndef GrDrawingManager_DEFINED |
| 9 #define GrDrawingManager_DEFINED | 9 #define GrDrawingManager_DEFINED |
| 10 | 10 |
| 11 #include "GrDrawTarget.h" |
| 11 #include "SkTDArray.h" | 12 #include "SkTDArray.h" |
| 12 | 13 |
| 13 class GrContext; | 14 class GrContext; |
| 14 class GrDrawContext; | 15 class GrDrawContext; |
| 15 class GrTextContext; | 16 class GrTextContext; |
| 16 | 17 |
| 17 // Currently the DrawingManager creates a separate GrTextContext for each | 18 // Currently the DrawingManager creates a separate GrTextContext for each |
| 18 // combination of text drawing options (pixel geometry x DFT use) | 19 // combination of text drawing options (pixel geometry x DFT use) |
| 19 // and hands the appropriate one back given the DrawContext's request. | 20 // and hands the appropriate one back given the DrawContext's request. |
| 20 // | 21 // |
| (...skipping 12 matching lines...) Expand all Loading... |
| 33 | 34 |
| 34 GrTextContext* textContext(const SkSurfaceProps& props, GrRenderTarget* rt); | 35 GrTextContext* textContext(const SkSurfaceProps& props, GrRenderTarget* rt); |
| 35 | 36 |
| 36 // The caller automatically gets a ref on the returned drawTarget. It must | 37 // The caller automatically gets a ref on the returned drawTarget. It must |
| 37 // be balanced by an unref call. | 38 // be balanced by an unref call. |
| 38 GrDrawTarget* newDrawTarget(GrRenderTarget* rt); | 39 GrDrawTarget* newDrawTarget(GrRenderTarget* rt); |
| 39 | 40 |
| 40 GrContext* getContext() { return fContext; } | 41 GrContext* getContext() { return fContext; } |
| 41 | 42 |
| 42 private: | 43 private: |
| 43 GrDrawingManager(GrContext* context) | 44 GrDrawingManager(GrContext* context, GrDrawTarget::Options options) |
| 44 : fContext(context) | 45 : fContext(context) |
| 45 , fAbandoned(false) | 46 , fAbandoned(false) |
| 47 , fOptions(options) |
| 46 , fNVPRTextContext(nullptr) { | 48 , fNVPRTextContext(nullptr) { |
| 47 sk_bzero(fTextContexts, sizeof(fTextContexts)); | 49 sk_bzero(fTextContexts, sizeof(fTextContexts)); |
| 48 } | 50 } |
| 49 | 51 |
| 50 void abandon(); | 52 void abandon(); |
| 51 void cleanup(); | 53 void cleanup(); |
| 52 void reset(); | 54 void reset(); |
| 53 void flush(); | 55 void flush(); |
| 54 | 56 |
| 55 friend class GrContext; // for access to: ctor, abandon, reset & flush | 57 friend class GrContext; // for access to: ctor, abandon, reset & flush |
| 56 | 58 |
| 57 static const int kNumPixelGeometries = 5; // The different pixel geometries | 59 static const int kNumPixelGeometries = 5; // The different pixel geometries |
| 58 static const int kNumDFTOptions = 2; // DFT or no DFT | 60 static const int kNumDFTOptions = 2; // DFT or no DFT |
| 59 | 61 |
| 60 GrContext* fContext; | 62 GrContext* fContext; |
| 61 | 63 |
| 62 bool fAbandoned; | 64 bool fAbandoned; |
| 63 SkTDArray<GrDrawTarget*> fDrawTargets; | 65 SkTDArray<GrDrawTarget*> fDrawTargets; |
| 66 GrDrawTarget::Options fOptions; |
| 64 | 67 |
| 65 GrTextContext* fNVPRTextContext; | 68 GrTextContext* fNVPRTextContext; |
| 66 GrTextContext* fTextContexts[kNumPixelGeometries][kNumDFTOptions]; | 69 GrTextContext* fTextContexts[kNumPixelGeometries][kNumDFTOption
s]; |
| 67 }; | 70 }; |
| 68 | 71 |
| 69 #endif | 72 #endif |
| OLD | NEW |