Revert of Revert[2] of "stop using drawSprite (at least w/ no filters) as it is going away" (patchset #1 id:1 of https://codereview.chromium.org/1410343011/ )

Reason for revert:
failing on msaa

Original issue's description:
> Revert[2] of "stop using drawSprite (at least w/ no filters) as it is going away"
>
> Fixed assert in test that was calling GrRecordReplaceDraw(). That function now uses
> drawBitmap, so updated the test to check for that (instead of drawSprite).
>
> This reverts commit 21b7663470.
>
> BUG=skia:
> TBR=
>
> Committed: https://skia.googlesource.com/skia/+/7b81994d95f10cda80ddb85af68a2651ff31782f

TBR=
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1420053009
This commit is contained in:
reed 2015-11-03 11:27:07 -08:00 committed by Commit bot
parent 4a40a46c65
commit 67b8b5e67a
6 changed files with 13 additions and 10 deletions

View File

@ -440,10 +440,14 @@ protected:
canvas->drawPath(path, paint);
paint.setShader(nullptr);
// bitmap
// bitmap, sprite
canvas->translate(SkIntToScalar(50), 0);
paint.setStyle(SkPaint::kFill_Style);
canvas->drawBitmap(fBug, left, top, &paint);
canvas->translate(SkIntToScalar(30), 0);
canvas->drawSprite(fTb,
SkScalarRoundToInt(canvas->getTotalMatrix().getTranslateX()),
spriteOffset + 10, &paint);
canvas->translate(-SkIntToScalar(30), SkIntToScalar(30));
paint.setShader(shaderTest())->unref(); // test compose shader

View File

@ -79,8 +79,7 @@ bool SkColorFilterImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& sourc
paint.setXfermodeMode(SkXfermode::kSrc_Mode);
paint.setColorFilter(fColorFilter);
canvas.drawBitmap(src, SkIntToScalar(srcOffset.fX - bounds.fLeft),
SkIntToScalar(srcOffset.fY - bounds.fTop), &paint);
canvas.drawSprite(src, srcOffset.fX - bounds.fLeft, srcOffset.fY - bounds.fTop, &paint);
*result = device.get()->accessBitmap(false);
offset->fX = bounds.fLeft;

View File

@ -91,7 +91,7 @@ bool SkMergeImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src,
} else {
paint.setXfermode(nullptr);
}
canvas.drawBitmap(input, SkIntToScalar(pos.x() - x0), SkIntToScalar(pos.y() - y0), &paint);
canvas.drawSprite(input, pos.x() - x0, pos.y() - y0, &paint);
didProduceResult = true;
}

View File

@ -46,9 +46,9 @@ static inline void draw_replacement_bitmap(GrCachedLayer* layer, SkCanvas* canva
canvas->drawBitmapRect(bm, src, dst, layer->paint(), SkCanvas::kStrict_SrcRectConstraint);
canvas->restore();
} else {
canvas->drawBitmap(bm,
SkIntToScalar(layer->srcIR().fLeft + layer->offset().fX),
SkIntToScalar(layer->srcIR().fTop + layer->offset().fY),
canvas->drawSprite(bm,
layer->srcIR().fLeft + layer->offset().fX,
layer->srcIR().fTop + layer->offset().fY,
layer->paint());
}
}

View File

@ -206,8 +206,8 @@ bool SkImageDecoder::cropBitmap(SkBitmap *dst, SkBitmap *src, int sampleSize,
paint.setXfermodeMode(SkXfermode::kSrc_Mode);
SkCanvas canvas(*dst);
canvas.drawBitmap(*src, SkIntToScalar((srcX - dstX) / sampleSize),
SkIntToScalar((srcY - dstY) / sampleSize),
canvas.drawSprite(*src, (srcX - dstX) / sampleSize,
(srcY - dstY) / sampleSize,
&paint);
return true;
}

View File

@ -142,7 +142,7 @@ void test_replacements(skiatest::Reporter* r, GrContext* context, bool useBBH) {
assert_type<SkRecords::Save>(r, rerecord, 0);
index += 1;
}
assert_type<SkRecords::DrawBitmap>(r, rerecord, index + 0);
assert_type<SkRecords::DrawSprite>(r, rerecord, index + 0);
assert_type<SkRecords::DrawRect>(r, rerecord, index + 1);
if (4 == recount) {
assert_type<SkRecords::Restore>(r, rerecord, 3);