Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright 2015 Google Inc. | |
| 3 * | |
| 4 * Use of this source code is governed by a BSD-style license that can be | |
| 5 * found in the LICENSE file. | |
| 6 */ | |
| 7 | |
| 8 #ifndef GrDrawingManager_DEFINED | |
| 9 #define GrDrawingManager_DEFINED | |
| 10 | |
| 11 #include "SkTDArray.h" | |
| 12 | |
| 13 class GrContext; | |
| 14 class GrDrawContext; | |
| 15 class GrTextContext; | |
| 16 | |
| 17 // Currently the DrawingMgr creates a separate GrTextContext for each | |
|
bsalomon
2015/10/16 20:09:06
Might want to change Mgr here.
robertphillips
2015/10/17 14:42:24
Done.
| |
| 18 // combination of text drawing options (pixel geometry x DFT use) | |
| 19 // and hands the appropriate one back given the DrawContext's request. | |
| 20 // | |
| 21 // It allocates a new GrDrawContext for each GrRenderTarget | |
| 22 // but all of them still land in the same GrDrawTarget! | |
| 23 // | |
| 24 // In the future this class will allocate a new GrDrawContext for | |
| 25 // each GrRenderTarget/GrDrawTarget and manage the DAG. | |
| 26 class GrDrawingManager { | |
| 27 public: | |
| 28 ~GrDrawingManager(); | |
| 29 | |
| 30 bool abandoned() const { return fAbandoned; } | |
| 31 | |
| 32 GrDrawContext* drawContext(GrRenderTarget* rt, const SkSurfaceProps* surface Props); | |
| 33 | |
| 34 GrTextContext* textContext(const SkSurfaceProps& props, GrRenderTarget* rt); | |
| 35 | |
| 36 // The caller automatically gets a ref on the returned drawTarget. It must | |
| 37 // be balanced by an unref call. | |
| 38 GrDrawTarget* newDrawTarget(GrRenderTarget* rt); | |
| 39 | |
| 40 GrContext* getContext() { return fContext; } | |
| 41 | |
| 42 private: | |
| 43 GrDrawingManager(GrContext* context) | |
| 44 : fContext(context) | |
| 45 , fAbandoned(false) | |
| 46 , fNVPRTextContext(nullptr) { | |
| 47 sk_bzero(fTextContexts, sizeof(fTextContexts)); | |
| 48 } | |
| 49 | |
| 50 void abandon(); | |
| 51 void cleanup(); | |
| 52 void reset(); | |
| 53 void flush(); | |
| 54 | |
| 55 friend class GrContext; // for access to: ctor, abandon, reset & flush | |
| 56 | |
| 57 static const int kNumPixelGeometries = 5; // The different pixel geometries | |
| 58 static const int kNumDFTOptions = 2; // DFT or no DFT | |
| 59 | |
| 60 GrContext* fContext; | |
| 61 | |
| 62 bool fAbandoned; | |
| 63 SkTDArray<GrDrawTarget*> fDrawTargets; | |
| 64 | |
| 65 GrTextContext* fNVPRTextContext; | |
| 66 GrTextContext* fTextContexts[kNumPixelGeometries][kNumDFTOptions]; | |
| 67 }; | |
| 68 | |
| 69 #endif | |
| OLD | NEW |