| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 | 171 |
| 172 /** | 172 /** |
| 173 * Returns a helper object to orchestrate draws. | 173 * Returns a helper object to orchestrate draws. |
| 174 * Callers should take a ref if they rely on the GrDrawContext sticking arou
nd. | 174 * Callers should take a ref if they rely on the GrDrawContext sticking arou
nd. |
| 175 * NULL will be returned if the context has been abandoned. | 175 * NULL will be returned if the context has been abandoned. |
| 176 * | 176 * |
| 177 * @param surfaceProps the surface properties (mainly defines text drawing) | 177 * @param surfaceProps the surface properties (mainly defines text drawing) |
| 178 * | 178 * |
| 179 * @return a draw context | 179 * @return a draw context |
| 180 */ | 180 */ |
| 181 GrDrawContext* drawContext(const SkSurfaceProps* surfaceProps = NULL) { | 181 GrDrawContext* drawContext(GrRenderTarget* rt, const SkSurfaceProps* surface
Props = NULL) { |
| 182 return fDrawingMgr.drawContext(surfaceProps); | 182 return fDrawingMgr.drawContext(rt, surfaceProps); |
| 183 } | 183 } |
| 184 | 184 |
| 185 /////////////////////////////////////////////////////////////////////////// | 185 /////////////////////////////////////////////////////////////////////////// |
| 186 // Misc. | 186 // Misc. |
| 187 | 187 |
| 188 /** | 188 /** |
| 189 * Flags that affect flush() behavior. | 189 * Flags that affect flush() behavior. |
| 190 */ | 190 */ |
| 191 enum FlushBits { | 191 enum FlushBits { |
| 192 /** | 192 /** |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 | 409 |
| 410 void abandon(); | 410 void abandon(); |
| 411 bool abandoned() const { return NULL == fDrawTarget; } | 411 bool abandoned() const { return NULL == fDrawTarget; } |
| 412 | 412 |
| 413 void purgeResources(); | 413 void purgeResources(); |
| 414 void reset(); | 414 void reset(); |
| 415 void flush(); | 415 void flush(); |
| 416 | 416 |
| 417 // Callers should take a ref if they rely on the GrDrawContext sticking
around. | 417 // Callers should take a ref if they rely on the GrDrawContext sticking
around. |
| 418 // NULL will be returned if the context has been abandoned. | 418 // NULL will be returned if the context has been abandoned. |
| 419 GrDrawContext* drawContext(const SkSurfaceProps* surfaceProps); | 419 GrDrawContext* drawContext(GrRenderTarget* rt, const SkSurfaceProps* sur
faceProps); |
| 420 | 420 |
| 421 private: | 421 private: |
| 422 void cleanup(); | 422 void cleanup(); |
| 423 | 423 |
| 424 friend class GrContext; // for access to fDrawTarget for testing | 424 friend class GrContext; // for access to fDrawTarget for testing |
| 425 | 425 |
| 426 static const int kNumPixelGeometries = 5; // The different pixel geometr
ies | 426 static const int kNumPixelGeometries = 5; // The different pixel geometr
ies |
| 427 static const int kNumDFTOptions = 2; // DFT or no DFT | 427 static const int kNumDFTOptions = 2; // DFT or no DFT |
| 428 | 428 |
| 429 GrContext* fContext; | 429 GrContext* fContext; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 454 /** | 454 /** |
| 455 * A callback similar to the above for use by the TextBlobCache | 455 * A callback similar to the above for use by the TextBlobCache |
| 456 * TODO move textblob draw calls below context so we can use the call above. | 456 * TODO move textblob draw calls below context so we can use the call above. |
| 457 */ | 457 */ |
| 458 static void TextBlobCacheOverBudgetCB(void* data); | 458 static void TextBlobCacheOverBudgetCB(void* data); |
| 459 | 459 |
| 460 typedef SkRefCnt INHERITED; | 460 typedef SkRefCnt INHERITED; |
| 461 }; | 461 }; |
| 462 | 462 |
| 463 #endif | 463 #endif |
| OLD | NEW |