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 GrDrawContext_DEFINED | 8 #ifndef GrDrawContext_DEFINED |
9 #define GrDrawContext_DEFINED | 9 #define GrDrawContext_DEFINED |
10 | 10 |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 * Draws a batch | 254 * Draws a batch |
255 * | 255 * |
256 * @param paint describes how to color pixels. | 256 * @param paint describes how to color pixels. |
257 * @param batch the batch to draw | 257 * @param batch the batch to draw |
258 */ | 258 */ |
259 void drawBatch(const GrClip&, const GrPaint&, GrDrawBatch*); | 259 void drawBatch(const GrClip&, const GrPaint&, GrDrawBatch*); |
260 | 260 |
261 const GrSurfaceDesc& desc() const { return fRenderTarget->desc(); } | 261 const GrSurfaceDesc& desc() const { return fRenderTarget->desc(); } |
262 int width() const { return fRenderTarget->width(); } | 262 int width() const { return fRenderTarget->width(); } |
263 int height() const { return fRenderTarget->height(); } | 263 int height() const { return fRenderTarget->height(); } |
| 264 GrPixelConfig config() const { return fRenderTarget->config(); } |
264 bool isUnifiedMultisampled() const { return fRenderTarget->isUnifiedMultisam
pled(); } | 265 bool isUnifiedMultisampled() const { return fRenderTarget->isUnifiedMultisam
pled(); } |
265 int numColorSamples() const { return fRenderTarget->numColorSamples(); } | 266 int numColorSamples() const { return fRenderTarget->numColorSamples(); } |
266 bool isGammaCorrect() const { return fSurfaceProps.isGammaCorrect(); } | 267 bool isGammaCorrect() const { return fSurfaceProps.isGammaCorrect(); } |
| 268 const SkSurfaceProps& surfaceProps() const { return fSurfaceProps; } |
267 | 269 |
268 bool wasAbandoned() const; | 270 bool wasAbandoned() const; |
269 | 271 |
270 GrRenderTarget* accessRenderTarget() { return fRenderTarget.get(); } | 272 GrRenderTarget* accessRenderTarget() { return fRenderTarget.get(); } |
271 | 273 |
272 sk_sp<GrRenderTarget> renderTarget() { return fRenderTarget; } | 274 sk_sp<GrRenderTarget> renderTarget() { return fRenderTarget; } |
273 | 275 |
274 sk_sp<GrTexture> asTexture() { return sk_ref_sp(fRenderTarget->asTexture());
} | 276 sk_sp<GrTexture> asTexture() { return sk_ref_sp(fRenderTarget->asTexture());
} |
275 | 277 |
276 // Provides access to functions that aren't part of the public API. | 278 // Provides access to functions that aren't part of the public API. |
277 GrDrawContextPriv drawContextPriv(); | 279 GrDrawContextPriv drawContextPriv(); |
278 const GrDrawContextPriv drawContextPriv() const; | 280 const GrDrawContextPriv drawContextPriv() const; |
279 | 281 |
280 protected: | 282 protected: |
281 GrDrawContext(GrContext*, GrDrawingManager*, sk_sp<GrRenderTarget>, | 283 GrDrawContext(GrContext*, GrDrawingManager*, sk_sp<GrRenderTarget>, |
282 const SkSurfaceProps* surfaceProps, GrAuditTrail*, GrSingleOwn
er*); | 284 const SkSurfaceProps* surfaceProps, GrAuditTrail*, GrSingleOwn
er*); |
283 | 285 |
284 GrDrawingManager* drawingManager() { return fDrawingManager; } | 286 GrDrawingManager* drawingManager() { return fDrawingManager; } |
285 GrAuditTrail* auditTrail() { return fAuditTrail; } | 287 GrAuditTrail* auditTrail() { return fAuditTrail; } |
286 const SkSurfaceProps& surfaceProps() const { return fSurfaceProps; } | 288 |
287 | |
288 SkDEBUGCODE(GrSingleOwner* singleOwner() { return fSingleOwner; }) | 289 SkDEBUGCODE(GrSingleOwner* singleOwner() { return fSingleOwner; }) |
289 SkDEBUGCODE(void validate() const;) | 290 SkDEBUGCODE(void validate() const;) |
290 | 291 |
291 private: | 292 private: |
292 friend class GrAtlasTextBlob; // for access to drawBatch | 293 friend class GrAtlasTextBlob; // for access to drawBatch |
293 friend class GrStencilAndCoverTextContext; // for access to drawBatch | 294 friend class GrStencilAndCoverTextContext; // for access to drawBatch |
294 friend class GrDrawingManager; // for ctor | 295 friend class GrDrawingManager; // for ctor |
295 friend class GrDrawContextPriv; | 296 friend class GrDrawContextPriv; |
296 | 297 |
297 bool drawFilledDRRect(const GrClip& clip, | 298 bool drawFilledDRRect(const GrClip& clip, |
(...skipping 28 matching lines...) Expand all Loading... |
326 GrContext* fContext; | 327 GrContext* fContext; |
327 | 328 |
328 SkSurfaceProps fSurfaceProps; | 329 SkSurfaceProps fSurfaceProps; |
329 GrAuditTrail* fAuditTrail; | 330 GrAuditTrail* fAuditTrail; |
330 | 331 |
331 // In debug builds we guard against improper thread handling | 332 // In debug builds we guard against improper thread handling |
332 SkDEBUGCODE(mutable GrSingleOwner* fSingleOwner;) | 333 SkDEBUGCODE(mutable GrSingleOwner* fSingleOwner;) |
333 }; | 334 }; |
334 | 335 |
335 #endif | 336 #endif |
OLD | NEW |