OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 GrContext_DEFINED | 8 #ifndef GrContext_DEFINED |
9 #define GrContext_DEFINED | 9 #define GrContext_DEFINED |
10 | 10 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 * rendering quality for the display. Alternatively returns 0 if | 168 * rendering quality for the display. Alternatively returns 0 if |
169 * MSAA is not supported or recommended to be used by default. | 169 * MSAA is not supported or recommended to be used by default. |
170 */ | 170 */ |
171 int getRecommendedSampleCount(GrPixelConfig config, SkScalar dpi) const; | 171 int getRecommendedSampleCount(GrPixelConfig config, SkScalar dpi) const; |
172 | 172 |
173 /** | 173 /** |
174 * Returns a helper object to orchestrate draws. | 174 * Returns a helper object to orchestrate draws. |
175 * Callers should take a ref if they rely on the GrDrawContext sticking arou
nd. | 175 * Callers should take a ref if they rely on the GrDrawContext sticking arou
nd. |
176 * NULL will be returned if the context has been abandoned. | 176 * NULL will be returned if the context has been abandoned. |
177 * | 177 * |
| 178 * @param rt the render target receiving the draws |
178 * @param surfaceProps the surface properties (mainly defines text drawing) | 179 * @param surfaceProps the surface properties (mainly defines text drawing) |
179 * | 180 * |
180 * @return a draw context | 181 * @return a draw context |
181 */ | 182 */ |
182 GrDrawContext* drawContext(const SkSurfaceProps* surfaceProps = NULL) { | 183 GrDrawContext* drawContext(GrRenderTarget* rt, const SkSurfaceProps* surface
Props = NULL) { |
183 return fDrawingMgr.drawContext(surfaceProps); | 184 return fDrawingMgr.drawContext(rt, surfaceProps); |
184 } | 185 } |
185 | 186 |
186 GrTextContext* textContext(const SkSurfaceProps& surfaceProps, GrRenderTarge
t* rt) { | 187 GrTextContext* textContext(const SkSurfaceProps& surfaceProps, GrRenderTarge
t* rt) { |
187 return fDrawingMgr.textContext(surfaceProps, rt); | 188 return fDrawingMgr.textContext(surfaceProps, rt); |
188 } | 189 } |
189 | 190 |
190 /////////////////////////////////////////////////////////////////////////// | 191 /////////////////////////////////////////////////////////////////////////// |
191 // Misc. | 192 // Misc. |
192 | 193 |
193 /** | 194 /** |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 void init(GrContext* context); | 435 void init(GrContext* context); |
435 | 436 |
436 void abandon(); | 437 void abandon(); |
437 bool abandoned() const { return NULL == fDrawTarget; } | 438 bool abandoned() const { return NULL == fDrawTarget; } |
438 | 439 |
439 void reset(); | 440 void reset(); |
440 void flush(); | 441 void flush(); |
441 | 442 |
442 // Callers assume the creation ref of the drawContext! | 443 // Callers assume the creation ref of the drawContext! |
443 // NULL will be returned if the context has been abandoned. | 444 // NULL will be returned if the context has been abandoned. |
444 GrDrawContext* drawContext(const SkSurfaceProps* surfaceProps); | 445 GrDrawContext* drawContext(GrRenderTarget* rt, const SkSurfaceProps* sur
faceProps); |
445 | 446 |
446 GrTextContext* textContext(const SkSurfaceProps& props, GrRenderTarget*
rt); | 447 GrTextContext* textContext(const SkSurfaceProps& props, GrRenderTarget*
rt); |
447 | 448 |
448 private: | 449 private: |
449 void cleanup(); | 450 void cleanup(); |
450 | 451 |
451 friend class GrContext; // for access to fDrawTarget for testing | 452 friend class GrContext; // for access to fDrawTarget for testing |
452 | 453 |
453 static const int kNumPixelGeometries = 5; // The different pixel geometr
ies | 454 static const int kNumPixelGeometries = 5; // The different pixel geometr
ies |
454 static const int kNumDFTOptions = 2; // DFT or no DFT | 455 static const int kNumDFTOptions = 2; // DFT or no DFT |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 /** | 492 /** |
492 * A callback similar to the above for use by the TextBlobCache | 493 * A callback similar to the above for use by the TextBlobCache |
493 * TODO move textblob draw calls below context so we can use the call above. | 494 * TODO move textblob draw calls below context so we can use the call above. |
494 */ | 495 */ |
495 static void TextBlobCacheOverBudgetCB(void* data); | 496 static void TextBlobCacheOverBudgetCB(void* data); |
496 | 497 |
497 typedef SkRefCnt INHERITED; | 498 typedef SkRefCnt INHERITED; |
498 }; | 499 }; |
499 | 500 |
500 #endif | 501 #endif |
OLD | NEW |