зеркало из https://github.com/mozilla/moz-skia.git
clean up fix to drawBitmapRect
git-svn-id: http://skia.googlecode.com/svn/trunk@388 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
Родитель
fead49e3c4
Коммит
878999965b
|
@ -60,7 +60,7 @@ protected:
|
||||||
|
|
||||||
const SkIRect src[] = {
|
const SkIRect src[] = {
|
||||||
{ 0, 0, 32, 32 },
|
{ 0, 0, 32, 32 },
|
||||||
{ -8, -8, 80, 80 },
|
{ 0, 0, 80, 80 },
|
||||||
{ 32, 32, 96, 96 },
|
{ 32, 32, 96, 96 },
|
||||||
{ -32, -32, 32, 32, }
|
{ -32, -32, 32, 32, }
|
||||||
};
|
};
|
||||||
|
@ -73,11 +73,12 @@ protected:
|
||||||
|
|
||||||
canvas->translate(16, 40);
|
canvas->translate(16, 40);
|
||||||
for (size_t i = 0; i < SK_ARRAY_COUNT(src); i++) {
|
for (size_t i = 0; i < SK_ARRAY_COUNT(src); i++) {
|
||||||
|
SkRect srcR;
|
||||||
|
srcR.set(src[i]);
|
||||||
|
|
||||||
canvas->drawBitmap(fBitmap, 0, 0, &paint);
|
canvas->drawBitmap(fBitmap, 0, 0, &paint);
|
||||||
canvas->drawBitmapRect(fBitmap, &src[i], dstR, &paint);
|
canvas->drawBitmapRect(fBitmap, &src[i], dstR, &paint);
|
||||||
|
|
||||||
SkRect srcR;
|
|
||||||
srcR.set(src[i]);
|
|
||||||
canvas->drawRect(srcR, paint);
|
canvas->drawRect(srcR, paint);
|
||||||
canvas->drawRect(dstR, paint);
|
canvas->drawRect(dstR, paint);
|
||||||
|
|
||||||
|
|
|
@ -1113,14 +1113,6 @@ void SkCanvas::drawBitmapRect(const SkBitmap& bitmap, const SkIRect* src,
|
||||||
}
|
}
|
||||||
|
|
||||||
SkMatrix matrix;
|
SkMatrix matrix;
|
||||||
#if 0
|
|
||||||
SkScalar width = SkIntToScalar(bitmapPtr->width());
|
|
||||||
SkScalar height = SkIntToScalar(bitmapPtr->height());
|
|
||||||
if (dst.width() == width && dst.height() == height) {
|
|
||||||
matrix.setTranslate(dst.fLeft, dst.fTop);
|
|
||||||
} else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
SkRect tmpSrc;
|
SkRect tmpSrc;
|
||||||
if (src) {
|
if (src) {
|
||||||
tmpSrc.set(*src);
|
tmpSrc.set(*src);
|
||||||
|
@ -1139,7 +1131,6 @@ void SkCanvas::drawBitmapRect(const SkBitmap& bitmap, const SkIRect* src,
|
||||||
SkIntToScalar(bitmap.height()));
|
SkIntToScalar(bitmap.height()));
|
||||||
}
|
}
|
||||||
matrix.setRectToRect(tmpSrc, dst, SkMatrix::kFill_ScaleToFit);
|
matrix.setRectToRect(tmpSrc, dst, SkMatrix::kFill_ScaleToFit);
|
||||||
}
|
|
||||||
this->internalDrawBitmap(*bitmapPtr, matrix, paint);
|
this->internalDrawBitmap(*bitmapPtr, matrix, paint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче