| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "GrAtlasTextContext.h" | 9 #include "GrAtlasTextContext.h" |
| 10 #include "GrBatchTest.h" | 10 #include "GrBatchTest.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 class AutoCheckFlush { | 31 class AutoCheckFlush { |
| 32 public: | 32 public: |
| 33 AutoCheckFlush(GrContext* context) : fContext(context) { SkASSERT(context);
} | 33 AutoCheckFlush(GrContext* context) : fContext(context) { SkASSERT(context);
} |
| 34 ~AutoCheckFlush() { fContext->flushIfNecessary(); } | 34 ~AutoCheckFlush() { fContext->flushIfNecessary(); } |
| 35 | 35 |
| 36 private: | 36 private: |
| 37 GrContext* fContext; | 37 GrContext* fContext; |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 GrDrawContext::GrDrawContext(GrContext* context, | 40 GrDrawContext::GrDrawContext(GrContext* context, |
| 41 GrRenderTarget* rt, |
| 41 GrDrawTarget* drawTarget, | 42 GrDrawTarget* drawTarget, |
| 42 const SkSurfaceProps* surfaceProps) | 43 const SkSurfaceProps* surfaceProps) |
| 43 : fContext(context) | 44 : fContext(context) |
| 45 , fRenderTarget(rt) |
| 44 , fDrawTarget(SkRef(drawTarget)) | 46 , fDrawTarget(SkRef(drawTarget)) |
| 45 , fTextContext(nullptr) | 47 , fTextContext(nullptr) |
| 46 , fSurfaceProps(SkSurfacePropsCopyOrDefault(surfaceProps)) { | 48 , fSurfaceProps(SkSurfacePropsCopyOrDefault(surfaceProps)) { |
| 49 SkDEBUGCODE(this->validate();) |
| 47 } | 50 } |
| 48 | 51 |
| 49 GrDrawContext::~GrDrawContext() { | 52 GrDrawContext::~GrDrawContext() { |
| 50 SkSafeUnref(fDrawTarget); | 53 SkSafeUnref(fDrawTarget); |
| 51 } | 54 } |
| 52 | 55 |
| 53 void GrDrawContext::copySurface(GrRenderTarget* dst, GrSurface* src, | 56 #ifdef SK_DEBUG |
| 54 const SkIRect& srcRect, const SkIPoint& dstPoint
) { | 57 void GrDrawContext::validate() const { |
| 58 SkASSERT(fRenderTarget); |
| 59 ASSERT_OWNED_RESOURCE(fRenderTarget); |
| 60 } |
| 61 #endif |
| 62 |
| 63 void GrDrawContext::copySurface(GrSurface* src, const SkIRect& srcRect, const Sk
IPoint& dstPoint) { |
| 55 RETURN_IF_ABANDONED | 64 RETURN_IF_ABANDONED |
| 65 SkDEBUGCODE(this->validate();) |
| 56 | 66 |
| 57 if (!this->prepareToDraw(dst)) { | 67 fDrawTarget->copySurface(fRenderTarget, src, srcRect, dstPoint); |
| 58 return; | |
| 59 } | |
| 60 | |
| 61 fDrawTarget->copySurface(dst, src, srcRect, dstPoint); | |
| 62 } | 68 } |
| 63 | 69 |
| 64 | 70 |
| 65 void GrDrawContext::drawText(GrRenderTarget* rt, const GrClip& clip, const GrPai
nt& grPaint, | 71 void GrDrawContext::drawText(const GrClip& clip, const GrPaint& grPaint, |
| 66 const SkPaint& skPaint, | 72 const SkPaint& skPaint, |
| 67 const SkMatrix& viewMatrix, | 73 const SkMatrix& viewMatrix, |
| 68 const char text[], size_t byteLength, | 74 const char text[], size_t byteLength, |
| 69 SkScalar x, SkScalar y, const SkIRect& clipBounds)
{ | 75 SkScalar x, SkScalar y, const SkIRect& clipBounds)
{ |
| 70 RETURN_IF_ABANDONED | 76 RETURN_IF_ABANDONED |
| 77 SkDEBUGCODE(this->validate();) |
| 71 | 78 |
| 72 if (!fTextContext) { | 79 if (!fTextContext) { |
| 73 fTextContext = fContext->textContext(fSurfaceProps, rt); | 80 fTextContext = fContext->textContext(fSurfaceProps, fRenderTarget); |
| 74 } | 81 } |
| 75 | 82 |
| 76 fTextContext->drawText(this, rt, clip, grPaint, skPaint, viewMatrix, | 83 fTextContext->drawText(this, fRenderTarget, clip, grPaint, skPaint, viewMatr
ix, |
| 77 text, byteLength, x, y, clipBounds); | 84 text, byteLength, x, y, clipBounds); |
| 78 | 85 |
| 79 } | 86 } |
| 80 void GrDrawContext::drawPosText(GrRenderTarget* rt, const GrClip& clip, const Gr
Paint& grPaint, | 87 void GrDrawContext::drawPosText(const GrClip& clip, const GrPaint& grPaint, |
| 81 const SkPaint& skPaint, | 88 const SkPaint& skPaint, |
| 82 const SkMatrix& viewMatrix, | 89 const SkMatrix& viewMatrix, |
| 83 const char text[], size_t byteLength, | 90 const char text[], size_t byteLength, |
| 84 const SkScalar pos[], int scalarsPerPosition, | 91 const SkScalar pos[], int scalarsPerPosition, |
| 85 const SkPoint& offset, const SkIRect& clipBounds
) { | 92 const SkPoint& offset, const SkIRect& clipBounds
) { |
| 86 RETURN_IF_ABANDONED | 93 RETURN_IF_ABANDONED |
| 94 SkDEBUGCODE(this->validate();) |
| 87 | 95 |
| 88 if (!fTextContext) { | 96 if (!fTextContext) { |
| 89 fTextContext = fContext->textContext(fSurfaceProps, rt); | 97 fTextContext = fContext->textContext(fSurfaceProps, fRenderTarget); |
| 90 } | 98 } |
| 91 | 99 |
| 92 fTextContext->drawPosText(this, rt, clip, grPaint, skPaint, viewMatrix, text
, byteLength, | 100 fTextContext->drawPosText(this, fRenderTarget, clip, grPaint, skPaint, viewM
atrix, text, byteLength, |
| 93 pos, scalarsPerPosition, offset, clipBounds); | 101 pos, scalarsPerPosition, offset, clipBounds); |
| 94 | 102 |
| 95 } | 103 } |
| 96 void GrDrawContext::drawTextBlob(GrRenderTarget* rt, const GrClip& clip, const S
kPaint& skPaint, | 104 void GrDrawContext::drawTextBlob(const GrClip& clip, const SkPaint& skPaint, |
| 97 const SkMatrix& viewMatrix, const SkTextBlob* b
lob, | 105 const SkMatrix& viewMatrix, const SkTextBlob* b
lob, |
| 98 SkScalar x, SkScalar y, | 106 SkScalar x, SkScalar y, |
| 99 SkDrawFilter* filter, const SkIRect& clipBounds
) { | 107 SkDrawFilter* filter, const SkIRect& clipBounds
) { |
| 100 RETURN_IF_ABANDONED | 108 RETURN_IF_ABANDONED |
| 109 SkDEBUGCODE(this->validate();) |
| 101 | 110 |
| 102 if (!fTextContext) { | 111 if (!fTextContext) { |
| 103 fTextContext = fContext->textContext(fSurfaceProps, rt); | 112 fTextContext = fContext->textContext(fSurfaceProps, fRenderTarget); |
| 104 } | 113 } |
| 105 | 114 |
| 106 fTextContext->drawTextBlob(this, rt, | 115 fTextContext->drawTextBlob(this, fRenderTarget, |
| 107 clip, skPaint, viewMatrix, blob, x, y, filter, cl
ipBounds); | 116 clip, skPaint, viewMatrix, blob, x, y, filter, cl
ipBounds); |
| 108 } | 117 } |
| 109 | 118 |
| 110 void GrDrawContext::drawPathsFromRange(const GrPipelineBuilder* pipelineBuilder, | 119 void GrDrawContext::drawPathsFromRange(const GrPipelineBuilder* pipelineBuilder, |
| 111 const SkMatrix& viewMatrix, | 120 const SkMatrix& viewMatrix, |
| 112 const SkMatrix& localMatrix, | 121 const SkMatrix& localMatrix, |
| 113 GrColor color, | 122 GrColor color, |
| 114 GrPathRange* range, | 123 GrPathRange* range, |
| 115 GrPathRangeDraw* draw, | 124 GrPathRangeDraw* draw, |
| 116 int /*GrPathRendering::FillType*/ fill) { | 125 int /*GrPathRendering::FillType*/ fill) { |
| 117 RETURN_IF_ABANDONED | 126 RETURN_IF_ABANDONED |
| 127 SkDEBUGCODE(this->validate();) |
| 118 | 128 |
| 119 fDrawTarget->drawPathsFromRange(*pipelineBuilder, viewMatrix, localMatrix, c
olor, range, draw, | 129 fDrawTarget->drawPathsFromRange(*pipelineBuilder, viewMatrix, localMatrix, c
olor, range, draw, |
| 120 (GrPathRendering::FillType) fill); | 130 (GrPathRendering::FillType) fill); |
| 121 } | 131 } |
| 122 | 132 |
| 123 void GrDrawContext::discard(GrRenderTarget* renderTarget) { | 133 void GrDrawContext::discard() { |
| 124 RETURN_IF_ABANDONED | 134 RETURN_IF_ABANDONED |
| 125 SkASSERT(renderTarget); | 135 SkDEBUGCODE(this->validate();) |
| 136 |
| 126 AutoCheckFlush acf(fContext); | 137 AutoCheckFlush acf(fContext); |
| 127 if (!this->prepareToDraw(renderTarget)) { | 138 fDrawTarget->discard(fRenderTarget); |
| 128 return; | |
| 129 } | |
| 130 fDrawTarget->discard(renderTarget); | |
| 131 } | 139 } |
| 132 | 140 |
| 133 void GrDrawContext::clear(GrRenderTarget* renderTarget, | 141 void GrDrawContext::clear(const SkIRect* rect, |
| 134 const SkIRect* rect, | |
| 135 const GrColor color, | 142 const GrColor color, |
| 136 bool canIgnoreRect) { | 143 bool canIgnoreRect) { |
| 137 RETURN_IF_ABANDONED | 144 RETURN_IF_ABANDONED |
| 138 SkASSERT(renderTarget); | 145 SkDEBUGCODE(this->validate();) |
| 139 | 146 |
| 140 AutoCheckFlush acf(fContext); | 147 AutoCheckFlush acf(fContext); |
| 141 if (!this->prepareToDraw(renderTarget)) { | 148 fDrawTarget->clear(rect, color, canIgnoreRect, fRenderTarget); |
| 142 return; | |
| 143 } | |
| 144 fDrawTarget->clear(rect, color, canIgnoreRect, renderTarget); | |
| 145 } | 149 } |
| 146 | 150 |
| 147 | 151 |
| 148 void GrDrawContext::drawPaint(GrRenderTarget* rt, | 152 void GrDrawContext::drawPaint(const GrClip& clip, |
| 149 const GrClip& clip, | |
| 150 const GrPaint& origPaint, | 153 const GrPaint& origPaint, |
| 151 const SkMatrix& viewMatrix) { | 154 const SkMatrix& viewMatrix) { |
| 152 RETURN_IF_ABANDONED | 155 RETURN_IF_ABANDONED |
| 156 SkDEBUGCODE(this->validate();) |
| 157 |
| 153 // set rect to be big enough to fill the space, but not super-huge, so we | 158 // set rect to be big enough to fill the space, but not super-huge, so we |
| 154 // don't overflow fixed-point implementations | 159 // don't overflow fixed-point implementations |
| 155 SkRect r; | 160 SkRect r; |
| 156 r.setLTRB(0, 0, | 161 r.setLTRB(0, 0, |
| 157 SkIntToScalar(rt->width()), | 162 SkIntToScalar(fRenderTarget->width()), |
| 158 SkIntToScalar(rt->height())); | 163 SkIntToScalar(fRenderTarget->height())); |
| 159 SkTCopyOnFirstWrite<GrPaint> paint(origPaint); | 164 SkTCopyOnFirstWrite<GrPaint> paint(origPaint); |
| 160 | 165 |
| 161 // by definition this fills the entire clip, no need for AA | 166 // by definition this fills the entire clip, no need for AA |
| 162 if (paint->isAntiAlias()) { | 167 if (paint->isAntiAlias()) { |
| 163 paint.writable()->setAntiAlias(false); | 168 paint.writable()->setAntiAlias(false); |
| 164 } | 169 } |
| 165 | 170 |
| 166 bool isPerspective = viewMatrix.hasPerspective(); | 171 bool isPerspective = viewMatrix.hasPerspective(); |
| 167 | 172 |
| 168 // We attempt to map r by the inverse matrix and draw that. mapRect will | 173 // We attempt to map r by the inverse matrix and draw that. mapRect will |
| 169 // map the four corners and bound them with a new rect. This will not | 174 // map the four corners and bound them with a new rect. This will not |
| 170 // produce a correct result for some perspective matrices. | 175 // produce a correct result for some perspective matrices. |
| 171 if (!isPerspective) { | 176 if (!isPerspective) { |
| 172 SkMatrix inverse; | 177 SkMatrix inverse; |
| 173 if (!viewMatrix.invert(&inverse)) { | 178 if (!viewMatrix.invert(&inverse)) { |
| 174 SkDebugf("Could not invert matrix\n"); | 179 SkDebugf("Could not invert matrix\n"); |
| 175 return; | 180 return; |
| 176 } | 181 } |
| 177 inverse.mapRect(&r); | 182 inverse.mapRect(&r); |
| 178 this->drawRect(rt, clip, *paint, viewMatrix, r); | 183 this->drawRect(clip, *paint, viewMatrix, r); |
| 179 } else { | 184 } else { |
| 180 SkMatrix localMatrix; | 185 SkMatrix localMatrix; |
| 181 if (!viewMatrix.invert(&localMatrix)) { | 186 if (!viewMatrix.invert(&localMatrix)) { |
| 182 SkDebugf("Could not invert matrix\n"); | 187 SkDebugf("Could not invert matrix\n"); |
| 183 return; | 188 return; |
| 184 } | 189 } |
| 185 | 190 |
| 186 AutoCheckFlush acf(fContext); | 191 AutoCheckFlush acf(fContext); |
| 187 if (!this->prepareToDraw(rt)) { | |
| 188 return; | |
| 189 } | |
| 190 | 192 |
| 191 GrPipelineBuilder pipelineBuilder(*paint, rt, clip); | 193 GrPipelineBuilder pipelineBuilder(*paint, fRenderTarget, clip); |
| 192 fDrawTarget->drawNonAARect(pipelineBuilder, | 194 fDrawTarget->drawNonAARect(pipelineBuilder, |
| 193 paint->getColor(), | 195 paint->getColor(), |
| 194 SkMatrix::I(), | 196 SkMatrix::I(), |
| 195 r, | 197 r, |
| 196 localMatrix); | 198 localMatrix); |
| 197 } | 199 } |
| 198 } | 200 } |
| 199 | 201 |
| 200 static inline bool rect_contains_inclusive(const SkRect& rect, const SkPoint& po
int) { | 202 static inline bool rect_contains_inclusive(const SkRect& rect, const SkPoint& po
int) { |
| 201 return point.fX >= rect.fLeft && point.fX <= rect.fRight && | 203 return point.fX >= rect.fLeft && point.fX <= rect.fRight && |
| 202 point.fY >= rect.fTop && point.fY <= rect.fBottom; | 204 point.fY >= rect.fTop && point.fY <= rect.fBottom; |
| 203 } | 205 } |
| 204 | 206 |
| 205 void GrDrawContext::drawRect(GrRenderTarget* rt, | 207 void GrDrawContext::drawRect(const GrClip& clip, |
| 206 const GrClip& clip, | |
| 207 const GrPaint& paint, | 208 const GrPaint& paint, |
| 208 const SkMatrix& viewMatrix, | 209 const SkMatrix& viewMatrix, |
| 209 const SkRect& rect, | 210 const SkRect& rect, |
| 210 const GrStrokeInfo* strokeInfo) { | 211 const GrStrokeInfo* strokeInfo) { |
| 211 RETURN_IF_ABANDONED | 212 RETURN_IF_ABANDONED |
| 213 SkDEBUGCODE(this->validate();) |
| 214 |
| 212 if (strokeInfo && strokeInfo->isDashed()) { | 215 if (strokeInfo && strokeInfo->isDashed()) { |
| 213 SkPath path; | 216 SkPath path; |
| 214 path.setIsVolatile(true); | 217 path.setIsVolatile(true); |
| 215 path.addRect(rect); | 218 path.addRect(rect); |
| 216 this->drawPath(rt, clip, paint, viewMatrix, path, *strokeInfo); | 219 this->drawPath(clip, paint, viewMatrix, path, *strokeInfo); |
| 217 return; | 220 return; |
| 218 } | 221 } |
| 219 | 222 |
| 220 AutoCheckFlush acf(fContext); | 223 AutoCheckFlush acf(fContext); |
| 221 if (!this->prepareToDraw(rt)) { | |
| 222 return; | |
| 223 } | |
| 224 | 224 |
| 225 GrPipelineBuilder pipelineBuilder(paint, rt, clip); | 225 GrPipelineBuilder pipelineBuilder(paint, fRenderTarget, clip); |
| 226 | 226 |
| 227 SkScalar width = nullptr == strokeInfo ? -1 : strokeInfo->getWidth(); | 227 SkScalar width = nullptr == strokeInfo ? -1 : strokeInfo->getWidth(); |
| 228 | 228 |
| 229 // Check if this is a full RT draw and can be replaced with a clear. We don'
t bother checking | 229 // Check if this is a full RT draw and can be replaced with a clear. We don'
t bother checking |
| 230 // cases where the RT is fully inside a stroke. | 230 // cases where the RT is fully inside a stroke. |
| 231 if (width < 0) { | 231 if (width < 0) { |
| 232 SkRect rtRect; | 232 SkRect rtRect; |
| 233 pipelineBuilder.getRenderTarget()->getBoundsRect(&rtRect); | 233 pipelineBuilder.getRenderTarget()->getBoundsRect(&rtRect); |
| 234 SkRect clipSpaceRTRect = rtRect; | 234 SkRect clipSpaceRTRect = rtRect; |
| 235 bool checkClip = GrClip::kWideOpen_ClipType != clip.clipType(); | 235 bool checkClip = GrClip::kWideOpen_ClipType != clip.clipType(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 246 // Does the rect bound the RT? | 246 // Does the rect bound the RT? |
| 247 SkPoint srcSpaceRTQuad[4]; | 247 SkPoint srcSpaceRTQuad[4]; |
| 248 invM.mapRectToQuad(srcSpaceRTQuad, rtRect); | 248 invM.mapRectToQuad(srcSpaceRTQuad, rtRect); |
| 249 if (rect_contains_inclusive(rect, srcSpaceRTQuad[0]) && | 249 if (rect_contains_inclusive(rect, srcSpaceRTQuad[0]) && |
| 250 rect_contains_inclusive(rect, srcSpaceRTQuad[1]) && | 250 rect_contains_inclusive(rect, srcSpaceRTQuad[1]) && |
| 251 rect_contains_inclusive(rect, srcSpaceRTQuad[2]) && | 251 rect_contains_inclusive(rect, srcSpaceRTQuad[2]) && |
| 252 rect_contains_inclusive(rect, srcSpaceRTQuad[3])) { | 252 rect_contains_inclusive(rect, srcSpaceRTQuad[3])) { |
| 253 // Will it blend? | 253 // Will it blend? |
| 254 GrColor clearColor; | 254 GrColor clearColor; |
| 255 if (paint.isConstantBlendedColor(&clearColor)) { | 255 if (paint.isConstantBlendedColor(&clearColor)) { |
| 256 fDrawTarget->clear(nullptr, clearColor, true, rt); | 256 fDrawTarget->clear(nullptr, clearColor, true, fRenderTarget)
; |
| 257 return; | 257 return; |
| 258 } | 258 } |
| 259 } | 259 } |
| 260 } | 260 } |
| 261 } | 261 } |
| 262 | 262 |
| 263 GrColor color = paint.getColor(); | 263 GrColor color = paint.getColor(); |
| 264 bool needAA = paint.isAntiAlias() && | 264 bool needAA = paint.isAntiAlias() && |
| 265 !pipelineBuilder.getRenderTarget()->isUnifiedMultisampled(); | 265 !pipelineBuilder.getRenderTarget()->isUnifiedMultisampled(); |
| 266 | 266 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 278 SkRect devBoundRect; | 278 SkRect devBoundRect; |
| 279 viewMatrix.mapRect(&devBoundRect, rect); | 279 viewMatrix.mapRect(&devBoundRect, rect); |
| 280 batch.reset(GrRectBatchFactory::CreateAAFill(color, viewMatrix, rect
, devBoundRect)); | 280 batch.reset(GrRectBatchFactory::CreateAAFill(color, viewMatrix, rect
, devBoundRect)); |
| 281 } | 281 } |
| 282 fDrawTarget->drawBatch(pipelineBuilder, batch); | 282 fDrawTarget->drawBatch(pipelineBuilder, batch); |
| 283 return; | 283 return; |
| 284 } | 284 } |
| 285 | 285 |
| 286 if (width >= 0) { | 286 if (width >= 0) { |
| 287 // Non-AA hairlines are snapped to pixel centers to make which pixels ar
e hit deterministic | 287 // Non-AA hairlines are snapped to pixel centers to make which pixels ar
e hit deterministic |
| 288 bool snapToPixelCenters = (0 == width && !rt->isUnifiedMultisampled()); | 288 bool snapToPixelCenters = (0 == width && !fRenderTarget->isUnifiedMultis
ampled()); |
| 289 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAStroke( | 289 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAStroke( |
| 290 color, viewMatrix, rect, width, snapToPi
xelCenters)); | 290 color, viewMatrix, rect, width, snapToPi
xelCenters)); |
| 291 | 291 |
| 292 // Depending on sub-pixel coordinates and the particular GPU, we may los
e a corner of | 292 // Depending on sub-pixel coordinates and the particular GPU, we may los
e a corner of |
| 293 // hairline rects. We jam all the vertices to pixel centers to avoid thi
s, but not when MSAA | 293 // hairline rects. We jam all the vertices to pixel centers to avoid thi
s, but not when MSAA |
| 294 // is enabled because it can cause ugly artifacts. | 294 // is enabled because it can cause ugly artifacts. |
| 295 pipelineBuilder.setState(GrPipelineBuilder::kSnapVerticesToPixelCenters_
Flag, | 295 pipelineBuilder.setState(GrPipelineBuilder::kSnapVerticesToPixelCenters_
Flag, |
| 296 snapToPixelCenters); | 296 snapToPixelCenters); |
| 297 fDrawTarget->drawBatch(pipelineBuilder, batch); | 297 fDrawTarget->drawBatch(pipelineBuilder, batch); |
| 298 } else { | 298 } else { |
| 299 // filled BW rect | 299 // filled BW rect |
| 300 fDrawTarget->drawNonAARect(pipelineBuilder, color, viewMatrix, rect); | 300 fDrawTarget->drawNonAARect(pipelineBuilder, color, viewMatrix, rect); |
| 301 } | 301 } |
| 302 } | 302 } |
| 303 | 303 |
| 304 void GrDrawContext::drawNonAARectToRect(GrRenderTarget* rt, | 304 void GrDrawContext::drawNonAARectToRect(const GrClip& clip, |
| 305 const GrClip& clip, | |
| 306 const GrPaint& paint, | 305 const GrPaint& paint, |
| 307 const SkMatrix& viewMatrix, | 306 const SkMatrix& viewMatrix, |
| 308 const SkRect& rectToDraw, | 307 const SkRect& rectToDraw, |
| 309 const SkRect& localRect) { | 308 const SkRect& localRect) { |
| 310 RETURN_IF_ABANDONED | 309 RETURN_IF_ABANDONED |
| 310 SkDEBUGCODE(this->validate();) |
| 311 |
| 311 AutoCheckFlush acf(fContext); | 312 AutoCheckFlush acf(fContext); |
| 312 if (!this->prepareToDraw(rt)) { | |
| 313 return; | |
| 314 } | |
| 315 | 313 |
| 316 GrPipelineBuilder pipelineBuilder(paint, rt, clip); | 314 GrPipelineBuilder pipelineBuilder(paint, fRenderTarget, clip); |
| 317 fDrawTarget->drawNonAARect(pipelineBuilder, | 315 fDrawTarget->drawNonAARect(pipelineBuilder, |
| 318 paint.getColor(), | 316 paint.getColor(), |
| 319 viewMatrix, | 317 viewMatrix, |
| 320 rectToDraw, | 318 rectToDraw, |
| 321 localRect); | 319 localRect); |
| 322 } | 320 } |
| 323 | 321 |
| 324 void GrDrawContext::drawNonAARectWithLocalMatrix(GrRenderTarget* rt, | 322 void GrDrawContext::drawNonAARectWithLocalMatrix(const GrClip& clip, |
| 325 const GrClip& clip, | |
| 326 const GrPaint& paint, | 323 const GrPaint& paint, |
| 327 const SkMatrix& viewMatrix, | 324 const SkMatrix& viewMatrix, |
| 328 const SkRect& rectToDraw, | 325 const SkRect& rectToDraw, |
| 329 const SkMatrix& localMatrix) { | 326 const SkMatrix& localMatrix) { |
| 330 RETURN_IF_ABANDONED | 327 RETURN_IF_ABANDONED |
| 328 SkDEBUGCODE(this->validate();) |
| 329 |
| 331 AutoCheckFlush acf(fContext); | 330 AutoCheckFlush acf(fContext); |
| 332 if (!this->prepareToDraw(rt)) { | |
| 333 return; | |
| 334 } | |
| 335 | 331 |
| 336 GrPipelineBuilder pipelineBuilder(paint, rt, clip); | 332 GrPipelineBuilder pipelineBuilder(paint, fRenderTarget, clip); |
| 337 fDrawTarget->drawNonAARect(pipelineBuilder, | 333 fDrawTarget->drawNonAARect(pipelineBuilder, |
| 338 paint.getColor(), | 334 paint.getColor(), |
| 339 viewMatrix, | 335 viewMatrix, |
| 340 rectToDraw, | 336 rectToDraw, |
| 341 localMatrix); | 337 localMatrix); |
| 342 } | 338 } |
| 343 | 339 |
| 344 void GrDrawContext::drawVertices(GrRenderTarget* rt, | 340 void GrDrawContext::drawVertices(const GrClip& clip, |
| 345 const GrClip& clip, | |
| 346 const GrPaint& paint, | 341 const GrPaint& paint, |
| 347 const SkMatrix& viewMatrix, | 342 const SkMatrix& viewMatrix, |
| 348 GrPrimitiveType primitiveType, | 343 GrPrimitiveType primitiveType, |
| 349 int vertexCount, | 344 int vertexCount, |
| 350 const SkPoint positions[], | 345 const SkPoint positions[], |
| 351 const SkPoint texCoords[], | 346 const SkPoint texCoords[], |
| 352 const GrColor colors[], | 347 const GrColor colors[], |
| 353 const uint16_t indices[], | 348 const uint16_t indices[], |
| 354 int indexCount) { | 349 int indexCount) { |
| 355 RETURN_IF_ABANDONED | 350 RETURN_IF_ABANDONED |
| 351 SkDEBUGCODE(this->validate();) |
| 352 |
| 356 AutoCheckFlush acf(fContext); | 353 AutoCheckFlush acf(fContext); |
| 357 if (!this->prepareToDraw(rt)) { | |
| 358 return; | |
| 359 } | |
| 360 | 354 |
| 361 GrPipelineBuilder pipelineBuilder(paint, rt, clip); | 355 GrPipelineBuilder pipelineBuilder(paint, fRenderTarget, clip); |
| 362 | 356 |
| 363 // TODO clients should give us bounds | 357 // TODO clients should give us bounds |
| 364 SkRect bounds; | 358 SkRect bounds; |
| 365 if (!bounds.setBoundsCheck(positions, vertexCount)) { | 359 if (!bounds.setBoundsCheck(positions, vertexCount)) { |
| 366 SkDebugf("drawVertices call empty bounds\n"); | 360 SkDebugf("drawVertices call empty bounds\n"); |
| 367 return; | 361 return; |
| 368 } | 362 } |
| 369 | 363 |
| 370 viewMatrix.mapRect(&bounds); | 364 viewMatrix.mapRect(&bounds); |
| 371 | 365 |
| 372 // If we don't have AA then we outset for a half pixel in each direction to
account for | 366 // If we don't have AA then we outset for a half pixel in each direction to
account for |
| 373 // snapping | 367 // snapping |
| 374 if (!paint.isAntiAlias()) { | 368 if (!paint.isAntiAlias()) { |
| 375 bounds.outset(0.5f, 0.5f); | 369 bounds.outset(0.5f, 0.5f); |
| 376 } | 370 } |
| 377 | 371 |
| 378 GrDrawVerticesBatch::Geometry geometry; | 372 GrDrawVerticesBatch::Geometry geometry; |
| 379 geometry.fColor = paint.getColor(); | 373 geometry.fColor = paint.getColor(); |
| 380 SkAutoTUnref<GrDrawBatch> batch(GrDrawVerticesBatch::Create(geometry, primit
iveType, viewMatrix, | 374 SkAutoTUnref<GrDrawBatch> batch(GrDrawVerticesBatch::Create(geometry, primit
iveType, viewMatrix, |
| 381 positions, verte
xCount, indices, | 375 positions, verte
xCount, indices, |
| 382 indexCount, colo
rs, texCoords, | 376 indexCount, colo
rs, texCoords, |
| 383 bounds)); | 377 bounds)); |
| 384 | 378 |
| 385 fDrawTarget->drawBatch(pipelineBuilder, batch); | 379 fDrawTarget->drawBatch(pipelineBuilder, batch); |
| 386 } | 380 } |
| 387 | 381 |
| 388 /////////////////////////////////////////////////////////////////////////////// | 382 /////////////////////////////////////////////////////////////////////////////// |
| 389 | 383 |
| 390 void GrDrawContext::drawAtlas(GrRenderTarget* rt, | 384 void GrDrawContext::drawAtlas(const GrClip& clip, |
| 391 const GrClip& clip, | |
| 392 const GrPaint& paint, | 385 const GrPaint& paint, |
| 393 const SkMatrix& viewMatrix, | 386 const SkMatrix& viewMatrix, |
| 394 int spriteCount, | 387 int spriteCount, |
| 395 const SkRSXform xform[], | 388 const SkRSXform xform[], |
| 396 const SkRect texRect[], | 389 const SkRect texRect[], |
| 397 const SkColor colors[]) { | 390 const SkColor colors[]) { |
| 398 RETURN_IF_ABANDONED | 391 RETURN_IF_ABANDONED |
| 392 SkDEBUGCODE(this->validate();) |
| 393 |
| 399 AutoCheckFlush acf(fContext); | 394 AutoCheckFlush acf(fContext); |
| 400 if (!this->prepareToDraw(rt)) { | |
| 401 return; | |
| 402 } | |
| 403 | 395 |
| 404 GrPipelineBuilder pipelineBuilder(paint, rt, clip); | 396 GrPipelineBuilder pipelineBuilder(paint, fRenderTarget, clip); |
| 405 | 397 |
| 406 GrDrawAtlasBatch::Geometry geometry; | 398 GrDrawAtlasBatch::Geometry geometry; |
| 407 geometry.fColor = paint.getColor(); | 399 geometry.fColor = paint.getColor(); |
| 408 SkAutoTUnref<GrDrawBatch> batch(GrDrawAtlasBatch::Create(geometry, viewMatri
x, spriteCount, | 400 SkAutoTUnref<GrDrawBatch> batch(GrDrawAtlasBatch::Create(geometry, viewMatri
x, spriteCount, |
| 409 xform, texRect, col
ors)); | 401 xform, texRect, col
ors)); |
| 410 | 402 |
| 411 fDrawTarget->drawBatch(pipelineBuilder, batch); | 403 fDrawTarget->drawBatch(pipelineBuilder, batch); |
| 412 } | 404 } |
| 413 | 405 |
| 414 /////////////////////////////////////////////////////////////////////////////// | 406 /////////////////////////////////////////////////////////////////////////////// |
| 415 | 407 |
| 416 void GrDrawContext::drawRRect(GrRenderTarget*rt, | 408 void GrDrawContext::drawRRect(const GrClip& clip, |
| 417 const GrClip& clip, | |
| 418 const GrPaint& paint, | 409 const GrPaint& paint, |
| 419 const SkMatrix& viewMatrix, | 410 const SkMatrix& viewMatrix, |
| 420 const SkRRect& rrect, | 411 const SkRRect& rrect, |
| 421 const GrStrokeInfo& strokeInfo) { | 412 const GrStrokeInfo& strokeInfo) { |
| 422 RETURN_IF_ABANDONED | 413 RETURN_IF_ABANDONED |
| 414 SkDEBUGCODE(this->validate();) |
| 415 |
| 423 if (rrect.isEmpty()) { | 416 if (rrect.isEmpty()) { |
| 424 return; | 417 return; |
| 425 } | 418 } |
| 426 | 419 |
| 427 if (strokeInfo.isDashed()) { | 420 if (strokeInfo.isDashed()) { |
| 428 SkPath path; | 421 SkPath path; |
| 429 path.setIsVolatile(true); | 422 path.setIsVolatile(true); |
| 430 path.addRRect(rrect); | 423 path.addRRect(rrect); |
| 431 this->drawPath(rt, clip, paint, viewMatrix, path, strokeInfo); | 424 this->drawPath(clip, paint, viewMatrix, path, strokeInfo); |
| 432 return; | 425 return; |
| 433 } | 426 } |
| 434 | 427 |
| 435 AutoCheckFlush acf(fContext); | 428 AutoCheckFlush acf(fContext); |
| 436 if (!this->prepareToDraw(rt)) { | |
| 437 return; | |
| 438 } | |
| 439 | 429 |
| 440 GrPipelineBuilder pipelineBuilder(paint, rt, clip); | 430 GrPipelineBuilder pipelineBuilder(paint, fRenderTarget, clip); |
| 441 GrColor color = paint.getColor(); | 431 GrColor color = paint.getColor(); |
| 432 |
| 442 if (!GrOvalRenderer::DrawRRect(fDrawTarget, | 433 if (!GrOvalRenderer::DrawRRect(fDrawTarget, |
| 443 pipelineBuilder, | 434 pipelineBuilder, |
| 444 color, | 435 color, |
| 445 viewMatrix, | 436 viewMatrix, |
| 446 paint.isAntiAlias(), | 437 paint.isAntiAlias(), |
| 447 rrect, | 438 rrect, |
| 448 strokeInfo)) { | 439 strokeInfo)) { |
| 449 SkPath path; | 440 SkPath path; |
| 450 path.setIsVolatile(true); | 441 path.setIsVolatile(true); |
| 451 path.addRRect(rrect); | 442 path.addRRect(rrect); |
| 452 this->internalDrawPath(fDrawTarget, &pipelineBuilder, viewMatrix, color, | 443 this->internalDrawPath(fDrawTarget, &pipelineBuilder, viewMatrix, color, |
| 453 paint.isAntiAlias(), path, strokeInfo); | 444 paint.isAntiAlias(), path, strokeInfo); |
| 454 } | 445 } |
| 455 } | 446 } |
| 456 | 447 |
| 457 /////////////////////////////////////////////////////////////////////////////// | 448 /////////////////////////////////////////////////////////////////////////////// |
| 458 | 449 |
| 459 void GrDrawContext::drawDRRect(GrRenderTarget* rt, | 450 void GrDrawContext::drawDRRect(const GrClip& clip, |
| 460 const GrClip& clip, | |
| 461 const GrPaint& paint, | 451 const GrPaint& paint, |
| 462 const SkMatrix& viewMatrix, | 452 const SkMatrix& viewMatrix, |
| 463 const SkRRect& outer, | 453 const SkRRect& outer, |
| 464 const SkRRect& inner) { | 454 const SkRRect& inner) { |
| 465 RETURN_IF_ABANDONED | 455 RETURN_IF_ABANDONED |
| 456 SkDEBUGCODE(this->validate();) |
| 457 |
| 466 if (outer.isEmpty()) { | 458 if (outer.isEmpty()) { |
| 467 return; | 459 return; |
| 468 } | 460 } |
| 469 | 461 |
| 470 AutoCheckFlush acf(fContext); | 462 AutoCheckFlush acf(fContext); |
| 471 if (!this->prepareToDraw(rt)) { | |
| 472 return; | |
| 473 } | |
| 474 | 463 |
| 475 GrPipelineBuilder pipelineBuilder(paint, rt, clip); | 464 GrPipelineBuilder pipelineBuilder(paint, fRenderTarget, clip); |
| 476 GrColor color = paint.getColor(); | 465 GrColor color = paint.getColor(); |
| 477 if (!GrOvalRenderer::DrawDRRect(fDrawTarget, | 466 if (!GrOvalRenderer::DrawDRRect(fDrawTarget, |
| 478 pipelineBuilder, | 467 pipelineBuilder, |
| 479 color, | 468 color, |
| 480 viewMatrix, | 469 viewMatrix, |
| 481 paint.isAntiAlias(), | 470 paint.isAntiAlias(), |
| 482 outer, | 471 outer, |
| 483 inner)) { | 472 inner)) { |
| 484 SkPath path; | 473 SkPath path; |
| 485 path.setIsVolatile(true); | 474 path.setIsVolatile(true); |
| 486 path.addRRect(inner); | 475 path.addRRect(inner); |
| 487 path.addRRect(outer); | 476 path.addRRect(outer); |
| 488 path.setFillType(SkPath::kEvenOdd_FillType); | 477 path.setFillType(SkPath::kEvenOdd_FillType); |
| 489 | 478 |
| 490 GrStrokeInfo fillRec(SkStrokeRec::kFill_InitStyle); | 479 GrStrokeInfo fillRec(SkStrokeRec::kFill_InitStyle); |
| 491 this->internalDrawPath(fDrawTarget, &pipelineBuilder, viewMatrix, color, | 480 this->internalDrawPath(fDrawTarget, &pipelineBuilder, viewMatrix, color, |
| 492 paint.isAntiAlias(), path, fillRec); | 481 paint.isAntiAlias(), path, fillRec); |
| 493 } | 482 } |
| 494 } | 483 } |
| 495 | 484 |
| 496 /////////////////////////////////////////////////////////////////////////////// | 485 /////////////////////////////////////////////////////////////////////////////// |
| 497 | 486 |
| 498 void GrDrawContext::drawOval(GrRenderTarget* rt, | 487 void GrDrawContext::drawOval(const GrClip& clip, |
| 499 const GrClip& clip, | |
| 500 const GrPaint& paint, | 488 const GrPaint& paint, |
| 501 const SkMatrix& viewMatrix, | 489 const SkMatrix& viewMatrix, |
| 502 const SkRect& oval, | 490 const SkRect& oval, |
| 503 const GrStrokeInfo& strokeInfo) { | 491 const GrStrokeInfo& strokeInfo) { |
| 504 RETURN_IF_ABANDONED | 492 RETURN_IF_ABANDONED |
| 493 SkDEBUGCODE(this->validate();) |
| 494 |
| 505 if (oval.isEmpty()) { | 495 if (oval.isEmpty()) { |
| 506 return; | 496 return; |
| 507 } | 497 } |
| 508 | 498 |
| 509 if (strokeInfo.isDashed()) { | 499 if (strokeInfo.isDashed()) { |
| 510 SkPath path; | 500 SkPath path; |
| 511 path.setIsVolatile(true); | 501 path.setIsVolatile(true); |
| 512 path.addOval(oval); | 502 path.addOval(oval); |
| 513 this->drawPath(rt, clip, paint, viewMatrix, path, strokeInfo); | 503 this->drawPath(clip, paint, viewMatrix, path, strokeInfo); |
| 514 return; | 504 return; |
| 515 } | 505 } |
| 516 | 506 |
| 517 AutoCheckFlush acf(fContext); | 507 AutoCheckFlush acf(fContext); |
| 518 if (!this->prepareToDraw(rt)) { | |
| 519 return; | |
| 520 } | |
| 521 | 508 |
| 522 GrPipelineBuilder pipelineBuilder(paint, rt, clip); | 509 GrPipelineBuilder pipelineBuilder(paint, fRenderTarget, clip); |
| 523 GrColor color = paint.getColor(); | 510 GrColor color = paint.getColor(); |
| 511 |
| 524 if (!GrOvalRenderer::DrawOval(fDrawTarget, | 512 if (!GrOvalRenderer::DrawOval(fDrawTarget, |
| 525 pipelineBuilder, | 513 pipelineBuilder, |
| 526 color, | 514 color, |
| 527 viewMatrix, | 515 viewMatrix, |
| 528 paint.isAntiAlias(), | 516 paint.isAntiAlias(), |
| 529 oval, | 517 oval, |
| 530 strokeInfo)) { | 518 strokeInfo)) { |
| 531 SkPath path; | 519 SkPath path; |
| 532 path.setIsVolatile(true); | 520 path.setIsVolatile(true); |
| 533 path.addOval(oval); | 521 path.addOval(oval); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 allGoE1 = false; | 567 allGoE1 = false; |
| 580 } | 568 } |
| 581 if (!SkScalarNearlyEqual(margin, temp)) { | 569 if (!SkScalarNearlyEqual(margin, temp)) { |
| 582 allEq = false; | 570 allEq = false; |
| 583 } | 571 } |
| 584 } | 572 } |
| 585 | 573 |
| 586 return allEq || allGoE1; | 574 return allEq || allGoE1; |
| 587 } | 575 } |
| 588 | 576 |
| 589 void GrDrawContext::drawBatch(GrRenderTarget* rt, const GrClip& clip, | 577 void GrDrawContext::drawBatch(const GrClip& clip, |
| 590 const GrPaint& paint, GrDrawBatch* batch) { | 578 const GrPaint& paint, GrDrawBatch* batch) { |
| 591 RETURN_IF_ABANDONED | 579 RETURN_IF_ABANDONED |
| 580 SkDEBUGCODE(this->validate();) |
| 592 | 581 |
| 593 AutoCheckFlush acf(fContext); | 582 AutoCheckFlush acf(fContext); |
| 594 if (!this->prepareToDraw(rt)) { | |
| 595 return; | |
| 596 } | |
| 597 | 583 |
| 598 GrPipelineBuilder pipelineBuilder(paint, rt, clip); | 584 GrPipelineBuilder pipelineBuilder(paint, fRenderTarget, clip); |
| 599 fDrawTarget->drawBatch(pipelineBuilder, batch); | 585 fDrawTarget->drawBatch(pipelineBuilder, batch); |
| 600 } | 586 } |
| 601 | 587 |
| 602 void GrDrawContext::drawPath(GrRenderTarget* rt, | 588 void GrDrawContext::drawPath(const GrClip& clip, |
| 603 const GrClip& clip, | |
| 604 const GrPaint& paint, | 589 const GrPaint& paint, |
| 605 const SkMatrix& viewMatrix, | 590 const SkMatrix& viewMatrix, |
| 606 const SkPath& path, | 591 const SkPath& path, |
| 607 const GrStrokeInfo& strokeInfo) { | 592 const GrStrokeInfo& strokeInfo) { |
| 608 RETURN_IF_ABANDONED | 593 RETURN_IF_ABANDONED |
| 594 SkDEBUGCODE(this->validate();) |
| 595 |
| 609 if (path.isEmpty()) { | 596 if (path.isEmpty()) { |
| 610 if (path.isInverseFillType()) { | 597 if (path.isInverseFillType()) { |
| 611 this->drawPaint(rt, clip, paint, viewMatrix); | 598 this->drawPaint(clip, paint, viewMatrix); |
| 612 } | 599 } |
| 613 return; | 600 return; |
| 614 } | 601 } |
| 615 | 602 |
| 616 GrColor color = paint.getColor(); | 603 GrColor color = paint.getColor(); |
| 617 | 604 |
| 618 // Note that internalDrawPath may sw-rasterize the path into a scratch textu
re. | 605 // Note that internalDrawPath may sw-rasterize the path into a scratch textu
re. |
| 619 // Scratch textures can be recycled after they are returned to the texture | 606 // Scratch textures can be recycled after they are returned to the texture |
| 620 // cache. This presents a potential hazard for buffered drawing. However, | 607 // cache. This presents a potential hazard for buffered drawing. However, |
| 621 // the writePixels that uploads to the scratch will perform a flush so we're | 608 // the writePixels that uploads to the scratch will perform a flush so we're |
| 622 // OK. | 609 // OK. |
| 623 AutoCheckFlush acf(fContext); | 610 AutoCheckFlush acf(fContext); |
| 624 if (!this->prepareToDraw(rt)) { | |
| 625 return; | |
| 626 } | |
| 627 | 611 |
| 628 GrPipelineBuilder pipelineBuilder(paint, rt, clip); | 612 GrPipelineBuilder pipelineBuilder(paint, fRenderTarget, clip); |
| 629 if (!strokeInfo.isDashed()) { | 613 if (!strokeInfo.isDashed()) { |
| 630 bool useCoverageAA = paint.isAntiAlias() && | 614 bool useCoverageAA = paint.isAntiAlias() && |
| 631 !pipelineBuilder.getRenderTarget()->isUnifiedMultisampled(); | 615 !pipelineBuilder.getRenderTarget()->isUnifiedMultisampled(); |
| 632 | 616 |
| 633 if (useCoverageAA && strokeInfo.getWidth() < 0 && !path.isConvex()) { | 617 if (useCoverageAA && strokeInfo.getWidth() < 0 && !path.isConvex()) { |
| 634 // Concave AA paths are expensive - try to avoid them for special ca
ses | 618 // Concave AA paths are expensive - try to avoid them for special ca
ses |
| 635 SkRect rects[2]; | 619 SkRect rects[2]; |
| 636 | 620 |
| 637 if (is_nested_rects(viewMatrix, path, strokeInfo, rects)) { | 621 if (is_nested_rects(viewMatrix, path, strokeInfo, rects)) { |
| 638 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateAAFill
NestedRects( | 622 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateAAFill
NestedRects( |
| (...skipping 24 matching lines...) Expand all Loading... |
| 663 void GrDrawContext::internalDrawPath(GrDrawTarget* target, | 647 void GrDrawContext::internalDrawPath(GrDrawTarget* target, |
| 664 GrPipelineBuilder* pipelineBuilder, | 648 GrPipelineBuilder* pipelineBuilder, |
| 665 const SkMatrix& viewMatrix, | 649 const SkMatrix& viewMatrix, |
| 666 GrColor color, | 650 GrColor color, |
| 667 bool useAA, | 651 bool useAA, |
| 668 const SkPath& path, | 652 const SkPath& path, |
| 669 const GrStrokeInfo& strokeInfo) { | 653 const GrStrokeInfo& strokeInfo) { |
| 670 RETURN_IF_ABANDONED | 654 RETURN_IF_ABANDONED |
| 671 SkASSERT(!path.isEmpty()); | 655 SkASSERT(!path.isEmpty()); |
| 672 | 656 |
| 673 | |
| 674 // An Assumption here is that path renderer would use some form of tweaking | 657 // An Assumption here is that path renderer would use some form of tweaking |
| 675 // the src color (either the input alpha or in the frag shader) to implement | 658 // the src color (either the input alpha or in the frag shader) to implement |
| 676 // aa. If we have some future driver-mojo path AA that can do the right | 659 // aa. If we have some future driver-mojo path AA that can do the right |
| 677 // thing WRT to the blend then we'll need some query on the PR. | 660 // thing WRT to the blend then we'll need some query on the PR. |
| 678 bool useCoverageAA = useAA && | 661 bool useCoverageAA = useAA && |
| 679 !pipelineBuilder->getRenderTarget()->isUnifiedMultisampled(); | 662 !pipelineBuilder->getRenderTarget()->isUnifiedMultisampled(); |
| 680 | 663 |
| 681 | 664 |
| 682 GrPathRendererChain::DrawType type = | 665 GrPathRendererChain::DrawType type = |
| 683 useCoverageAA ? GrPathRendererChain::kColorAntiAlias_DrawType : | 666 useCoverageAA ? GrPathRendererChain::kColorAntiAlias_DrawType : |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 args.fResourceProvider = fContext->resourceProvider(); | 725 args.fResourceProvider = fContext->resourceProvider(); |
| 743 args.fPipelineBuilder = pipelineBuilder; | 726 args.fPipelineBuilder = pipelineBuilder; |
| 744 args.fColor = color; | 727 args.fColor = color; |
| 745 args.fViewMatrix = &viewMatrix; | 728 args.fViewMatrix = &viewMatrix; |
| 746 args.fPath = pathPtr; | 729 args.fPath = pathPtr; |
| 747 args.fStroke = strokeInfoPtr; | 730 args.fStroke = strokeInfoPtr; |
| 748 args.fAntiAlias = useCoverageAA; | 731 args.fAntiAlias = useCoverageAA; |
| 749 pr->drawPath(args); | 732 pr->drawPath(args); |
| 750 } | 733 } |
| 751 | 734 |
| 752 bool GrDrawContext::prepareToDraw(GrRenderTarget* rt) { | |
| 753 RETURN_FALSE_IF_ABANDONED | |
| 754 | |
| 755 ASSERT_OWNED_RESOURCE(rt); | |
| 756 SkASSERT(rt); | |
| 757 return true; | |
| 758 } | |
| 759 | |
| 760 void GrDrawContext::drawBatch(GrPipelineBuilder* pipelineBuilder, GrDrawBatch* b
atch) { | 735 void GrDrawContext::drawBatch(GrPipelineBuilder* pipelineBuilder, GrDrawBatch* b
atch) { |
| 761 RETURN_IF_ABANDONED | 736 RETURN_IF_ABANDONED |
| 737 SkDEBUGCODE(this->validate();) |
| 762 | 738 |
| 763 fDrawTarget->drawBatch(*pipelineBuilder, batch); | 739 fDrawTarget->drawBatch(*pipelineBuilder, batch); |
| 764 } | 740 } |
| OLD | NEW |