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 |
11 #include "GrColor.h" | 11 #include "GrColor.h" |
| 12 #include "GrPaint.h" |
12 #include "GrRenderTarget.h" | 13 #include "GrRenderTarget.h" |
13 #include "SkRefCnt.h" | 14 #include "SkRefCnt.h" |
14 #include "SkRegion.h" | 15 #include "SkRegion.h" |
15 #include "SkSurfaceProps.h" | 16 #include "SkSurfaceProps.h" |
16 #include "../private/GrSingleOwner.h" | 17 #include "../private/GrSingleOwner.h" |
17 | 18 |
18 class GrAtlasTextContext; | 19 class GrAtlasTextContext; |
19 class GrAuditTrail; | 20 class GrAuditTrail; |
20 class GrClip; | 21 class GrClip; |
21 class GrContext; | 22 class GrContext; |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 * - The sides (along the shrink axis) and center are not drawn | 244 * - The sides (along the shrink axis) and center are not drawn |
244 */ | 245 */ |
245 void drawImageNine(const GrClip&, | 246 void drawImageNine(const GrClip&, |
246 const GrPaint& paint, | 247 const GrPaint& paint, |
247 const SkMatrix& viewMatrix, | 248 const SkMatrix& viewMatrix, |
248 int imageWidth, | 249 int imageWidth, |
249 int imageHeight, | 250 int imageHeight, |
250 const SkIRect& center, | 251 const SkIRect& center, |
251 const SkRect& dst); | 252 const SkRect& dst); |
252 | 253 |
253 /** | |
254 * Draws a batch | |
255 * | |
256 * @param paint describes how to color pixels. | |
257 * @param batch the batch to draw | |
258 */ | |
259 void drawBatch(const GrClip&, const GrPaint&, GrDrawBatch*); | |
260 | |
261 bool isStencilBufferMultisampled() const { | 254 bool isStencilBufferMultisampled() const { |
262 return fRenderTarget->isStencilBufferMultisampled(); | 255 return fRenderTarget->isStencilBufferMultisampled(); |
263 } | 256 } |
264 bool isUnifiedMultisampled() const { return fRenderTarget->isUnifiedMultisam
pled(); } | 257 bool isUnifiedMultisampled() const { return fRenderTarget->isUnifiedMultisam
pled(); } |
265 bool hasMixedSamples() const { return fRenderTarget->hasMixedSamples(); } | 258 bool hasMixedSamples() const { return fRenderTarget->hasMixedSamples(); } |
266 | 259 |
| 260 bool mustUseHWAA(const GrPaint& paint) const { |
| 261 return paint.isAntiAlias() && fRenderTarget->isUnifiedMultisampled(); |
| 262 } |
| 263 |
267 const GrSurfaceDesc& desc() const { return fRenderTarget->desc(); } | 264 const GrSurfaceDesc& desc() const { return fRenderTarget->desc(); } |
268 int width() const { return fRenderTarget->width(); } | 265 int width() const { return fRenderTarget->width(); } |
269 int height() const { return fRenderTarget->height(); } | 266 int height() const { return fRenderTarget->height(); } |
270 GrPixelConfig config() const { return fRenderTarget->config(); } | 267 GrPixelConfig config() const { return fRenderTarget->config(); } |
271 int numColorSamples() const { return fRenderTarget->numColorSamples(); } | 268 int numColorSamples() const { return fRenderTarget->numColorSamples(); } |
272 bool isGammaCorrect() const { return fSurfaceProps.isGammaCorrect(); } | 269 bool isGammaCorrect() const { return fSurfaceProps.isGammaCorrect(); } |
273 const SkSurfaceProps& surfaceProps() const { return fSurfaceProps; } | 270 const SkSurfaceProps& surfaceProps() const { return fSurfaceProps; } |
274 | 271 |
275 bool wasAbandoned() const; | 272 bool wasAbandoned() const; |
276 | 273 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 friend class GrTessellatingPathRenderer; // for access to drawBatch | 316 friend class GrTessellatingPathRenderer; // for access to drawBatch |
320 | 317 |
321 bool drawFilledDRRect(const GrClip& clip, | 318 bool drawFilledDRRect(const GrClip& clip, |
322 const GrPaint& paint, | 319 const GrPaint& paint, |
323 const SkMatrix& viewMatrix, | 320 const SkMatrix& viewMatrix, |
324 const SkRRect& origOuter, | 321 const SkRRect& origOuter, |
325 const SkRRect& origInner); | 322 const SkRRect& origInner); |
326 | 323 |
327 GrDrawBatch* getFillRectBatch(const GrPaint& paint, | 324 GrDrawBatch* getFillRectBatch(const GrPaint& paint, |
328 const SkMatrix& viewMatrix, | 325 const SkMatrix& viewMatrix, |
329 const SkRect& rect); | 326 const SkRect& rect, |
| 327 bool* useHWAA); |
330 | 328 |
331 void internalDrawPath(const GrClip& clip, | 329 void internalDrawPath(const GrClip& clip, |
332 const GrPaint& paint, | 330 const GrPaint& paint, |
333 const SkMatrix& viewMatrix, | 331 const SkMatrix& viewMatrix, |
334 const SkPath& path, | 332 const SkPath& path, |
335 const GrStyle& style); | 333 const GrStyle& style); |
336 | 334 |
337 // This entry point allows the GrTextContext-derived classes to add their ba
tches to | 335 // This entry point allows the GrTextContext-derived classes to add their ba
tches to |
338 // the drawTarget. | 336 // the drawTarget. |
339 void drawBatch(const GrPipelineBuilder& pipelineBuilder, const GrClip&, GrDr
awBatch* batch); | 337 void drawBatch(const GrPipelineBuilder& pipelineBuilder, const GrClip&, GrDr
awBatch* batch); |
(...skipping 10 matching lines...) Expand all Loading... |
350 GrContext* fContext; | 348 GrContext* fContext; |
351 | 349 |
352 SkSurfaceProps fSurfaceProps; | 350 SkSurfaceProps fSurfaceProps; |
353 GrAuditTrail* fAuditTrail; | 351 GrAuditTrail* fAuditTrail; |
354 | 352 |
355 // In debug builds we guard against improper thread handling | 353 // In debug builds we guard against improper thread handling |
356 SkDEBUGCODE(mutable GrSingleOwner* fSingleOwner;) | 354 SkDEBUGCODE(mutable GrSingleOwner* fSingleOwner;) |
357 }; | 355 }; |
358 | 356 |
359 #endif | 357 #endif |
OLD | NEW |