| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 #include "SkGpuDevice.h" | 8 #include "SkGpuDevice.h" |
| 9 | 9 |
| 10 #include "GrContext.h" | 10 #include "GrContext.h" |
| 11 #include "GrDrawContext.h" |
| 11 #include "GrGpu.h" | 12 #include "GrGpu.h" |
| 12 #include "GrGpuResourcePriv.h" | 13 #include "GrGpuResourcePriv.h" |
| 13 #include "GrLayerHoister.h" | 14 #include "GrLayerHoister.h" |
| 14 #include "GrRecordReplaceDraw.h" | 15 #include "GrRecordReplaceDraw.h" |
| 15 #include "GrStrokeInfo.h" | 16 #include "GrStrokeInfo.h" |
| 16 #include "GrTextContext.h" | 17 #include "GrTextContext.h" |
| 17 #include "GrTracing.h" | 18 #include "GrTracing.h" |
| 18 #include "SkCanvasPriv.h" | 19 #include "SkCanvasPriv.h" |
| 19 #include "SkDeviceImageFilterProxy.h" | 20 #include "SkDeviceImageFilterProxy.h" |
| 20 #include "SkDrawProcs.h" | 21 #include "SkDrawProcs.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 fRenderTarget = SkRef(rt); | 162 fRenderTarget = SkRef(rt); |
| 162 | 163 |
| 163 SkImageInfo info = rt->surfacePriv().info().makeWH(width, height); | 164 SkImageInfo info = rt->surfacePriv().info().makeWH(width, height); |
| 164 SkPixelRef* pr = SkNEW_ARGS(SkGrPixelRef, (info, rt)); | 165 SkPixelRef* pr = SkNEW_ARGS(SkGrPixelRef, (info, rt)); |
| 165 fLegacyBitmap.setInfo(info); | 166 fLegacyBitmap.setInfo(info); |
| 166 fLegacyBitmap.setPixelRef(pr)->unref(); | 167 fLegacyBitmap.setPixelRef(pr)->unref(); |
| 167 | 168 |
| 168 bool useDFT = fSurfaceProps.isUseDistanceFieldFonts(); | 169 bool useDFT = fSurfaceProps.isUseDistanceFieldFonts(); |
| 169 fTextContext = fContext->createTextContext(fRenderTarget, this, this->getLea
kyProperties(), | 170 fTextContext = fContext->createTextContext(fRenderTarget, this, this->getLea
kyProperties(), |
| 170 useDFT); | 171 useDFT); |
| 172 fDrawContext.reset(SkRef(fContext->drawContext())); |
| 171 } | 173 } |
| 172 | 174 |
| 173 GrRenderTarget* SkGpuDevice::CreateRenderTarget(GrContext* context, SkSurface::B
udgeted budgeted, | 175 GrRenderTarget* SkGpuDevice::CreateRenderTarget(GrContext* context, SkSurface::B
udgeted budgeted, |
| 174 const SkImageInfo& origInfo, int
sampleCount) { | 176 const SkImageInfo& origInfo, int
sampleCount) { |
| 175 if (kUnknown_SkColorType == origInfo.colorType() || | 177 if (kUnknown_SkColorType == origInfo.colorType() || |
| 176 origInfo.width() < 0 || origInfo.height() < 0) { | 178 origInfo.width() < 0 || origInfo.height() < 0) { |
| 177 return NULL; | 179 return NULL; |
| 178 } | 180 } |
| 179 | 181 |
| 180 if (!context) { | 182 if (!context) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 } | 221 } |
| 220 | 222 |
| 221 return SkNEW_ARGS(SkGpuDevice, (rt, info.width(), info.height(), props, flag
s)); | 223 return SkNEW_ARGS(SkGpuDevice, (rt, info.width(), info.height(), props, flag
s)); |
| 222 } | 224 } |
| 223 | 225 |
| 224 SkGpuDevice::~SkGpuDevice() { | 226 SkGpuDevice::~SkGpuDevice() { |
| 225 if (fDrawProcs) { | 227 if (fDrawProcs) { |
| 226 delete fDrawProcs; | 228 delete fDrawProcs; |
| 227 } | 229 } |
| 228 | 230 |
| 229 delete fTextContext; | 231 SkDELETE(fTextContext); |
| 230 | 232 |
| 231 fRenderTarget->unref(); | 233 fRenderTarget->unref(); |
| 232 fContext->unref(); | 234 fContext->unref(); |
| 233 } | 235 } |
| 234 | 236 |
| 235 /////////////////////////////////////////////////////////////////////////////// | 237 /////////////////////////////////////////////////////////////////////////////// |
| 236 | 238 |
| 237 bool SkGpuDevice::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size
_t dstRowBytes, | 239 bool SkGpuDevice::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size
_t dstRowBytes, |
| 238 int x, int y) { | 240 int x, int y) { |
| 239 DO_DEFERRED_CLEAR(); | 241 DO_DEFERRED_CLEAR(); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 | 305 |
| 304 GrRenderTarget* SkGpuDevice::accessRenderTarget() { | 306 GrRenderTarget* SkGpuDevice::accessRenderTarget() { |
| 305 DO_DEFERRED_CLEAR(); | 307 DO_DEFERRED_CLEAR(); |
| 306 return fRenderTarget; | 308 return fRenderTarget; |
| 307 } | 309 } |
| 308 | 310 |
| 309 void SkGpuDevice::clearAll() { | 311 void SkGpuDevice::clearAll() { |
| 310 GrColor color = 0; | 312 GrColor color = 0; |
| 311 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::clearAll", fContext); | 313 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::clearAll", fContext); |
| 312 SkIRect rect = SkIRect::MakeWH(this->width(), this->height()); | 314 SkIRect rect = SkIRect::MakeWH(this->width(), this->height()); |
| 313 fContext->clear(&rect, color, true, fRenderTarget); | 315 fDrawContext->clear(fRenderTarget, &rect, color, true); |
| 314 fNeedClear = false; | 316 fNeedClear = false; |
| 315 } | 317 } |
| 316 | 318 |
| 317 void SkGpuDevice::replaceRenderTarget(bool shouldRetainContent) { | 319 void SkGpuDevice::replaceRenderTarget(bool shouldRetainContent) { |
| 318 // Caller must have accessed the render target, because it knows the rt must
be replaced. | 320 // Caller must have accessed the render target, because it knows the rt must
be replaced. |
| 319 SkASSERT(!fNeedClear); | 321 SkASSERT(!fNeedClear); |
| 320 | 322 |
| 321 SkSurface::Budgeted budgeted = | 323 SkSurface::Budgeted budgeted = |
| 322 fRenderTarget->resourcePriv().isBudgeted() ? SkSurface::kYes_Budgete
d | 324 fRenderTarget->resourcePriv().isBudgeted() ? SkSurface::kYes_Budgete
d |
| 323 : SkSurface::kNo_Budgeted
; | 325 : SkSurface::kNo_Budgeted
; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 337 } | 339 } |
| 338 | 340 |
| 339 SkASSERT(fRenderTarget != newRT); | 341 SkASSERT(fRenderTarget != newRT); |
| 340 | 342 |
| 341 fRenderTarget->unref(); | 343 fRenderTarget->unref(); |
| 342 fRenderTarget = newRT.detach(); | 344 fRenderTarget = newRT.detach(); |
| 343 | 345 |
| 344 SkASSERT(fRenderTarget->surfacePriv().info() == fLegacyBitmap.info()); | 346 SkASSERT(fRenderTarget->surfacePriv().info() == fLegacyBitmap.info()); |
| 345 SkPixelRef* pr = SkNEW_ARGS(SkGrPixelRef, (fRenderTarget->surfacePriv().info
(), fRenderTarget)); | 347 SkPixelRef* pr = SkNEW_ARGS(SkGrPixelRef, (fRenderTarget->surfacePriv().info
(), fRenderTarget)); |
| 346 fLegacyBitmap.setPixelRef(pr)->unref(); | 348 fLegacyBitmap.setPixelRef(pr)->unref(); |
| 349 |
| 350 fDrawContext.reset(SkRef(fRenderTarget->getContext()->drawContext())); |
| 347 } | 351 } |
| 348 | 352 |
| 349 /////////////////////////////////////////////////////////////////////////////// | 353 /////////////////////////////////////////////////////////////////////////////// |
| 350 | 354 |
| 351 void SkGpuDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) { | 355 void SkGpuDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) { |
| 352 CHECK_SHOULD_DRAW(draw); | 356 CHECK_SHOULD_DRAW(draw); |
| 353 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawPaint", fContext); | 357 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawPaint", fContext); |
| 354 | 358 |
| 355 GrPaint grPaint; | 359 GrPaint grPaint; |
| 356 if (!SkPaint2GrPaint(this->context(), fRenderTarget, paint, *draw.fMatrix, t
rue, &grPaint)) { | 360 if (!SkPaint2GrPaint(this->context(), fRenderTarget, paint, *draw.fMatrix, t
rue, &grPaint)) { |
| 357 return; | 361 return; |
| 358 } | 362 } |
| 359 | 363 |
| 360 fContext->drawPaint(fRenderTarget, fClip, grPaint, *draw.fMatrix); | 364 fDrawContext->drawPaint(fRenderTarget, fClip, grPaint, *draw.fMatrix); |
| 361 } | 365 } |
| 362 | 366 |
| 363 // must be in SkCanvas::PointMode order | 367 // must be in SkCanvas::PointMode order |
| 364 static const GrPrimitiveType gPointMode2PrimtiveType[] = { | 368 static const GrPrimitiveType gPointMode2PrimtiveType[] = { |
| 365 kPoints_GrPrimitiveType, | 369 kPoints_GrPrimitiveType, |
| 366 kLines_GrPrimitiveType, | 370 kLines_GrPrimitiveType, |
| 367 kLineStrip_GrPrimitiveType | 371 kLineStrip_GrPrimitiveType |
| 368 }; | 372 }; |
| 369 | 373 |
| 370 void SkGpuDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode, | 374 void SkGpuDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 381 GrStrokeInfo strokeInfo(paint, SkPaint::kStroke_Style); | 385 GrStrokeInfo strokeInfo(paint, SkPaint::kStroke_Style); |
| 382 GrPaint grPaint; | 386 GrPaint grPaint; |
| 383 if (!SkPaint2GrPaint(this->context(), fRenderTarget, paint, *draw.fMatri
x, true, | 387 if (!SkPaint2GrPaint(this->context(), fRenderTarget, paint, *draw.fMatri
x, true, |
| 384 &grPaint)) { | 388 &grPaint)) { |
| 385 return; | 389 return; |
| 386 } | 390 } |
| 387 SkPath path; | 391 SkPath path; |
| 388 path.setIsVolatile(true); | 392 path.setIsVolatile(true); |
| 389 path.moveTo(pts[0]); | 393 path.moveTo(pts[0]); |
| 390 path.lineTo(pts[1]); | 394 path.lineTo(pts[1]); |
| 391 fContext->drawPath(fRenderTarget, fClip, grPaint, *draw.fMatrix, path, s
trokeInfo); | 395 fDrawContext->drawPath(fRenderTarget, fClip, grPaint, *draw.fMatrix, pat
h, strokeInfo); |
| 392 return; | 396 return; |
| 393 } | 397 } |
| 394 | 398 |
| 395 // we only handle hairlines and paints without path effects or mask filters, | 399 // we only handle hairlines and paints without path effects or mask filters, |
| 396 // else we let the SkDraw call our drawPath() | 400 // else we let the SkDraw call our drawPath() |
| 397 if (width > 0 || paint.getPathEffect() || paint.getMaskFilter()) { | 401 if (width > 0 || paint.getPathEffect() || paint.getMaskFilter()) { |
| 398 draw.drawPoints(mode, count, pts, paint, true); | 402 draw.drawPoints(mode, count, pts, paint, true); |
| 399 return; | 403 return; |
| 400 } | 404 } |
| 401 | 405 |
| 402 GrPaint grPaint; | 406 GrPaint grPaint; |
| 403 if (!SkPaint2GrPaint(this->context(), fRenderTarget, paint, *draw.fMatrix, t
rue, &grPaint)) { | 407 if (!SkPaint2GrPaint(this->context(), fRenderTarget, paint, *draw.fMatrix, t
rue, &grPaint)) { |
| 404 return; | 408 return; |
| 405 } | 409 } |
| 406 | 410 |
| 407 fContext->drawVertices(fRenderTarget, | 411 fDrawContext->drawVertices(fRenderTarget, |
| 408 fClip, | 412 fClip, |
| 409 grPaint, | 413 grPaint, |
| 410 *draw.fMatrix, | 414 *draw.fMatrix, |
| 411 gPointMode2PrimtiveType[mode], | 415 gPointMode2PrimtiveType[mode], |
| 412 SkToS32(count), | 416 SkToS32(count), |
| 413 (SkPoint*)pts, | 417 (SkPoint*)pts, |
| 414 NULL, | 418 NULL, |
| 415 NULL, | 419 NULL, |
| 416 NULL, | 420 NULL, |
| 417 0); | 421 0); |
| 418 } | 422 } |
| 419 | 423 |
| 420 /////////////////////////////////////////////////////////////////////////////// | 424 /////////////////////////////////////////////////////////////////////////////// |
| 421 | 425 |
| 422 void SkGpuDevice::drawRect(const SkDraw& draw, const SkRect& rect, | 426 void SkGpuDevice::drawRect(const SkDraw& draw, const SkRect& rect, |
| 423 const SkPaint& paint) { | 427 const SkPaint& paint) { |
| 424 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawRect", fContext); | 428 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawRect", fContext); |
| 425 | 429 |
| 426 CHECK_FOR_ANNOTATION(paint); | 430 CHECK_FOR_ANNOTATION(paint); |
| 427 CHECK_SHOULD_DRAW(draw); | 431 CHECK_SHOULD_DRAW(draw); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 path.addRect(rect); | 475 path.addRect(rect); |
| 472 this->drawPath(draw, path, paint, NULL, true); | 476 this->drawPath(draw, path, paint, NULL, true); |
| 473 return; | 477 return; |
| 474 } | 478 } |
| 475 | 479 |
| 476 GrPaint grPaint; | 480 GrPaint grPaint; |
| 477 if (!SkPaint2GrPaint(this->context(), fRenderTarget, paint, *draw.fMatrix, t
rue, &grPaint)) { | 481 if (!SkPaint2GrPaint(this->context(), fRenderTarget, paint, *draw.fMatrix, t
rue, &grPaint)) { |
| 478 return; | 482 return; |
| 479 } | 483 } |
| 480 | 484 |
| 481 fContext->drawRect(fRenderTarget, fClip, grPaint, *draw.fMatrix, rect, &stro
keInfo); | 485 fDrawContext->drawRect(fRenderTarget, fClip, grPaint, *draw.fMatrix, rect, &
strokeInfo); |
| 482 } | 486 } |
| 483 | 487 |
| 484 /////////////////////////////////////////////////////////////////////////////// | 488 /////////////////////////////////////////////////////////////////////////////// |
| 485 | 489 |
| 486 void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rect, | 490 void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rect, |
| 487 const SkPaint& paint) { | 491 const SkPaint& paint) { |
| 488 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawRRect", fContext); | 492 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawRRect", fContext); |
| 489 CHECK_FOR_ANNOTATION(paint); | 493 CHECK_FOR_ANNOTATION(paint); |
| 490 CHECK_SHOULD_DRAW(draw); | 494 CHECK_SHOULD_DRAW(draw); |
| 491 | 495 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 | 545 |
| 542 | 546 |
| 543 if (usePath) { | 547 if (usePath) { |
| 544 SkPath path; | 548 SkPath path; |
| 545 path.setIsVolatile(true); | 549 path.setIsVolatile(true); |
| 546 path.addRRect(rect); | 550 path.addRRect(rect); |
| 547 this->drawPath(draw, path, paint, NULL, true); | 551 this->drawPath(draw, path, paint, NULL, true); |
| 548 return; | 552 return; |
| 549 } | 553 } |
| 550 | 554 |
| 551 fContext->drawRRect(fRenderTarget, fClip, grPaint, *draw.fMatrix, rect, stro
keInfo); | 555 fDrawContext->drawRRect(fRenderTarget, fClip, grPaint, *draw.fMatrix, rect,
strokeInfo); |
| 552 } | 556 } |
| 553 | 557 |
| 554 void SkGpuDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer, | 558 void SkGpuDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer, |
| 555 const SkRRect& inner, const SkPaint& paint) { | 559 const SkRRect& inner, const SkPaint& paint) { |
| 556 SkStrokeRec stroke(paint); | 560 SkStrokeRec stroke(paint); |
| 557 if (stroke.isFillStyle()) { | 561 if (stroke.isFillStyle()) { |
| 558 | 562 |
| 559 CHECK_FOR_ANNOTATION(paint); | 563 CHECK_FOR_ANNOTATION(paint); |
| 560 CHECK_SHOULD_DRAW(draw); | 564 CHECK_SHOULD_DRAW(draw); |
| 561 | 565 |
| 562 GrPaint grPaint; | 566 GrPaint grPaint; |
| 563 if (!SkPaint2GrPaint(this->context(), fRenderTarget, paint, *draw.fMatri
x, true, | 567 if (!SkPaint2GrPaint(this->context(), fRenderTarget, paint, *draw.fMatri
x, true, |
| 564 &grPaint)) { | 568 &grPaint)) { |
| 565 return; | 569 return; |
| 566 } | 570 } |
| 567 | 571 |
| 568 if (NULL == paint.getMaskFilter() && NULL == paint.getPathEffect()) { | 572 if (NULL == paint.getMaskFilter() && NULL == paint.getPathEffect()) { |
| 569 fContext->drawDRRect(fRenderTarget, fClip, grPaint, *draw.fMatrix, o
uter, inner); | 573 fDrawContext->drawDRRect(fRenderTarget, fClip, grPaint, *draw.fMatri
x, outer, inner); |
| 570 return; | 574 return; |
| 571 } | 575 } |
| 572 } | 576 } |
| 573 | 577 |
| 574 SkPath path; | 578 SkPath path; |
| 575 path.setIsVolatile(true); | 579 path.setIsVolatile(true); |
| 576 path.addRRect(outer); | 580 path.addRRect(outer); |
| 577 path.addRRect(inner); | 581 path.addRRect(inner); |
| 578 path.setFillType(SkPath::kEvenOdd_FillType); | 582 path.setFillType(SkPath::kEvenOdd_FillType); |
| 579 | 583 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 608 path.addOval(oval); | 612 path.addOval(oval); |
| 609 this->drawPath(draw, path, paint, NULL, true); | 613 this->drawPath(draw, path, paint, NULL, true); |
| 610 return; | 614 return; |
| 611 } | 615 } |
| 612 | 616 |
| 613 GrPaint grPaint; | 617 GrPaint grPaint; |
| 614 if (!SkPaint2GrPaint(this->context(), fRenderTarget, paint, *draw.fMatrix, t
rue, &grPaint)) { | 618 if (!SkPaint2GrPaint(this->context(), fRenderTarget, paint, *draw.fMatrix, t
rue, &grPaint)) { |
| 615 return; | 619 return; |
| 616 } | 620 } |
| 617 | 621 |
| 618 fContext->drawOval(fRenderTarget, fClip, grPaint, *draw.fMatrix, oval, strok
eInfo); | 622 fDrawContext->drawOval(fRenderTarget, fClip, grPaint, *draw.fMatrix, oval, s
trokeInfo); |
| 619 } | 623 } |
| 620 | 624 |
| 621 #include "SkMaskFilter.h" | 625 #include "SkMaskFilter.h" |
| 622 | 626 |
| 623 /////////////////////////////////////////////////////////////////////////////// | 627 /////////////////////////////////////////////////////////////////////////////// |
| 624 | 628 |
| 625 // helpers for applying mask filters | 629 // helpers for applying mask filters |
| 626 namespace { | 630 namespace { |
| 627 | 631 |
| 628 // Draw a mask using the supplied paint. Since the coverage/geometry | 632 // Draw a mask using the supplied paint. Since the coverage/geometry |
| 629 // is already burnt into the mask this boils down to a rect draw. | 633 // is already burnt into the mask this boils down to a rect draw. |
| 630 // Return true if the mask was successfully drawn. | 634 // Return true if the mask was successfully drawn. |
| 631 bool draw_mask(GrContext* context, | 635 bool draw_mask(GrDrawContext* drawContext, |
| 632 GrRenderTarget* rt, | 636 GrRenderTarget* rt, |
| 633 const GrClip& clip, | 637 const GrClip& clip, |
| 634 const SkMatrix& viewMatrix, | 638 const SkMatrix& viewMatrix, |
| 635 const SkRect& maskRect, | 639 const SkRect& maskRect, |
| 636 GrPaint* grp, | 640 GrPaint* grp, |
| 637 GrTexture* mask) { | 641 GrTexture* mask) { |
| 638 SkMatrix matrix; | 642 SkMatrix matrix; |
| 639 matrix.setTranslate(-maskRect.fLeft, -maskRect.fTop); | 643 matrix.setTranslate(-maskRect.fLeft, -maskRect.fTop); |
| 640 matrix.postIDiv(mask->width(), mask->height()); | 644 matrix.postIDiv(mask->width(), mask->height()); |
| 641 | 645 |
| 642 grp->addCoverageProcessor(GrSimpleTextureEffect::Create(mask, matrix, | 646 grp->addCoverageProcessor(GrSimpleTextureEffect::Create(mask, matrix, |
| 643 kDevice_GrCoordSet))
->unref(); | 647 kDevice_GrCoordSet))
->unref(); |
| 644 | 648 |
| 645 SkMatrix inverse; | 649 SkMatrix inverse; |
| 646 if (!viewMatrix.invert(&inverse)) { | 650 if (!viewMatrix.invert(&inverse)) { |
| 647 return false; | 651 return false; |
| 648 } | 652 } |
| 649 context->drawNonAARectWithLocalMatrix(rt, clip, *grp, SkMatrix::I(), maskRec
t, inverse); | 653 drawContext->drawNonAARectWithLocalMatrix(rt, clip, *grp, SkMatrix::I(), mas
kRect, inverse); |
| 650 return true; | 654 return true; |
| 651 } | 655 } |
| 652 | 656 |
| 653 static bool clip_bounds_quick_reject(const SkIRect& clipBounds, const SkIRect& r
ect) { | 657 static bool clip_bounds_quick_reject(const SkIRect& clipBounds, const SkIRect& r
ect) { |
| 654 return clipBounds.isEmpty() || rect.isEmpty() || !SkIRect::Intersects(clipBo
unds, rect); | 658 return clipBounds.isEmpty() || rect.isEmpty() || !SkIRect::Intersects(clipBo
unds, rect); |
| 655 } | 659 } |
| 656 | 660 |
| 657 bool draw_with_mask_filter(GrContext* context, | 661 bool draw_with_mask_filter(GrDrawContext* drawContext, |
| 662 GrTextureProvider* textureProvider, |
| 658 GrRenderTarget* rt, | 663 GrRenderTarget* rt, |
| 659 const GrClip& clipData, | 664 const GrClip& clipData, |
| 660 const SkMatrix& viewMatrix, | 665 const SkMatrix& viewMatrix, |
| 661 const SkPath& devPath, | 666 const SkPath& devPath, |
| 662 SkMaskFilter* filter, | 667 SkMaskFilter* filter, |
| 663 const SkIRect& clipBounds, | 668 const SkIRect& clipBounds, |
| 664 GrPaint* grp, | 669 GrPaint* grp, |
| 665 SkPaint::Style style) { | 670 SkPaint::Style style) { |
| 666 SkMask srcM, dstM; | 671 SkMask srcM, dstM; |
| 667 | 672 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 681 return false; | 686 return false; |
| 682 } | 687 } |
| 683 | 688 |
| 684 // we now have a device-aligned 8bit mask in dstM, ready to be drawn using | 689 // we now have a device-aligned 8bit mask in dstM, ready to be drawn using |
| 685 // the current clip (and identity matrix) and GrPaint settings | 690 // the current clip (and identity matrix) and GrPaint settings |
| 686 GrSurfaceDesc desc; | 691 GrSurfaceDesc desc; |
| 687 desc.fWidth = dstM.fBounds.width(); | 692 desc.fWidth = dstM.fBounds.width(); |
| 688 desc.fHeight = dstM.fBounds.height(); | 693 desc.fHeight = dstM.fBounds.height(); |
| 689 desc.fConfig = kAlpha_8_GrPixelConfig; | 694 desc.fConfig = kAlpha_8_GrPixelConfig; |
| 690 | 695 |
| 691 SkAutoTUnref<GrTexture> texture(context->textureProvider()->refScratchTextur
e( | 696 SkAutoTUnref<GrTexture> texture(textureProvider->refScratchTexture( |
| 692 desc, GrTextureProvider::kApprox_ScratchTexMatch)); | 697 desc, GrTextureProvider::kApprox_ScratchTexMatch)); |
| 693 if (!texture) { | 698 if (!texture) { |
| 694 return false; | 699 return false; |
| 695 } | 700 } |
| 696 texture->writePixels(0, 0, desc.fWidth, desc.fHeight, desc.fConfig, | 701 texture->writePixels(0, 0, desc.fWidth, desc.fHeight, desc.fConfig, |
| 697 dstM.fImage, dstM.fRowBytes); | 702 dstM.fImage, dstM.fRowBytes); |
| 698 | 703 |
| 699 SkRect maskRect = SkRect::Make(dstM.fBounds); | 704 SkRect maskRect = SkRect::Make(dstM.fBounds); |
| 700 | 705 |
| 701 return draw_mask(context, rt, clipData, viewMatrix, maskRect, grp, texture); | 706 return draw_mask(drawContext, rt, clipData, viewMatrix, maskRect, grp, textu
re); |
| 702 } | 707 } |
| 703 | 708 |
| 704 // Create a mask of 'devPath' and place the result in 'mask'. | 709 // Create a mask of 'devPath' and place the result in 'mask'. |
| 705 GrTexture* create_mask_GPU(GrContext* context, | 710 GrTexture* create_mask_GPU(GrContext* context, |
| 706 GrRenderTarget* rt, | |
| 707 const SkRect& maskRect, | 711 const SkRect& maskRect, |
| 708 const SkPath& devPath, | 712 const SkPath& devPath, |
| 709 const GrStrokeInfo& strokeInfo, | 713 const GrStrokeInfo& strokeInfo, |
| 710 bool doAA, | 714 bool doAA, |
| 711 int sampleCnt) { | 715 int sampleCnt) { |
| 712 GrSurfaceDesc desc; | 716 GrSurfaceDesc desc; |
| 713 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 717 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
| 714 desc.fWidth = SkScalarCeilToInt(maskRect.width()); | 718 desc.fWidth = SkScalarCeilToInt(maskRect.width()); |
| 715 desc.fHeight = SkScalarCeilToInt(maskRect.height()); | 719 desc.fHeight = SkScalarCeilToInt(maskRect.height()); |
| 716 desc.fSampleCnt = doAA ? sampleCnt : 0; | 720 desc.fSampleCnt = doAA ? sampleCnt : 0; |
| 717 // We actually only need A8, but it often isn't supported as a | 721 // We actually only need A8, but it often isn't supported as a |
| 718 // render target so default to RGBA_8888 | 722 // render target so default to RGBA_8888 |
| 719 desc.fConfig = kRGBA_8888_GrPixelConfig; | 723 desc.fConfig = kRGBA_8888_GrPixelConfig; |
| 720 | 724 |
| 721 if (context->isConfigRenderable(kAlpha_8_GrPixelConfig, | 725 if (context->isConfigRenderable(kAlpha_8_GrPixelConfig, |
| 722 desc.fSampleCnt > 0)) { | 726 desc.fSampleCnt > 0)) { |
| 723 desc.fConfig = kAlpha_8_GrPixelConfig; | 727 desc.fConfig = kAlpha_8_GrPixelConfig; |
| 724 } | 728 } |
| 725 | 729 |
| 726 GrTexture* mask = context->textureProvider()->refScratchTexture( | 730 GrTexture* mask = context->textureProvider()->refScratchTexture( |
| 727 desc, GrTextureProvider::kApprox_ScratchTexMatch); | 731 desc, GrTextureProvider::kApprox_ScratchTexMatch); |
| 728 if (NULL == mask) { | 732 if (NULL == mask) { |
| 729 return NULL; | 733 return NULL; |
| 730 } | 734 } |
| 731 | 735 |
| 732 SkRect clipRect = SkRect::MakeWH(maskRect.width(), maskRect.height()); | 736 SkRect clipRect = SkRect::MakeWH(maskRect.width(), maskRect.height()); |
| 733 | 737 |
| 734 context->clear(NULL, 0x0, true, mask->asRenderTarget()); | 738 GrDrawContext* drawContext = context->drawContext(); |
| 739 if (!drawContext) { |
| 740 return NULL; |
| 741 } |
| 742 |
| 743 drawContext->clear(mask->asRenderTarget(), NULL, 0x0, true); |
| 735 | 744 |
| 736 GrPaint tempPaint; | 745 GrPaint tempPaint; |
| 737 tempPaint.setAntiAlias(doAA); | 746 tempPaint.setAntiAlias(doAA); |
| 738 tempPaint.setCoverageSetOpXPFactory(SkRegion::kReplace_Op); | 747 tempPaint.setCoverageSetOpXPFactory(SkRegion::kReplace_Op); |
| 739 | 748 |
| 740 // setup new clip | 749 // setup new clip |
| 741 GrClip clip(clipRect); | 750 GrClip clip(clipRect); |
| 742 | 751 |
| 743 // Draw the mask into maskTexture with the path's top-left at the origin usi
ng tempPaint. | 752 // Draw the mask into maskTexture with the path's top-left at the origin usi
ng tempPaint. |
| 744 SkMatrix translate; | 753 SkMatrix translate; |
| 745 translate.setTranslate(-maskRect.fLeft, -maskRect.fTop); | 754 translate.setTranslate(-maskRect.fLeft, -maskRect.fTop); |
| 746 context->drawPath(mask->asRenderTarget(), clip, tempPaint, translate, devPat
h, strokeInfo); | 755 drawContext->drawPath(mask->asRenderTarget(), clip, tempPaint, translate, de
vPath, strokeInfo); |
| 747 return mask; | 756 return mask; |
| 748 } | 757 } |
| 749 | 758 |
| 750 SkBitmap wrap_texture(GrTexture* texture, int width, int height) { | 759 SkBitmap wrap_texture(GrTexture* texture, int width, int height) { |
| 751 SkBitmap result; | 760 SkBitmap result; |
| 752 result.setInfo(SkImageInfo::MakeN32Premul(width, height)); | 761 result.setInfo(SkImageInfo::MakeN32Premul(width, height)); |
| 753 result.setPixelRef(SkNEW_ARGS(SkGrPixelRef, (result.info(), texture)))->unre
f(); | 762 result.setPixelRef(SkNEW_ARGS(SkGrPixelRef, (result.info(), texture)))->unre
f(); |
| 754 return result; | 763 return result; |
| 755 } | 764 } |
| 756 | 765 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 viewMatrix, | 873 viewMatrix, |
| 865 strokeInfo, | 874 strokeInfo, |
| 866 *devPathPtr)) { | 875 *devPathPtr)) { |
| 867 // the mask filter was able to draw itself directly, so there's
nothing | 876 // the mask filter was able to draw itself directly, so there's
nothing |
| 868 // left to do. | 877 // left to do. |
| 869 return; | 878 return; |
| 870 } | 879 } |
| 871 | 880 |
| 872 | 881 |
| 873 SkAutoTUnref<GrTexture> mask(create_mask_GPU(fContext, | 882 SkAutoTUnref<GrTexture> mask(create_mask_GPU(fContext, |
| 874 fRenderTarget, | |
| 875 maskRect, | 883 maskRect, |
| 876 *devPathPtr, | 884 *devPathPtr, |
| 877 strokeInfo, | 885 strokeInfo, |
| 878 grPaint.isAntiAlias(), | 886 grPaint.isAntiAlias(), |
| 879 fRenderTarget->numSampl
es())); | 887 fRenderTarget->numSampl
es())); |
| 880 if (mask) { | 888 if (mask) { |
| 881 GrTexture* filtered; | 889 GrTexture* filtered; |
| 882 | 890 |
| 883 if (paint.getMaskFilter()->filterMaskGPU(mask, viewMatrix, maskR
ect, &filtered, true)) { | 891 if (paint.getMaskFilter()->filterMaskGPU(mask, viewMatrix, maskR
ect, &filtered, true)) { |
| 884 // filterMaskGPU gives us ownership of a ref to the result | 892 // filterMaskGPU gives us ownership of a ref to the result |
| 885 SkAutoTUnref<GrTexture> atu(filtered); | 893 SkAutoTUnref<GrTexture> atu(filtered); |
| 886 if (draw_mask(fContext, | 894 if (draw_mask(fDrawContext, |
| 887 fRenderTarget, | 895 fRenderTarget, |
| 888 fClip, | 896 fClip, |
| 889 viewMatrix, | 897 viewMatrix, |
| 890 maskRect, | 898 maskRect, |
| 891 &grPaint, | 899 &grPaint, |
| 892 filtered)) { | 900 filtered)) { |
| 893 // This path is completely drawn | 901 // This path is completely drawn |
| 894 return; | 902 return; |
| 895 } | 903 } |
| 896 } | 904 } |
| 897 } | 905 } |
| 898 } | 906 } |
| 899 | 907 |
| 900 // draw the mask on the CPU - this is a fallthrough path in case the | 908 // draw the mask on the CPU - this is a fallthrough path in case the |
| 901 // GPU path fails | 909 // GPU path fails |
| 902 SkPaint::Style style = strokeInfo.isHairlineStyle() ? SkPaint::kStroke_S
tyle : | 910 SkPaint::Style style = strokeInfo.isHairlineStyle() ? SkPaint::kStroke_S
tyle : |
| 903 SkPaint::kFill_Sty
le; | 911 SkPaint::kFill_Sty
le; |
| 904 draw_with_mask_filter(fContext, fRenderTarget, fClip, viewMatrix, *devPa
thPtr, | 912 draw_with_mask_filter(fDrawContext, fContext->textureProvider(), fRender
Target, |
| 913 fClip, viewMatrix, *devPathPtr, |
| 905 paint.getMaskFilter(), clipBounds, &grPaint, style
); | 914 paint.getMaskFilter(), clipBounds, &grPaint, style
); |
| 906 return; | 915 return; |
| 907 } | 916 } |
| 908 | 917 |
| 909 fContext->drawPath(fRenderTarget, fClip, grPaint, viewMatrix, *pathPtr, stro
keInfo); | 918 fDrawContext->drawPath(fRenderTarget, fClip, grPaint, viewMatrix, *pathPtr,
strokeInfo); |
| 910 } | 919 } |
| 911 | 920 |
| 912 static const int kBmpSmallTileSize = 1 << 10; | 921 static const int kBmpSmallTileSize = 1 << 10; |
| 913 | 922 |
| 914 static inline int get_tile_count(const SkIRect& srcRect, int tileSize) { | 923 static inline int get_tile_count(const SkIRect& srcRect, int tileSize) { |
| 915 int tilesX = (srcRect.fRight / tileSize) - (srcRect.fLeft / tileSize) + 1; | 924 int tilesX = (srcRect.fRight / tileSize) - (srcRect.fLeft / tileSize) + 1; |
| 916 int tilesY = (srcRect.fBottom / tileSize) - (srcRect.fTop / tileSize) + 1; | 925 int tilesY = (srcRect.fBottom / tileSize) - (srcRect.fTop / tileSize) + 1; |
| 917 return tilesX * tilesY; | 926 return tilesX * tilesY; |
| 918 } | 927 } |
| 919 | 928 |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1486 GrPaint grPaint; | 1495 GrPaint grPaint; |
| 1487 grPaint.addColorProcessor(fp); | 1496 grPaint.addColorProcessor(fp); |
| 1488 bool alphaOnly = !(kAlpha_8_SkColorType == bitmap.colorType()); | 1497 bool alphaOnly = !(kAlpha_8_SkColorType == bitmap.colorType()); |
| 1489 GrColor paintColor = (alphaOnly) ? SkColor2GrColorJustAlpha(paint.getColor()
) : | 1498 GrColor paintColor = (alphaOnly) ? SkColor2GrColorJustAlpha(paint.getColor()
) : |
| 1490 SkColor2GrColor(paint.getColor()); | 1499 SkColor2GrColor(paint.getColor()); |
| 1491 if (!SkPaint2GrPaintNoShader(this->context(), fRenderTarget, paint, paintCol
or, false, | 1500 if (!SkPaint2GrPaintNoShader(this->context(), fRenderTarget, paint, paintCol
or, false, |
| 1492 &grPaint)) { | 1501 &grPaint)) { |
| 1493 return; | 1502 return; |
| 1494 } | 1503 } |
| 1495 | 1504 |
| 1496 fContext->drawNonAARectToRect(fRenderTarget, fClip, grPaint, viewMatrix, dst
Rect, | 1505 fDrawContext->drawNonAARectToRect(fRenderTarget, fClip, grPaint, viewMatrix,
dstRect, |
| 1497 paintRect); | 1506 paintRect); |
| 1498 } | 1507 } |
| 1499 | 1508 |
| 1500 bool SkGpuDevice::filterTexture(GrContext* context, GrTexture* texture, | 1509 bool SkGpuDevice::filterTexture(GrContext* context, GrTexture* texture, |
| 1501 int width, int height, | 1510 int width, int height, |
| 1502 const SkImageFilter* filter, | 1511 const SkImageFilter* filter, |
| 1503 const SkImageFilter::Context& ctx, | 1512 const SkImageFilter::Context& ctx, |
| 1504 SkBitmap* result, SkIPoint* offset) { | 1513 SkBitmap* result, SkIPoint* offset) { |
| 1505 SkASSERT(filter); | 1514 SkASSERT(filter); |
| 1506 | 1515 |
| 1507 // FIXME: plumb actual surface props such that we don't have to lie about th
e flags here | 1516 // FIXME: plumb actual surface props such that we don't have to lie about th
e flags here |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1562 } | 1571 } |
| 1563 | 1572 |
| 1564 GrPaint grPaint; | 1573 GrPaint grPaint; |
| 1565 grPaint.addColorTextureProcessor(texture, SkMatrix::I()); | 1574 grPaint.addColorTextureProcessor(texture, SkMatrix::I()); |
| 1566 | 1575 |
| 1567 if (!SkPaint2GrPaintNoShader(this->context(), fRenderTarget, paint, | 1576 if (!SkPaint2GrPaintNoShader(this->context(), fRenderTarget, paint, |
| 1568 SkColor2GrColorJustAlpha(paint.getColor()), fal
se, &grPaint)) { | 1577 SkColor2GrColorJustAlpha(paint.getColor()), fal
se, &grPaint)) { |
| 1569 return; | 1578 return; |
| 1570 } | 1579 } |
| 1571 | 1580 |
| 1572 fContext->drawNonAARectToRect(fRenderTarget, | 1581 fDrawContext->drawNonAARectToRect(fRenderTarget, |
| 1573 fClip, | 1582 fClip, |
| 1574 grPaint, | 1583 grPaint, |
| 1575 SkMatrix::I(), | 1584 SkMatrix::I(), |
| 1576 SkRect::MakeXYWH(SkIntToScalar(left), | 1585 SkRect::MakeXYWH(SkIntToScalar(left), |
| 1577 SkIntToScalar(top), | 1586 SkIntToScalar(top), |
| 1578 SkIntToScalar(w), | 1587 SkIntToScalar(w), |
| 1579 SkIntToScalar(h)), | 1588 SkIntToScalar(h)), |
| 1580 SkRect::MakeXYWH(0, | 1589 SkRect::MakeXYWH(0, |
| 1581 0, | 1590 0, |
| 1582 SK_Scalar1 * w / texture->wid
th(), | 1591 SK_Scalar1 * w / texture-
>width(), |
| 1583 SK_Scalar1 * h / texture->hei
ght())); | 1592 SK_Scalar1 * h / texture-
>height())); |
| 1584 } | 1593 } |
| 1585 | 1594 |
| 1586 void SkGpuDevice::drawBitmapRect(const SkDraw& origDraw, const SkBitmap& bitmap, | 1595 void SkGpuDevice::drawBitmapRect(const SkDraw& origDraw, const SkBitmap& bitmap, |
| 1587 const SkRect* src, const SkRect& dst, | 1596 const SkRect* src, const SkRect& dst, |
| 1588 const SkPaint& paint, | 1597 const SkPaint& paint, |
| 1589 SkCanvas::DrawBitmapRectFlags flags) { | 1598 SkCanvas::DrawBitmapRectFlags flags) { |
| 1590 SkMatrix matrix; | 1599 SkMatrix matrix; |
| 1591 SkRect bitmapBounds, tmpSrc; | 1600 SkRect bitmapBounds, tmpSrc; |
| 1592 | 1601 |
| 1593 bitmapBounds.set(0, 0, | 1602 bitmapBounds.set(0, 0, |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1688 SkRect dstRect = SkRect::MakeXYWH(SkIntToScalar(x), | 1697 SkRect dstRect = SkRect::MakeXYWH(SkIntToScalar(x), |
| 1689 SkIntToScalar(y), | 1698 SkIntToScalar(y), |
| 1690 SkIntToScalar(w), | 1699 SkIntToScalar(w), |
| 1691 SkIntToScalar(h)); | 1700 SkIntToScalar(h)); |
| 1692 | 1701 |
| 1693 // The device being drawn may not fill up its texture (e.g. saveLayer uses a
pproximate | 1702 // The device being drawn may not fill up its texture (e.g. saveLayer uses a
pproximate |
| 1694 // scratch texture). | 1703 // scratch texture). |
| 1695 SkRect srcRect = SkRect::MakeWH(SK_Scalar1 * w / devTex->width(), | 1704 SkRect srcRect = SkRect::MakeWH(SK_Scalar1 * w / devTex->width(), |
| 1696 SK_Scalar1 * h / devTex->height()); | 1705 SK_Scalar1 * h / devTex->height()); |
| 1697 | 1706 |
| 1698 fContext->drawNonAARectToRect(fRenderTarget, fClip, grPaint, SkMatrix::I(),
dstRect, | 1707 fDrawContext->drawNonAARectToRect(fRenderTarget, fClip, grPaint, SkMatrix::I
(), dstRect, |
| 1699 srcRect); | 1708 srcRect); |
| 1700 } | 1709 } |
| 1701 | 1710 |
| 1702 bool SkGpuDevice::canHandleImageFilter(const SkImageFilter* filter) { | 1711 bool SkGpuDevice::canHandleImageFilter(const SkImageFilter* filter) { |
| 1703 return filter->canFilterImageGPU(); | 1712 return filter->canFilterImageGPU(); |
| 1704 } | 1713 } |
| 1705 | 1714 |
| 1706 bool SkGpuDevice::filterImage(const SkImageFilter* filter, const SkBitmap& src, | 1715 bool SkGpuDevice::filterImage(const SkImageFilter* filter, const SkBitmap& src, |
| 1707 const SkImageFilter::Context& ctx, | 1716 const SkImageFilter::Context& ctx, |
| 1708 SkBitmap* result, SkIPoint* offset) { | 1717 SkBitmap* result, SkIPoint* offset) { |
| 1709 // want explicitly our impl, so guard against a subclass of us overriding it | 1718 // want explicitly our impl, so guard against a subclass of us overriding it |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1858 SkColor color; | 1867 SkColor color; |
| 1859 for (int i = 0; i < vertexCount; ++i) { | 1868 for (int i = 0; i < vertexCount; ++i) { |
| 1860 color = colors[i]; | 1869 color = colors[i]; |
| 1861 if (paint.getAlpha() != 255) { | 1870 if (paint.getAlpha() != 255) { |
| 1862 color = SkColorSetA(color, SkMulDiv255Round(SkColorGetA(color),
paint.getAlpha())); | 1871 color = SkColorSetA(color, SkMulDiv255Round(SkColorGetA(color),
paint.getAlpha())); |
| 1863 } | 1872 } |
| 1864 convertedColors[i] = SkColor2GrColor(color); | 1873 convertedColors[i] = SkColor2GrColor(color); |
| 1865 } | 1874 } |
| 1866 colors = convertedColors.get(); | 1875 colors = convertedColors.get(); |
| 1867 } | 1876 } |
| 1868 fContext->drawVertices(fRenderTarget, | 1877 fDrawContext->drawVertices(fRenderTarget, |
| 1869 fClip, | 1878 fClip, |
| 1870 grPaint, | 1879 grPaint, |
| 1871 *draw.fMatrix, | 1880 *draw.fMatrix, |
| 1872 primType, | 1881 primType, |
| 1873 vertexCount, | 1882 vertexCount, |
| 1874 vertices, | 1883 vertices, |
| 1875 texs, | 1884 texs, |
| 1876 colors, | 1885 colors, |
| 1877 outIndices, | 1886 outIndices, |
| 1878 indexCount); | 1887 indexCount); |
| 1879 } | 1888 } |
| 1880 | 1889 |
| 1881 /////////////////////////////////////////////////////////////////////////////// | 1890 /////////////////////////////////////////////////////////////////////////////// |
| 1882 | 1891 |
| 1883 void SkGpuDevice::drawText(const SkDraw& draw, const void* text, | 1892 void SkGpuDevice::drawText(const SkDraw& draw, const void* text, |
| 1884 size_t byteLength, SkScalar x, SkScalar y, | 1893 size_t byteLength, SkScalar x, SkScalar y, |
| 1885 const SkPaint& paint) { | 1894 const SkPaint& paint) { |
| 1886 CHECK_SHOULD_DRAW(draw); | 1895 CHECK_SHOULD_DRAW(draw); |
| 1887 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawText", fContext); | 1896 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawText", fContext); |
| 1888 | 1897 |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2055 #endif | 2064 #endif |
| 2056 } | 2065 } |
| 2057 | 2066 |
| 2058 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { | 2067 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { |
| 2059 // We always return a transient cache, so it is freed after each | 2068 // We always return a transient cache, so it is freed after each |
| 2060 // filter traversal. | 2069 // filter traversal. |
| 2061 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); | 2070 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); |
| 2062 } | 2071 } |
| 2063 | 2072 |
| 2064 #endif | 2073 #endif |
| OLD | NEW |