Review URL: http://codereview.appspot.com/5312051/



git-svn-id: http://skia.googlecode.com/svn/trunk@2520 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
bsalomon@google.com 2011-10-24 21:09:40 +00:00
Родитель 45dd1fa3cf
Коммит 820e80ad63
8 изменённых файлов: 56 добавлений и 43 удалений

Просмотреть файл

@ -222,15 +222,15 @@ class GetTypeMatrixBench : public MatrixBench {
public:
GetTypeMatrixBench(void* param)
: INHERITED(param, "gettype") {
fArray[0] = fRnd.nextS();
fArray[1] = fRnd.nextS();
fArray[2] = fRnd.nextS();
fArray[3] = fRnd.nextS();
fArray[4] = fRnd.nextS();
fArray[5] = fRnd.nextS();
fArray[6] = fRnd.nextS();
fArray[7] = fRnd.nextS();
fArray[8] = fRnd.nextS();
fArray[0] = (float) fRnd.nextS();
fArray[1] = (float) fRnd.nextS();
fArray[2] = (float) fRnd.nextS();
fArray[3] = (float) fRnd.nextS();
fArray[4] = (float) fRnd.nextS();
fArray[5] = (float) fRnd.nextS();
fArray[6] = (float) fRnd.nextS();
fArray[7] = (float) fRnd.nextS();
fArray[8] = (float) fRnd.nextS();
}
protected:
// Putting random generation of the matrix inside performTest()
@ -272,10 +272,10 @@ class ScaleTransMixedMatrixBench : public MatrixBench {
fRandom.nextS(), fRandom.nextS(), fRandom.nextS());
int i;
for (i = 0; i < fCount; i++) {
fSrc[i].fX = fRandom.nextS();
fSrc[i].fY = fRandom.nextS();
fDst[i].fX = fRandom.nextS();
fDst[i].fY = fRandom.nextS();
fSrc[i].fX = fRandom.nextSScalar1();
fSrc[i].fY = fRandom.nextSScalar1();
fDst[i].fX = fRandom.nextSScalar1();
fDst[i].fY = fRandom.nextSScalar1();
}
}
protected:
@ -309,10 +309,10 @@ class ScaleTransDoubleMatrixBench : public MatrixBench {
init9(fMatrix);
int i;
for (i = 0; i < fCount; i++) {
fSrc[i].fX = fRandom.nextS();
fSrc[i].fY = fRandom.nextS();
fDst[i].fX = fRandom.nextS();
fDst[i].fY = fRandom.nextS();
fSrc[i].fX = fRandom.nextSScalar1();
fSrc[i].fY = fRandom.nextSScalar1();
fDst[i].fX = fRandom.nextSScalar1();
fDst[i].fY = fRandom.nextSScalar1();
}
}
protected:
@ -321,10 +321,10 @@ class ScaleTransDoubleMatrixBench : public MatrixBench {
const SkPoint* src = fSrc;
int count = fCount;
// As doubles, on Z600 Linux systems this is 2.5x as expensive as mixed mode
float mx = fMatrix[SkMatrix::kMScaleX];
float my = fMatrix[SkMatrix::kMScaleY];
float tx = fMatrix[SkMatrix::kMTransX];
float ty = fMatrix[SkMatrix::kMTransY];
float mx = (float) fMatrix[SkMatrix::kMScaleX];
float my = (float) fMatrix[SkMatrix::kMScaleY];
float tx = (float) fMatrix[SkMatrix::kMTransX];
float ty = (float) fMatrix[SkMatrix::kMTransY];
do {
dst->fY = src->fY * my + ty;
dst->fX = src->fX * mx + tx;

Просмотреть файл

@ -23,7 +23,10 @@ static void drawClip(SkCanvas* canvas, const SkAAClip& clip) {
bm.setPixels(mask.fImage);
SkPaint paint;
canvas->drawBitmap(bm, mask.fBounds.fLeft, mask.fBounds.fTop, &paint);
canvas->drawBitmap(bm,
SK_Scalar1 * mask.fBounds.fLeft,
SK_Scalar1 * mask.fBounds.fTop,
&paint);
}
class AAClipView : public SampleView {

Просмотреть файл

@ -33,7 +33,10 @@ static void drawClip(SkCanvas* canvas, const SkAAClip& clip) {
bm.setPixels(mask.fImage);
SkPaint paint;
canvas->drawBitmap(bm, mask.fBounds.fLeft, mask.fBounds.fTop, &paint);
canvas->drawBitmap(bm,
SK_Scalar1 * mask.fBounds.fLeft,
SK_Scalar1 * mask.fBounds.fTop,
&paint);
}
static void paint_rgn(SkCanvas* canvas, const SkAAClip& clip,
@ -48,7 +51,10 @@ static void paint_rgn(SkCanvas* canvas, const SkAAClip& clip,
mask.fBounds.height(), mask.fRowBytes);
bm.setPixels(mask.fImage);
canvas->drawBitmap(bm, mask.fBounds.fLeft, mask.fBounds.fTop, &paint);
canvas->drawBitmap(bm,
SK_Scalar1 * mask.fBounds.fLeft,
SK_Scalar1 * mask.fBounds.fTop,
&paint);
}
class AAClipView2 : public SampleView {

Просмотреть файл

@ -728,8 +728,10 @@ void SampleWindow::magnify(SkCanvas* canvas) {
SkMatrix m = canvas->getTotalMatrix();
m.invert(&m);
SkPoint offset, center;
m.mapXY(fMouseX - clipW/2, fMouseY - clipH/2, &offset);
m.mapXY(fMouseX, fMouseY, &center);
SkScalar mouseX = fMouseX * SK_Scalar1;
SkScalar mouseY = fMouseY * SK_Scalar1;
m.mapXY(mouseX - clipW/2, mouseY - clipH/2, &offset);
m.mapXY(mouseX, mouseY, &center);
r.set(0, 0, clipW * m.getScaleX(), clipH * m.getScaleX());
r.offset(offset.fX, offset.fY);
@ -737,7 +739,7 @@ void SampleWindow::magnify(SkCanvas* canvas) {
SkPaint paint;
paint.setColor(0xFF66AAEE);
paint.setStyle(SkPaint::kStroke_Style);
paint.setStrokeWidth(10.0 * m.getScaleX());
paint.setStrokeWidth(10.f * m.getScaleX());
//lense offset
//canvas->translate(0, -250);
canvas->drawRect(r, paint);
@ -745,7 +747,7 @@ void SampleWindow::magnify(SkCanvas* canvas) {
m = canvas->getTotalMatrix();
m.setTranslate(-center.fX, -center.fY);
m.postScale(0.5 * fFatBitsScale, 0.5 * fFatBitsScale);
m.postScale(0.5f * fFatBitsScale, 0.5f * fFatBitsScale);
m.postTranslate(center.fX, center.fY);
canvas->concat(m);

Просмотреть файл

@ -102,7 +102,8 @@ protected:
SkScalar y = SkIntToScalar(20);
SkAutoCanvasRestore acr(canvas, true);
canvas->translate(50 + i * 230, 20);
canvas->translate(SkIntToScalar(50 + i * 230),
SkIntToScalar(20));
rotate_about(canvas, i * 5, x, y * 10);
{

Просмотреть файл

@ -72,33 +72,33 @@ static void DrawRoundRect(SkCanvas& canvas) {
// set up clipper
SkRect skclip;
skclip.set(SkIntToFixed(284), SkIntToFixed(40), SkIntToFixed(1370), SkIntToFixed(708));
skclip.set(SkIntToScalar(284), SkIntToScalar(40), SkIntToScalar(1370), SkIntToScalar(708));
// ret = canvas.clipRect(skclip);
// SkASSERT(ret);
matrix.set(SkMatrix::kMTransX, SkFloatToFixed(-1153.28));
matrix.set(SkMatrix::kMTransY, SkFloatToFixed(1180.50));
matrix.set(SkMatrix::kMTransX, SkFloatToScalar(-1153.28f));
matrix.set(SkMatrix::kMTransY, SkFloatToScalar(1180.50f));
matrix.set(SkMatrix::kMScaleX, SkFloatToFixed(0.177171));
matrix.set(SkMatrix::kMScaleY, SkFloatToFixed(0.177043));
matrix.set(SkMatrix::kMScaleX, SkFloatToScalar(0.177171f));
matrix.set(SkMatrix::kMScaleY, SkFloatToScalar(0.177043f));
matrix.set(SkMatrix::kMSkewX, SkFloatToFixed(0.126968));
matrix.set(SkMatrix::kMSkewY, SkFloatToFixed(-0.126876));
matrix.set(SkMatrix::kMSkewX, SkFloatToScalar(0.126968f));
matrix.set(SkMatrix::kMSkewY, SkFloatToScalar(-0.126876f));
matrix.set(SkMatrix::kMPersp0, SkFloatToFixed(0.0));
matrix.set(SkMatrix::kMPersp1, SkFloatToFixed(0.0));
matrix.set(SkMatrix::kMPersp0, SkFloatToScalar(0.0f));
matrix.set(SkMatrix::kMPersp1, SkFloatToScalar(0.0f));
ret = canvas.concat(matrix);
paint.setAntiAlias(true);
paint.setColor(0xb2202020);
paint.setStyle(SkPaint::kStroke_Style);
paint.setStrokeWidth(SkFloatToFixed(68.13));
paint.setStrokeWidth(SkFloatToScalar(68.13f));
SkRect r;
r.set(SkFloatToFixed(-313.714417), SkFloatToFixed(-4.826389), SkFloatToFixed(18014.447266), SkFloatToFixed(1858.154541));
canvas.drawRoundRect(r, SkFloatToFixed(91.756363), SkFloatToFixed(91.756363), paint);
r.set(SkFloatToScalar(-313.714417f), SkFloatToScalar(-4.826389f), SkFloatToScalar(18014.447266f), SkFloatToScalar(1858.154541f));
canvas.drawRoundRect(r, SkFloatToScalar(91.756363f), SkFloatToScalar(91.756363f), paint);
}
static bool SetImageRef(SkBitmap* bitmap, SkStream* stream,

Просмотреть файл

@ -63,8 +63,9 @@ public:
{ SkIntToScalar(32), SkIntToScalar(17) }
};
SkMatrix m0, m1;
SkMatrix m0;
m0.setPolyToPoly(src, dst, 3);
// SkMatrix m1;
// SkSetPoly3To3(&m1, src, dst);
// m0.dump();
// m1.dump();

Просмотреть файл

@ -725,7 +725,7 @@ public:
if (localCount) {
fBuilder->addRun(localX, y, *alpha, localCount);
}
NEXT_RUN:
// Next run
runs += count;
alpha += count;
x += count;