Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: src/gpu/SkGpuDevice.cpp

Issue 956083002: Revert of Pass clip to context (Closed) Base URL: https://skia.googlesource.com/skia.git@pass_down_rendertarget
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/SkGpuDevice.h ('k') | src/gpu/SkGr.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "GrBitmapTextContext.h" 10 #include "GrBitmapTextContext.h"
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 return SkNEW_ARGS(SkGpuDevice, (rt, props, flags)); 213 return SkNEW_ARGS(SkGpuDevice, (rt, props, flags));
214 } 214 }
215 215
216 SkGpuDevice::~SkGpuDevice() { 216 SkGpuDevice::~SkGpuDevice() {
217 if (fDrawProcs) { 217 if (fDrawProcs) {
218 delete fDrawProcs; 218 delete fDrawProcs;
219 } 219 }
220 220
221 delete fTextContext; 221 delete fTextContext;
222 222
223 if (fContext->getClip() == &fClipData) {
224 fContext->setClip(NULL);
225 }
226
223 fRenderTarget->unref(); 227 fRenderTarget->unref();
224 fContext->unref(); 228 fContext->unref();
225 } 229 }
226 230
227 /////////////////////////////////////////////////////////////////////////////// 231 ///////////////////////////////////////////////////////////////////////////////
228 232
229 bool SkGpuDevice::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size _t dstRowBytes, 233 bool SkGpuDevice::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size _t dstRowBytes,
230 int x, int y) { 234 int x, int y) {
231 DO_DEFERRED_CLEAR(); 235 DO_DEFERRED_CLEAR();
232 236
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 274
271 void SkGpuDevice::onAttachToCanvas(SkCanvas* canvas) { 275 void SkGpuDevice::onAttachToCanvas(SkCanvas* canvas) {
272 INHERITED::onAttachToCanvas(canvas); 276 INHERITED::onAttachToCanvas(canvas);
273 277
274 // Canvas promises that this ptr is valid until onDetachFromCanvas is called 278 // Canvas promises that this ptr is valid until onDetachFromCanvas is called
275 fClipStack.reset(SkRef(canvas->getClipStack())); 279 fClipStack.reset(SkRef(canvas->getClipStack()));
276 } 280 }
277 281
278 void SkGpuDevice::onDetachFromCanvas() { 282 void SkGpuDevice::onDetachFromCanvas() {
279 INHERITED::onDetachFromCanvas(); 283 INHERITED::onDetachFromCanvas();
280 fClip.reset(); 284 fClipData.reset();
281 fClipStack.reset(NULL); 285 fClipStack.reset(NULL);
282 } 286 }
283 287
284 // call this every draw call, to ensure that the context reflects our state, 288 // call this every draw call, to ensure that the context reflects our state,
285 // and not the state from some other canvas/device 289 // and not the state from some other canvas/device
286 void SkGpuDevice::prepareDraw(const SkDraw& draw) { 290 void SkGpuDevice::prepareDraw(const SkDraw& draw) {
287 SkASSERT(fClipStack.get()); 291 SkASSERT(fClipStack.get());
288 292
289 SkASSERT(draw.fClipStack && draw.fClipStack == fClipStack); 293 SkASSERT(draw.fClipStack && draw.fClipStack == fClipStack);
290 294
291 fClip.setClipStack(fClipStack, &this->getOrigin()); 295 fClipData.setClipStack(fClipStack, &this->getOrigin());
296
297 fContext->setClip(&fClipData);
292 298
293 DO_DEFERRED_CLEAR(); 299 DO_DEFERRED_CLEAR();
294 } 300 }
295 301
296 GrRenderTarget* SkGpuDevice::accessRenderTarget() { 302 GrRenderTarget* SkGpuDevice::accessRenderTarget() {
297 DO_DEFERRED_CLEAR(); 303 DO_DEFERRED_CLEAR();
298 return fRenderTarget; 304 return fRenderTarget;
299 } 305 }
300 306
301 void SkGpuDevice::clearAll() { 307 void SkGpuDevice::clearAll() {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 359
354 /////////////////////////////////////////////////////////////////////////////// 360 ///////////////////////////////////////////////////////////////////////////////
355 361
356 void SkGpuDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) { 362 void SkGpuDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) {
357 CHECK_SHOULD_DRAW(draw); 363 CHECK_SHOULD_DRAW(draw);
358 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawPaint", fContext); 364 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawPaint", fContext);
359 365
360 GrPaint grPaint; 366 GrPaint grPaint;
361 SkPaint2GrPaintShader(this->context(), fRenderTarget, paint, *draw.fMatrix, true, &grPaint); 367 SkPaint2GrPaintShader(this->context(), fRenderTarget, paint, *draw.fMatrix, true, &grPaint);
362 368
363 fContext->drawPaint(fRenderTarget, fClip, grPaint, *draw.fMatrix); 369 fContext->drawPaint(fRenderTarget, grPaint, *draw.fMatrix);
364 } 370 }
365 371
366 // must be in SkCanvas::PointMode order 372 // must be in SkCanvas::PointMode order
367 static const GrPrimitiveType gPointMode2PrimtiveType[] = { 373 static const GrPrimitiveType gPointMode2PrimtiveType[] = {
368 kPoints_GrPrimitiveType, 374 kPoints_GrPrimitiveType,
369 kLines_GrPrimitiveType, 375 kLines_GrPrimitiveType,
370 kLineStrip_GrPrimitiveType 376 kLineStrip_GrPrimitiveType
371 }; 377 };
372 378
373 void SkGpuDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode, 379 void SkGpuDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode,
374 size_t count, const SkPoint pts[], const SkPaint& p aint) { 380 size_t count, const SkPoint pts[], const SkPaint& p aint) {
375 CHECK_FOR_ANNOTATION(paint); 381 CHECK_FOR_ANNOTATION(paint);
376 CHECK_SHOULD_DRAW(draw); 382 CHECK_SHOULD_DRAW(draw);
377 383
378 SkScalar width = paint.getStrokeWidth(); 384 SkScalar width = paint.getStrokeWidth();
379 if (width < 0) { 385 if (width < 0) {
380 return; 386 return;
381 } 387 }
382 388
383 if (paint.getPathEffect() && 2 == count && SkCanvas::kLines_PointMode == mod e) { 389 if (paint.getPathEffect() && 2 == count && SkCanvas::kLines_PointMode == mod e) {
384 GrStrokeInfo strokeInfo(paint, SkPaint::kStroke_Style); 390 GrStrokeInfo strokeInfo(paint, SkPaint::kStroke_Style);
385 GrPaint grPaint; 391 GrPaint grPaint;
386 SkPaint2GrPaintShader(this->context(), fRenderTarget, paint, *draw.fMatr ix, true, &grPaint); 392 SkPaint2GrPaintShader(this->context(), fRenderTarget, paint, *draw.fMatr ix, true, &grPaint);
387 SkPath path; 393 SkPath path;
388 path.setIsVolatile(true); 394 path.setIsVolatile(true);
389 path.moveTo(pts[0]); 395 path.moveTo(pts[0]);
390 path.lineTo(pts[1]); 396 path.lineTo(pts[1]);
391 fContext->drawPath(fRenderTarget, fClip, grPaint, *draw.fMatrix, path, s trokeInfo); 397 fContext->drawPath(fRenderTarget, grPaint, *draw.fMatrix, path, strokeIn fo);
392 return; 398 return;
393 } 399 }
394 400
395 // we only handle hairlines and paints without path effects or mask filters, 401 // we only handle hairlines and paints without path effects or mask filters,
396 // else we let the SkDraw call our drawPath() 402 // else we let the SkDraw call our drawPath()
397 if (width > 0 || paint.getPathEffect() || paint.getMaskFilter()) { 403 if (width > 0 || paint.getPathEffect() || paint.getMaskFilter()) {
398 draw.drawPoints(mode, count, pts, paint, true); 404 draw.drawPoints(mode, count, pts, paint, true);
399 return; 405 return;
400 } 406 }
401 407
402 GrPaint grPaint; 408 GrPaint grPaint;
403 SkPaint2GrPaintShader(this->context(), fRenderTarget, paint, *draw.fMatrix, true, &grPaint); 409 SkPaint2GrPaintShader(this->context(), fRenderTarget, paint, *draw.fMatrix, true, &grPaint);
404 410
405 fContext->drawVertices(fRenderTarget, 411 fContext->drawVertices(fRenderTarget,
406 fClip,
407 grPaint, 412 grPaint,
408 *draw.fMatrix, 413 *draw.fMatrix,
409 gPointMode2PrimtiveType[mode], 414 gPointMode2PrimtiveType[mode],
410 SkToS32(count), 415 SkToS32(count),
411 (SkPoint*)pts, 416 (SkPoint*)pts,
412 NULL, 417 NULL,
413 NULL, 418 NULL,
414 NULL, 419 NULL,
415 0); 420 0);
416 } 421 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 SkPath path; 472 SkPath path;
468 path.setIsVolatile(true); 473 path.setIsVolatile(true);
469 path.addRect(rect); 474 path.addRect(rect);
470 this->drawPath(draw, path, paint, NULL, true); 475 this->drawPath(draw, path, paint, NULL, true);
471 return; 476 return;
472 } 477 }
473 478
474 GrPaint grPaint; 479 GrPaint grPaint;
475 SkPaint2GrPaintShader(this->context(), fRenderTarget, paint, *draw.fMatrix, true, &grPaint); 480 SkPaint2GrPaintShader(this->context(), fRenderTarget, paint, *draw.fMatrix, true, &grPaint);
476 481
477 fContext->drawRect(fRenderTarget, fClip, grPaint, *draw.fMatrix, rect, &stro keInfo); 482 fContext->drawRect(fRenderTarget, grPaint, *draw.fMatrix, rect, &strokeInfo) ;
478 } 483 }
479 484
480 /////////////////////////////////////////////////////////////////////////////// 485 ///////////////////////////////////////////////////////////////////////////////
481 486
482 void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rect, 487 void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rect,
483 const SkPaint& paint) { 488 const SkPaint& paint) {
484 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawRRect", fContext); 489 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawRRect", fContext);
485 CHECK_FOR_ANNOTATION(paint); 490 CHECK_FOR_ANNOTATION(paint);
486 CHECK_SHOULD_DRAW(draw); 491 CHECK_SHOULD_DRAW(draw);
487 492
(...skipping 14 matching lines...) Expand all
502 &maskRect)) { 507 &maskRect)) {
503 SkIRect finalIRect; 508 SkIRect finalIRect;
504 maskRect.roundOut(&finalIRect); 509 maskRect.roundOut(&finalIRect);
505 if (draw.fClip->quickReject(finalIRect)) { 510 if (draw.fClip->quickReject(finalIRect)) {
506 // clipped out 511 // clipped out
507 return; 512 return;
508 } 513 }
509 if (paint.getMaskFilter()->directFilterRRectMaskGPU(fContext , 514 if (paint.getMaskFilter()->directFilterRRectMaskGPU(fContext ,
510 fRenderT arget, 515 fRenderT arget,
511 &grPaint , 516 &grPaint ,
512 fClip,
513 *draw.fM atrix, 517 *draw.fM atrix,
514 strokeIn fo.getStrokeRec(), 518 strokeIn fo.getStrokeRec(),
515 devRRect )) { 519 devRRect )) {
516 return; 520 return;
517 } 521 }
518 } 522 }
519 523
520 } 524 }
521 } 525 }
522 526
(...skipping 12 matching lines...) Expand all
535 539
536 540
537 if (usePath) { 541 if (usePath) {
538 SkPath path; 542 SkPath path;
539 path.setIsVolatile(true); 543 path.setIsVolatile(true);
540 path.addRRect(rect); 544 path.addRRect(rect);
541 this->drawPath(draw, path, paint, NULL, true); 545 this->drawPath(draw, path, paint, NULL, true);
542 return; 546 return;
543 } 547 }
544 548
545 fContext->drawRRect(fRenderTarget, fClip, grPaint, *draw.fMatrix, rect, stro keInfo); 549 fContext->drawRRect(fRenderTarget, grPaint, *draw.fMatrix, rect, strokeInfo) ;
546 } 550 }
547 551
548 void SkGpuDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer, 552 void SkGpuDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer,
549 const SkRRect& inner, const SkPaint& paint) { 553 const SkRRect& inner, const SkPaint& paint) {
550 SkStrokeRec stroke(paint); 554 SkStrokeRec stroke(paint);
551 if (stroke.isFillStyle()) { 555 if (stroke.isFillStyle()) {
552 556
553 CHECK_FOR_ANNOTATION(paint); 557 CHECK_FOR_ANNOTATION(paint);
554 CHECK_SHOULD_DRAW(draw); 558 CHECK_SHOULD_DRAW(draw);
555 559
556 GrPaint grPaint; 560 GrPaint grPaint;
557 SkPaint2GrPaintShader(this->context(), fRenderTarget, paint, *draw.fMatr ix, true, &grPaint); 561 SkPaint2GrPaintShader(this->context(), fRenderTarget, paint, *draw.fMatr ix, true, &grPaint);
558 562
559 if (NULL == paint.getMaskFilter() && NULL == paint.getPathEffect()) { 563 if (NULL == paint.getMaskFilter() && NULL == paint.getPathEffect()) {
560 fContext->drawDRRect(fRenderTarget, fClip, grPaint, *draw.fMatrix, o uter, inner); 564 fContext->drawDRRect(fRenderTarget, grPaint, *draw.fMatrix, outer, i nner);
561 return; 565 return;
562 } 566 }
563 } 567 }
564 568
565 SkPath path; 569 SkPath path;
566 path.setIsVolatile(true); 570 path.setIsVolatile(true);
567 path.addRRect(outer); 571 path.addRRect(outer);
568 path.addRRect(inner); 572 path.addRRect(inner);
569 path.setFillType(SkPath::kEvenOdd_FillType); 573 path.setFillType(SkPath::kEvenOdd_FillType);
570 574
(...skipping 26 matching lines...) Expand all
597 SkPath path; 601 SkPath path;
598 path.setIsVolatile(true); 602 path.setIsVolatile(true);
599 path.addOval(oval); 603 path.addOval(oval);
600 this->drawPath(draw, path, paint, NULL, true); 604 this->drawPath(draw, path, paint, NULL, true);
601 return; 605 return;
602 } 606 }
603 607
604 GrPaint grPaint; 608 GrPaint grPaint;
605 SkPaint2GrPaintShader(this->context(), fRenderTarget, paint, *draw.fMatrix, true, &grPaint); 609 SkPaint2GrPaintShader(this->context(), fRenderTarget, paint, *draw.fMatrix, true, &grPaint);
606 610
607 fContext->drawOval(fRenderTarget, fClip, grPaint, *draw.fMatrix, oval, strok eInfo); 611 fContext->drawOval(fRenderTarget, grPaint, *draw.fMatrix, oval, strokeInfo);
608 } 612 }
609 613
610 #include "SkMaskFilter.h" 614 #include "SkMaskFilter.h"
611 615
612 /////////////////////////////////////////////////////////////////////////////// 616 ///////////////////////////////////////////////////////////////////////////////
613 617
614 // helpers for applying mask filters 618 // helpers for applying mask filters
615 namespace { 619 namespace {
616 620
617 // Draw a mask using the supplied paint. Since the coverage/geometry 621 // Draw a mask using the supplied paint. Since the coverage/geometry
618 // is already burnt into the mask this boils down to a rect draw. 622 // is already burnt into the mask this boils down to a rect draw.
619 // Return true if the mask was successfully drawn. 623 // Return true if the mask was successfully drawn.
620 bool draw_mask(GrContext* context, 624 bool draw_mask(GrContext* context,
621 GrRenderTarget* rt, 625 GrRenderTarget* rt,
622 const GrClip& clip,
623 const SkMatrix& viewMatrix, 626 const SkMatrix& viewMatrix,
624 const SkRect& maskRect, 627 const SkRect& maskRect,
625 GrPaint* grp, 628 GrPaint* grp,
626 GrTexture* mask) { 629 GrTexture* mask) {
627 SkMatrix matrix; 630 SkMatrix matrix;
628 matrix.setTranslate(-maskRect.fLeft, -maskRect.fTop); 631 matrix.setTranslate(-maskRect.fLeft, -maskRect.fTop);
629 matrix.postIDiv(mask->width(), mask->height()); 632 matrix.postIDiv(mask->width(), mask->height());
630 633
631 grp->addCoverageProcessor(GrSimpleTextureEffect::Create(mask, matrix, 634 grp->addCoverageProcessor(GrSimpleTextureEffect::Create(mask, matrix,
632 kDevice_GrCoordSet)) ->unref(); 635 kDevice_GrCoordSet)) ->unref();
633 636
634 SkMatrix inverse; 637 SkMatrix inverse;
635 if (!viewMatrix.invert(&inverse)) { 638 if (!viewMatrix.invert(&inverse)) {
636 return false; 639 return false;
637 } 640 }
638 context->drawNonAARectWithLocalMatrix(rt, clip, *grp, SkMatrix::I(), maskRec t, inverse); 641 context->drawNonAARectWithLocalMatrix(rt, *grp, SkMatrix::I(), maskRect, inv erse);
639 return true; 642 return true;
640 } 643 }
641 644
642 bool draw_with_mask_filter(GrContext* context, 645 bool draw_with_mask_filter(GrContext* context,
643 GrRenderTarget* rt, 646 GrRenderTarget* rt,
644 const GrClip& clipData,
645 const SkMatrix& viewMatrix, 647 const SkMatrix& viewMatrix,
646 const SkPath& devPath, 648 const SkPath& devPath,
647 SkMaskFilter* filter, 649 SkMaskFilter* filter,
648 const SkRegion& clip, 650 const SkRegion& clip,
649 GrPaint* grp, 651 GrPaint* grp,
650 SkPaint::Style style) { 652 SkPaint::Style style) {
651 SkMask srcM, dstM; 653 SkMask srcM, dstM;
652 654
653 if (!SkDraw::DrawToMask(devPath, &clip.getBounds(), filter, &viewMatrix, &sr cM, 655 if (!SkDraw::DrawToMask(devPath, &clip.getBounds(), filter, &viewMatrix, &sr cM,
654 SkMask::kComputeBoundsAndRenderImage_CreateMode, sty le)) { 656 SkMask::kComputeBoundsAndRenderImage_CreateMode, sty le)) {
(...skipping 21 matching lines...) Expand all
676 SkAutoTUnref<GrTexture> texture( 678 SkAutoTUnref<GrTexture> texture(
677 context->refScratchTexture(desc, GrContext::kApprox_ScratchTexMatch)); 679 context->refScratchTexture(desc, GrContext::kApprox_ScratchTexMatch));
678 if (!texture) { 680 if (!texture) {
679 return false; 681 return false;
680 } 682 }
681 texture->writePixels(0, 0, desc.fWidth, desc.fHeight, desc.fConfig, 683 texture->writePixels(0, 0, desc.fWidth, desc.fHeight, desc.fConfig,
682 dstM.fImage, dstM.fRowBytes); 684 dstM.fImage, dstM.fRowBytes);
683 685
684 SkRect maskRect = SkRect::Make(dstM.fBounds); 686 SkRect maskRect = SkRect::Make(dstM.fBounds);
685 687
686 return draw_mask(context, rt, clipData, viewMatrix, maskRect, grp, texture); 688 return draw_mask(context, rt, viewMatrix, maskRect, grp, texture);
687 } 689 }
688 690
689 // Create a mask of 'devPath' and place the result in 'mask'. 691 // Create a mask of 'devPath' and place the result in 'mask'.
690 GrTexture* create_mask_GPU(GrContext* context, 692 GrTexture* create_mask_GPU(GrContext* context,
691 GrRenderTarget* rt, 693 GrRenderTarget* rt,
692 const SkRect& maskRect, 694 const SkRect& maskRect,
693 const SkPath& devPath, 695 const SkPath& devPath,
694 const GrStrokeInfo& strokeInfo, 696 const GrStrokeInfo& strokeInfo,
695 bool doAA, 697 bool doAA,
696 int sampleCnt) { 698 int sampleCnt) {
(...skipping 11 matching lines...) Expand all
708 desc.fConfig = kAlpha_8_GrPixelConfig; 710 desc.fConfig = kAlpha_8_GrPixelConfig;
709 } 711 }
710 712
711 GrTexture* mask = context->refScratchTexture(desc,GrContext::kApprox_Scratch TexMatch); 713 GrTexture* mask = context->refScratchTexture(desc,GrContext::kApprox_Scratch TexMatch);
712 if (NULL == mask) { 714 if (NULL == mask) {
713 return NULL; 715 return NULL;
714 } 716 }
715 717
716 SkRect clipRect = SkRect::MakeWH(maskRect.width(), maskRect.height()); 718 SkRect clipRect = SkRect::MakeWH(maskRect.width(), maskRect.height());
717 719
720 GrContext::AutoClip ac(context, clipRect);
721
718 context->clear(NULL, 0x0, true, mask->asRenderTarget()); 722 context->clear(NULL, 0x0, true, mask->asRenderTarget());
719 723
720 GrPaint tempPaint; 724 GrPaint tempPaint;
721 tempPaint.setAntiAlias(doAA); 725 tempPaint.setAntiAlias(doAA);
722 tempPaint.setCoverageSetOpXPFactory(SkRegion::kReplace_Op); 726 tempPaint.setCoverageSetOpXPFactory(SkRegion::kReplace_Op);
723 727
724 // setup new clip
725 GrClip clip(clipRect);
726
727 // Draw the mask into maskTexture with the path's top-left at the origin usi ng tempPaint. 728 // Draw the mask into maskTexture with the path's top-left at the origin usi ng tempPaint.
728 SkMatrix translate; 729 SkMatrix translate;
729 translate.setTranslate(-maskRect.fLeft, -maskRect.fTop); 730 translate.setTranslate(-maskRect.fLeft, -maskRect.fTop);
730 context->drawPath(mask->asRenderTarget(), clip, tempPaint, translate, devPat h, strokeInfo); 731 context->drawPath(mask->asRenderTarget(), tempPaint, translate, devPath, str okeInfo);
731 return mask; 732 return mask;
732 } 733 }
733 734
734 SkBitmap wrap_texture(GrTexture* texture) { 735 SkBitmap wrap_texture(GrTexture* texture) {
735 SkBitmap result; 736 SkBitmap result;
736 result.setInfo(texture->surfacePriv().info()); 737 result.setInfo(texture->surfacePriv().info());
737 result.setPixelRef(SkNEW_ARGS(SkGrPixelRef, (result.info(), texture)))->unre f(); 738 result.setPixelRef(SkNEW_ARGS(SkGrPixelRef, (result.info(), texture)))->unre f();
738 return result; 739 return result;
739 } 740 }
740 741
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 SkIRect finalIRect; 826 SkIRect finalIRect;
826 maskRect.roundOut(&finalIRect); 827 maskRect.roundOut(&finalIRect);
827 if (draw.fClip->quickReject(finalIRect)) { 828 if (draw.fClip->quickReject(finalIRect)) {
828 // clipped out 829 // clipped out
829 return; 830 return;
830 } 831 }
831 832
832 if (paint.getMaskFilter()->directFilterMaskGPU(fContext, 833 if (paint.getMaskFilter()->directFilterMaskGPU(fContext,
833 fRenderTarget, 834 fRenderTarget,
834 &grPaint, 835 &grPaint,
835 fClip,
836 viewMatrix, 836 viewMatrix,
837 stroke, 837 stroke,
838 *devPathPtr)) { 838 *devPathPtr)) {
839 // the mask filter was able to draw itself directly, so there's nothing 839 // the mask filter was able to draw itself directly, so there's nothing
840 // left to do. 840 // left to do.
841 return; 841 return;
842 } 842 }
843 843
844 844
845 SkAutoTUnref<GrTexture> mask(create_mask_GPU(fContext, 845 SkAutoTUnref<GrTexture> mask(create_mask_GPU(fContext,
846 fRenderTarget, 846 fRenderTarget,
847 maskRect, 847 maskRect,
848 *devPathPtr, 848 *devPathPtr,
849 strokeInfo, 849 strokeInfo,
850 grPaint.isAntiAlias(), 850 grPaint.isAntiAlias(),
851 fRenderTarget->numSampl es())); 851 fRenderTarget->numSampl es()));
852 if (mask) { 852 if (mask) {
853 GrTexture* filtered; 853 GrTexture* filtered;
854 854
855 if (paint.getMaskFilter()->filterMaskGPU(mask, viewMatrix, maskR ect, &filtered, true)) { 855 if (paint.getMaskFilter()->filterMaskGPU(mask, viewMatrix, maskR ect, &filtered, true)) {
856 // filterMaskGPU gives us ownership of a ref to the result 856 // filterMaskGPU gives us ownership of a ref to the result
857 SkAutoTUnref<GrTexture> atu(filtered); 857 SkAutoTUnref<GrTexture> atu(filtered);
858 if (draw_mask(fContext, 858 if (draw_mask(fContext, fRenderTarget, viewMatrix, maskRect, &grPaint,
859 fRenderTarget,
860 fClip,
861 viewMatrix,
862 maskRect,
863 &grPaint,
864 filtered)) { 859 filtered)) {
865 // This path is completely drawn 860 // This path is completely drawn
866 return; 861 return;
867 } 862 }
868 } 863 }
869 } 864 }
870 } 865 }
871 866
872 // draw the mask on the CPU - this is a fallthrough path in case the 867 // draw the mask on the CPU - this is a fallthrough path in case the
873 // GPU path fails 868 // GPU path fails
874 SkPaint::Style style = stroke.isHairlineStyle() ? SkPaint::kStroke_Style : 869 SkPaint::Style style = stroke.isHairlineStyle() ? SkPaint::kStroke_Style :
875 SkPaint::kFill_Style; 870 SkPaint::kFill_Style;
876 draw_with_mask_filter(fContext, fRenderTarget, fClip, viewMatrix, *devPa thPtr, 871 draw_with_mask_filter(fContext, fRenderTarget, viewMatrix, *devPathPtr,
877 paint.getMaskFilter(), *draw.fClip, &grPaint, styl e); 872 paint.getMaskFilter(), *draw.fClip, &grPaint, styl e);
878 return; 873 return;
879 } 874 }
880 875
881 fContext->drawPath(fRenderTarget, fClip, grPaint, viewMatrix, *pathPtr, stro keInfo); 876 fContext->drawPath(fRenderTarget, grPaint, viewMatrix, *pathPtr, strokeInfo) ;
882 } 877 }
883 878
884 static const int kBmpSmallTileSize = 1 << 10; 879 static const int kBmpSmallTileSize = 1 << 10;
885 880
886 static inline int get_tile_count(const SkIRect& srcRect, int tileSize) { 881 static inline int get_tile_count(const SkIRect& srcRect, int tileSize) {
887 int tilesX = (srcRect.fRight / tileSize) - (srcRect.fLeft / tileSize) + 1; 882 int tilesX = (srcRect.fRight / tileSize) - (srcRect.fLeft / tileSize) + 1;
888 int tilesY = (srcRect.fBottom / tileSize) - (srcRect.fTop / tileSize) + 1; 883 int tilesY = (srcRect.fBottom / tileSize) - (srcRect.fTop / tileSize) + 1;
889 return tilesX * tilesY; 884 return tilesX * tilesY;
890 } 885 }
891 886
(...skipping 12 matching lines...) Expand all
904 return kBmpSmallTileSize; 899 return kBmpSmallTileSize;
905 } else { 900 } else {
906 return maxTileSize; 901 return maxTileSize;
907 } 902 }
908 } 903 }
909 904
910 // Given a bitmap, an optional src rect, and a context with a clip and matrix de termine what 905 // Given a bitmap, an optional src rect, and a context with a clip and matrix de termine what
911 // pixels from the bitmap are necessary. 906 // pixels from the bitmap are necessary.
912 static void determine_clipped_src_rect(const GrContext* context, 907 static void determine_clipped_src_rect(const GrContext* context,
913 const GrRenderTarget* rt, 908 const GrRenderTarget* rt,
914 const GrClip& clip,
915 const SkMatrix& viewMatrix, 909 const SkMatrix& viewMatrix,
916 const SkBitmap& bitmap, 910 const SkBitmap& bitmap,
917 const SkRect* srcRectPtr, 911 const SkRect* srcRectPtr,
918 SkIRect* clippedSrcIRect) { 912 SkIRect* clippedSrcIRect) {
919 clip.getConservativeBounds(rt, clippedSrcIRect, NULL); 913 const GrClip* clip = context->getClip();
914 clip->getConservativeBounds(rt, clippedSrcIRect, NULL);
920 SkMatrix inv; 915 SkMatrix inv;
921 if (!viewMatrix.invert(&inv)) { 916 if (!viewMatrix.invert(&inv)) {
922 clippedSrcIRect->setEmpty(); 917 clippedSrcIRect->setEmpty();
923 return; 918 return;
924 } 919 }
925 SkRect clippedSrcRect = SkRect::Make(*clippedSrcIRect); 920 SkRect clippedSrcRect = SkRect::Make(*clippedSrcIRect);
926 inv.mapRect(&clippedSrcRect); 921 inv.mapRect(&clippedSrcRect);
927 if (srcRectPtr) { 922 if (srcRectPtr) {
928 // we've setup src space 0,0 to map to the top left of the src rect. 923 // we've setup src space 0,0 to map to the top left of the src rect.
929 clippedSrcRect.offset(srcRectPtr->fLeft, srcRectPtr->fTop); 924 clippedSrcRect.offset(srcRectPtr->fLeft, srcRectPtr->fTop);
(...skipping 16 matching lines...) Expand all
946 int maxTileSize, 941 int maxTileSize,
947 int* tileSize, 942 int* tileSize,
948 SkIRect* clippedSrcRect) const { 943 SkIRect* clippedSrcRect) const {
949 // if bitmap is explictly texture backed then just use the texture 944 // if bitmap is explictly texture backed then just use the texture
950 if (bitmap.getTexture()) { 945 if (bitmap.getTexture()) {
951 return false; 946 return false;
952 } 947 }
953 948
954 // if it's larger than the max tile size, then we have no choice but tiling. 949 // if it's larger than the max tile size, then we have no choice but tiling.
955 if (bitmap.width() > maxTileSize || bitmap.height() > maxTileSize) { 950 if (bitmap.width() > maxTileSize || bitmap.height() > maxTileSize) {
956 determine_clipped_src_rect(fContext, fRenderTarget, fClip, viewMatrix, b itmap, 951 determine_clipped_src_rect(fContext, fRenderTarget, viewMatrix, bitmap, srcRectPtr,
957 srcRectPtr, clippedSrcRect); 952 clippedSrcRect);
958 *tileSize = determine_tile_size(bitmap, *clippedSrcRect, maxTileSize); 953 *tileSize = determine_tile_size(bitmap, *clippedSrcRect, maxTileSize);
959 return true; 954 return true;
960 } 955 }
961 956
962 if (bitmap.width() * bitmap.height() < 4 * kBmpSmallTileSize * kBmpSmallTile Size) { 957 if (bitmap.width() * bitmap.height() < 4 * kBmpSmallTileSize * kBmpSmallTile Size) {
963 return false; 958 return false;
964 } 959 }
965 960
966 // if the entire texture is already in our cache then no reason to tile it 961 // if the entire texture is already in our cache then no reason to tile it
967 if (GrIsBitmapInCache(fContext, bitmap, &params)) { 962 if (GrIsBitmapInCache(fContext, bitmap, &params)) {
968 return false; 963 return false;
969 } 964 }
970 965
971 // At this point we know we could do the draw by uploading the entire bitmap 966 // At this point we know we could do the draw by uploading the entire bitmap
972 // as a texture. However, if the texture would be large compared to the 967 // as a texture. However, if the texture would be large compared to the
973 // cache size and we don't require most of it for this draw then tile to 968 // cache size and we don't require most of it for this draw then tile to
974 // reduce the amount of upload and cache spill. 969 // reduce the amount of upload and cache spill.
975 970
976 // assumption here is that sw bitmap size is a good proxy for its size as 971 // assumption here is that sw bitmap size is a good proxy for its size as
977 // a texture 972 // a texture
978 size_t bmpSize = bitmap.getSize(); 973 size_t bmpSize = bitmap.getSize();
979 size_t cacheSize; 974 size_t cacheSize;
980 fContext->getResourceCacheLimits(NULL, &cacheSize); 975 fContext->getResourceCacheLimits(NULL, &cacheSize);
981 if (bmpSize < cacheSize / 2) { 976 if (bmpSize < cacheSize / 2) {
982 return false; 977 return false;
983 } 978 }
984 979
985 // Figure out how much of the src we will need based on the src rect and cli pping. 980 // Figure out how much of the src we will need based on the src rect and cli pping.
986 determine_clipped_src_rect(fContext, fRenderTarget, fClip, viewMatrix, bitma p, srcRectPtr, 981 determine_clipped_src_rect(fContext, fRenderTarget, viewMatrix, bitmap, srcR ectPtr,
987 clippedSrcRect); 982 clippedSrcRect);
988 *tileSize = kBmpSmallTileSize; // already know whole bitmap fits in one max sized tile. 983 *tileSize = kBmpSmallTileSize; // already know whole bitmap fits in one max sized tile.
989 size_t usedTileBytes = get_tile_count(*clippedSrcRect, kBmpSmallTileSize) * 984 size_t usedTileBytes = get_tile_count(*clippedSrcRect, kBmpSmallTileSize) *
990 kBmpSmallTileSize * kBmpSmallTileSize; 985 kBmpSmallTileSize * kBmpSmallTileSize;
991 986
992 return usedTileBytes < 2 * bmpSize; 987 return usedTileBytes < 2 * bmpSize;
993 } 988 }
994 989
995 void SkGpuDevice::drawBitmap(const SkDraw& origDraw, 990 void SkGpuDevice::drawBitmap(const SkDraw& origDraw,
996 const SkBitmap& bitmap, 991 const SkBitmap& bitmap,
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
1450 1445
1451 // Construct a GrPaint by setting the bitmap texture as the first effect and then configuring 1446 // Construct a GrPaint by setting the bitmap texture as the first effect and then configuring
1452 // the rest from the SkPaint. 1447 // the rest from the SkPaint.
1453 GrPaint grPaint; 1448 GrPaint grPaint;
1454 grPaint.addColorProcessor(fp); 1449 grPaint.addColorProcessor(fp);
1455 bool alphaOnly = !(kAlpha_8_SkColorType == bitmap.colorType()); 1450 bool alphaOnly = !(kAlpha_8_SkColorType == bitmap.colorType());
1456 GrColor paintColor = (alphaOnly) ? SkColor2GrColorJustAlpha(paint.getColor() ) : 1451 GrColor paintColor = (alphaOnly) ? SkColor2GrColorJustAlpha(paint.getColor() ) :
1457 SkColor2GrColor(paint.getColor()); 1452 SkColor2GrColor(paint.getColor());
1458 SkPaint2GrPaintNoShader(this->context(), fRenderTarget, paint, paintColor, f alse, &grPaint); 1453 SkPaint2GrPaintNoShader(this->context(), fRenderTarget, paint, paintColor, f alse, &grPaint);
1459 1454
1460 fContext->drawNonAARectToRect(fRenderTarget, fClip, grPaint, viewMatrix, dst Rect, 1455 fContext->drawNonAARectToRect(fRenderTarget, grPaint, viewMatrix, dstRect, p aintRect);
1461 paintRect);
1462 } 1456 }
1463 1457
1464 bool SkGpuDevice::filterTexture(GrContext* context, GrTexture* texture, 1458 bool SkGpuDevice::filterTexture(GrContext* context, GrTexture* texture,
1465 const SkImageFilter* filter, 1459 const SkImageFilter* filter,
1466 const SkImageFilter::Context& ctx, 1460 const SkImageFilter::Context& ctx,
1467 SkBitmap* result, SkIPoint* offset) { 1461 SkBitmap* result, SkIPoint* offset) {
1468 SkASSERT(filter); 1462 SkASSERT(filter);
1469 1463
1470 // FIXME: plumb actual surface props such that we don't have to lie about th e flags here 1464 // FIXME: plumb actual surface props such that we don't have to lie about th e flags here
1471 // (https://code.google.com/p/skia/issues/detail?id=3148). 1465 // (https://code.google.com/p/skia/issues/detail?id=3148).
1472 SkDeviceImageFilterProxy proxy(this, SkSurfaceProps(0, getLeakyProperties(). pixelGeometry())); 1466 SkDeviceImageFilterProxy proxy(this, SkSurfaceProps(0, getLeakyProperties(). pixelGeometry()));
1473 1467
1474 if (filter->canFilterImageGPU()) { 1468 if (filter->canFilterImageGPU()) {
1469 // Set the clip wide open and the matrix to identity.
1470 GrContext::AutoWideOpenIdentityDraw awo(context);
1475 return filter->filterImageGPU(&proxy, wrap_texture(texture), ctx, result , offset); 1471 return filter->filterImageGPU(&proxy, wrap_texture(texture), ctx, result , offset);
1476 } else { 1472 } else {
1477 return false; 1473 return false;
1478 } 1474 }
1479 } 1475 }
1480 1476
1481 void SkGpuDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap, 1477 void SkGpuDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap,
1482 int left, int top, const SkPaint& paint) { 1478 int left, int top, const SkPaint& paint) {
1483 // drawSprite is defined to be in device coords. 1479 // drawSprite is defined to be in device coords.
1484 CHECK_SHOULD_DRAW(draw); 1480 CHECK_SHOULD_DRAW(draw);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1520 } 1516 }
1521 } 1517 }
1522 1518
1523 GrPaint grPaint; 1519 GrPaint grPaint;
1524 grPaint.addColorTextureProcessor(texture, SkMatrix::I()); 1520 grPaint.addColorTextureProcessor(texture, SkMatrix::I());
1525 1521
1526 SkPaint2GrPaintNoShader(this->context(), fRenderTarget, paint, 1522 SkPaint2GrPaintNoShader(this->context(), fRenderTarget, paint,
1527 SkColor2GrColorJustAlpha(paint.getColor()), false, & grPaint); 1523 SkColor2GrColorJustAlpha(paint.getColor()), false, & grPaint);
1528 1524
1529 fContext->drawNonAARectToRect(fRenderTarget, 1525 fContext->drawNonAARectToRect(fRenderTarget,
1530 fClip,
1531 grPaint, 1526 grPaint,
1532 SkMatrix::I(), 1527 SkMatrix::I(),
1533 SkRect::MakeXYWH(SkIntToScalar(left), 1528 SkRect::MakeXYWH(SkIntToScalar(left),
1534 SkIntToScalar(top), 1529 SkIntToScalar(top),
1535 SkIntToScalar(w), 1530 SkIntToScalar(w),
1536 SkIntToScalar(h)), 1531 SkIntToScalar(h)),
1537 SkRect::MakeXYWH(0, 1532 SkRect::MakeXYWH(0,
1538 0, 1533 0,
1539 SK_Scalar1 * w / texture->wid th(), 1534 SK_Scalar1 * w / texture->wid th(),
1540 SK_Scalar1 * h / texture->hei ght())); 1535 SK_Scalar1 * h / texture->hei ght()));
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1643 SkRect dstRect = SkRect::MakeXYWH(SkIntToScalar(x), 1638 SkRect dstRect = SkRect::MakeXYWH(SkIntToScalar(x),
1644 SkIntToScalar(y), 1639 SkIntToScalar(y),
1645 SkIntToScalar(w), 1640 SkIntToScalar(w),
1646 SkIntToScalar(h)); 1641 SkIntToScalar(h));
1647 1642
1648 // The device being drawn may not fill up its texture (e.g. saveLayer uses a pproximate 1643 // The device being drawn may not fill up its texture (e.g. saveLayer uses a pproximate
1649 // scratch texture). 1644 // scratch texture).
1650 SkRect srcRect = SkRect::MakeWH(SK_Scalar1 * w / devTex->width(), 1645 SkRect srcRect = SkRect::MakeWH(SK_Scalar1 * w / devTex->width(),
1651 SK_Scalar1 * h / devTex->height()); 1646 SK_Scalar1 * h / devTex->height());
1652 1647
1653 fContext->drawNonAARectToRect(fRenderTarget, fClip, grPaint, SkMatrix::I(), dstRect, 1648 fContext->drawNonAARectToRect(fRenderTarget, grPaint, SkMatrix::I(), dstRect , srcRect);
1654 srcRect);
1655 } 1649 }
1656 1650
1657 bool SkGpuDevice::canHandleImageFilter(const SkImageFilter* filter) { 1651 bool SkGpuDevice::canHandleImageFilter(const SkImageFilter* filter) {
1658 return filter->canFilterImageGPU(); 1652 return filter->canFilterImageGPU();
1659 } 1653 }
1660 1654
1661 bool SkGpuDevice::filterImage(const SkImageFilter* filter, const SkBitmap& src, 1655 bool SkGpuDevice::filterImage(const SkImageFilter* filter, const SkBitmap& src,
1662 const SkImageFilter::Context& ctx, 1656 const SkImageFilter::Context& ctx,
1663 SkBitmap* result, SkIPoint* offset) { 1657 SkBitmap* result, SkIPoint* offset) {
1664 // want explicitly our impl, so guard against a subclass of us overriding it 1658 // want explicitly our impl, so guard against a subclass of us overriding it
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1778 for (int i = 0; i < vertexCount; ++i) { 1772 for (int i = 0; i < vertexCount; ++i) {
1779 color = colors[i]; 1773 color = colors[i];
1780 if (paint.getAlpha() != 255) { 1774 if (paint.getAlpha() != 255) {
1781 color = SkColorSetA(color, SkMulDiv255Round(SkColorGetA(color), paint.getAlpha())); 1775 color = SkColorSetA(color, SkMulDiv255Round(SkColorGetA(color), paint.getAlpha()));
1782 } 1776 }
1783 convertedColors[i] = SkColor2GrColor(color); 1777 convertedColors[i] = SkColor2GrColor(color);
1784 } 1778 }
1785 colors = convertedColors.get(); 1779 colors = convertedColors.get();
1786 } 1780 }
1787 fContext->drawVertices(fRenderTarget, 1781 fContext->drawVertices(fRenderTarget,
1788 fClip,
1789 grPaint, 1782 grPaint,
1790 *draw.fMatrix, 1783 *draw.fMatrix,
1791 primType, 1784 primType,
1792 vertexCount, 1785 vertexCount,
1793 vertices, 1786 vertices,
1794 texs, 1787 texs,
1795 colors, 1788 colors,
1796 outIndices, 1789 outIndices,
1797 indexCount); 1790 indexCount);
1798 } 1791 }
1799 1792
1800 /////////////////////////////////////////////////////////////////////////////// 1793 ///////////////////////////////////////////////////////////////////////////////
1801 1794
1802 void SkGpuDevice::drawText(const SkDraw& draw, const void* text, 1795 void SkGpuDevice::drawText(const SkDraw& draw, const void* text,
1803 size_t byteLength, SkScalar x, SkScalar y, 1796 size_t byteLength, SkScalar x, SkScalar y,
1804 const SkPaint& paint) { 1797 const SkPaint& paint) {
1805 CHECK_SHOULD_DRAW(draw); 1798 CHECK_SHOULD_DRAW(draw);
1806 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawText", fContext); 1799 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawText", fContext);
1807 1800
1808 GrPaint grPaint; 1801 GrPaint grPaint;
1809 SkPaint2GrPaintShader(this->context(), fRenderTarget, paint, *draw.fMatrix, true, &grPaint); 1802 SkPaint2GrPaintShader(this->context(), fRenderTarget, paint, *draw.fMatrix, true, &grPaint);
1810 1803
1811 SkDEBUGCODE(this->validate();) 1804 SkDEBUGCODE(this->validate();)
1812 1805
1813 if (!fTextContext->drawText(fRenderTarget, fClip, grPaint, paint, *draw.fMat rix, 1806 if (!fTextContext->drawText(fRenderTarget, grPaint, paint, *draw.fMatrix, (c onst char *)text,
1814 (const char *)text, byteLength, x, y)) { 1807 byteLength, x, y)) {
1815 // this will just call our drawPath() 1808 // this will just call our drawPath()
1816 draw.drawText_asPaths((const char*)text, byteLength, x, y, paint); 1809 draw.drawText_asPaths((const char*)text, byteLength, x, y, paint);
1817 } 1810 }
1818 } 1811 }
1819 1812
1820 void SkGpuDevice::drawPosText(const SkDraw& draw, const void* text, size_t byteL ength, 1813 void SkGpuDevice::drawPosText(const SkDraw& draw, const void* text, size_t byteL ength,
1821 const SkScalar pos[], int scalarsPerPos, 1814 const SkScalar pos[], int scalarsPerPos,
1822 const SkPoint& offset, const SkPaint& paint) { 1815 const SkPoint& offset, const SkPaint& paint) {
1823 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawPosText", fContext); 1816 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawPosText", fContext);
1824 CHECK_SHOULD_DRAW(draw); 1817 CHECK_SHOULD_DRAW(draw);
1825 1818
1826 GrPaint grPaint; 1819 GrPaint grPaint;
1827 SkPaint2GrPaintShader(this->context(), fRenderTarget, paint, *draw.fMatrix, true, &grPaint); 1820 SkPaint2GrPaintShader(this->context(), fRenderTarget, paint, *draw.fMatrix, true, &grPaint);
1828 1821
1829 SkDEBUGCODE(this->validate();) 1822 SkDEBUGCODE(this->validate();)
1830 1823
1831 if (!fTextContext->drawPosText(fRenderTarget, fClip, grPaint, paint, *draw.f Matrix, 1824 if (!fTextContext->drawPosText(fRenderTarget, grPaint, paint, *draw.fMatrix, (const char *)text,
1832 (const char *)text, byteLength, pos, scalarsP erPos, offset)) { 1825 byteLength, pos, scalarsPerPos, offset)) {
1833 // this will just call our drawPath() 1826 // this will just call our drawPath()
1834 draw.drawPosText_asPaths((const char*)text, byteLength, pos, scalarsPerP os, offset, paint); 1827 draw.drawPosText_asPaths((const char*)text, byteLength, pos, scalarsPerP os, offset, paint);
1835 } 1828 }
1836 } 1829 }
1837 1830
1838 /////////////////////////////////////////////////////////////////////////////// 1831 ///////////////////////////////////////////////////////////////////////////////
1839 1832
1840 bool SkGpuDevice::onShouldDisableLCD(const SkPaint& paint) const { 1833 bool SkGpuDevice::onShouldDisableLCD(const SkPaint& paint) const {
1841 if (paint.getShader() || 1834 if (paint.getShader() ||
1842 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode) || 1835 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode) ||
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1961 #endif 1954 #endif
1962 } 1955 }
1963 1956
1964 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { 1957 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() {
1965 // We always return a transient cache, so it is freed after each 1958 // We always return a transient cache, so it is freed after each
1966 // filter traversal. 1959 // filter traversal.
1967 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); 1960 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize);
1968 } 1961 }
1969 1962
1970 #endif 1963 #endif
OLDNEW
« no previous file with comments | « src/gpu/SkGpuDevice.h ('k') | src/gpu/SkGr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698