зеркало из https://github.com/mozilla/moz-skia.git
Remove external matrix feature.
We haven't been testing this for nearly two years. R=reed@google.com Review URL: https://codereview.appspot.com/6640044 git-svn-id: http://skia.googlecode.com/svn/trunk@5857 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
Родитель
a834746cc1
Коммит
0e354aacd8
|
@ -893,8 +893,6 @@ public:
|
|||
return &fClipStack;
|
||||
}
|
||||
|
||||
void setExternalMatrix(const SkMatrix* = NULL);
|
||||
|
||||
class ClipVisitor {
|
||||
public:
|
||||
virtual ~ClipVisitor();
|
||||
|
@ -1042,9 +1040,6 @@ private:
|
|||
}
|
||||
void computeLocalClipBoundsCompareType() const;
|
||||
|
||||
SkMatrix fExternalMatrix, fExternalInverse;
|
||||
bool fUseExternalMatrix;
|
||||
|
||||
class AutoValidateClip : ::SkNoncopyable {
|
||||
public:
|
||||
explicit AutoValidateClip(SkCanvas* canvas) : fCanvas(canvas) {
|
||||
|
|
|
@ -115,9 +115,6 @@ public:
|
|||
SkBounder* fBounder; // optional
|
||||
SkDrawProcs* fProcs; // optional
|
||||
|
||||
const SkMatrix* fMVMatrix; // optional
|
||||
const SkMatrix* fExtMatrix; // optional
|
||||
|
||||
#ifdef SK_DEBUG
|
||||
void validate() const;
|
||||
#else
|
||||
|
|
|
@ -23,9 +23,7 @@ class GrDrawTarget;
|
|||
|
||||
class GrTextContext {
|
||||
public:
|
||||
GrTextContext(GrContext*,
|
||||
const GrPaint& paint,
|
||||
const GrMatrix* extMatrix = NULL);
|
||||
GrTextContext(GrContext*, const GrPaint&);
|
||||
~GrTextContext();
|
||||
|
||||
void drawPackedGlyph(GrGlyph::PackedID, GrFixed left, GrFixed top,
|
||||
|
@ -39,7 +37,6 @@ private:
|
|||
GrContext* fContext;
|
||||
GrDrawTarget* fDrawTarget;
|
||||
|
||||
GrMatrix fExtMatrix;
|
||||
GrFontScaler* fScaler;
|
||||
GrTextStrike* fStrike;
|
||||
|
||||
|
|
|
@ -1045,10 +1045,6 @@ void SampleWindow::draw(SkCanvas* canvas) {
|
|||
gAnimTime = SkTime::GetMSecs();
|
||||
}
|
||||
|
||||
const SkMatrix& localM = fGesture.localM();
|
||||
if (localM.getType() & SkMatrix::kScale_Mask) {
|
||||
canvas->setExternalMatrix(&localM);
|
||||
}
|
||||
if (fGesture.isActive()) {
|
||||
this->updateMatrix();
|
||||
}
|
||||
|
|
|
@ -77,9 +77,6 @@ struct DeviceCM {
|
|||
SkRasterClip fClip;
|
||||
const SkMatrix* fMatrix;
|
||||
SkPaint* fPaint; // may be null (in the future)
|
||||
// optional, related to canvas' external matrix
|
||||
const SkMatrix* fMVMatrix;
|
||||
const SkMatrix* fExtMatrix;
|
||||
|
||||
DeviceCM(SkDevice* device, int x, int y, const SkPaint* paint, SkCanvas* canvas)
|
||||
: fNext(NULL) {
|
||||
|
@ -136,20 +133,10 @@ struct DeviceCM {
|
|||
SkASSERT(deviceR.contains(fClip.getBounds()));
|
||||
}
|
||||
#endif
|
||||
// default is to assume no external matrix
|
||||
fMVMatrix = NULL;
|
||||
fExtMatrix = NULL;
|
||||
}
|
||||
|
||||
// can only be called after calling updateMC()
|
||||
void updateExternalMatrix(const SkMatrix& extM, const SkMatrix& extI) {
|
||||
fMVMatrixStorage.setConcat(extI, *fMatrix);
|
||||
fMVMatrix = &fMVMatrixStorage;
|
||||
fExtMatrix = &extM; // assumes extM has long life-time (owned by canvas)
|
||||
}
|
||||
|
||||
private:
|
||||
SkMatrix fMatrixStorage, fMVMatrixStorage;
|
||||
SkMatrix fMatrixStorage;
|
||||
};
|
||||
|
||||
/* This is the record we keep for each save/restore level in the stack.
|
||||
|
@ -249,8 +236,6 @@ public:
|
|||
fDevice = rec->fDevice;
|
||||
fBitmap = &fDevice->accessBitmap(true);
|
||||
fPaint = rec->fPaint;
|
||||
fMVMatrix = rec->fMVMatrix;
|
||||
fExtMatrix = rec->fExtMatrix;
|
||||
SkDEBUGCODE(this->validate();)
|
||||
|
||||
fCurrLayer = rec->fNext;
|
||||
|
@ -468,10 +453,6 @@ SkDevice* SkCanvas::init(SkDevice* device) {
|
|||
fMCRec->fTopLayer = fMCRec->fLayer;
|
||||
fMCRec->fNext = NULL;
|
||||
|
||||
fExternalMatrix.reset();
|
||||
fExternalInverse.reset();
|
||||
fUseExternalMatrix = false;
|
||||
|
||||
fSurfaceBase = NULL;
|
||||
|
||||
return this->setDevice(device);
|
||||
|
@ -673,18 +654,10 @@ void SkCanvas::updateDeviceCMCache() {
|
|||
|
||||
if (NULL == layer->fNext) { // only one layer
|
||||
layer->updateMC(totalMatrix, totalClip, fClipStack, NULL);
|
||||
if (fUseExternalMatrix) {
|
||||
layer->updateExternalMatrix(fExternalMatrix,
|
||||
fExternalInverse);
|
||||
}
|
||||
} else {
|
||||
SkRasterClip clip(totalClip);
|
||||
do {
|
||||
layer->updateMC(totalMatrix, clip, fClipStack, &clip);
|
||||
if (fUseExternalMatrix) {
|
||||
layer->updateExternalMatrix(fExternalMatrix,
|
||||
fExternalInverse);
|
||||
}
|
||||
} while ((layer = layer->fNext) != NULL);
|
||||
}
|
||||
fDeviceCMDirty = false;
|
||||
|
@ -1395,21 +1368,6 @@ const SkRegion& SkCanvas::getTotalClip() const {
|
|||
return fMCRec->fRasterClip->forceGetBW();
|
||||
}
|
||||
|
||||
void SkCanvas::setExternalMatrix(const SkMatrix* matrix) {
|
||||
if (NULL == matrix || matrix->isIdentity()) {
|
||||
if (fUseExternalMatrix) {
|
||||
fDeviceCMDirty = true;
|
||||
}
|
||||
fUseExternalMatrix = false;
|
||||
} else {
|
||||
if (matrix->invert(&fExternalInverse)) {
|
||||
fExternalMatrix = *matrix;
|
||||
fUseExternalMatrix = true;
|
||||
fDeviceCMDirty = true; // |= (fExternalMatrix != *matrix)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SkDevice* SkCanvas::createLayerDevice(SkBitmap::Config config,
|
||||
int width, int height,
|
||||
bool isOpaque) {
|
||||
|
|
|
@ -1547,13 +1547,6 @@ void SkDraw::drawText(const char text[], size_t byteLength,
|
|||
SkDrawCacheProc glyphCacheProc = paint.getDrawCacheProc();
|
||||
|
||||
const SkMatrix* matrix = fMatrix;
|
||||
if (hasCustomD1GProc(*this)) {
|
||||
// only support the fMVMatrix (for now) for the GPU case, which also
|
||||
// sets the fD1GProc
|
||||
if (fMVMatrix) {
|
||||
matrix = fMVMatrix;
|
||||
}
|
||||
}
|
||||
|
||||
SkAutoGlyphCache autoCache(paint, matrix);
|
||||
SkGlyphCache* cache = autoCache.getCache();
|
||||
|
@ -1747,13 +1740,6 @@ void SkDraw::drawPosText(const char text[], size_t byteLength,
|
|||
}
|
||||
|
||||
const SkMatrix* matrix = fMatrix;
|
||||
if (hasCustomD1GProc(*this)) {
|
||||
// only support the fMVMatrix (for now) for the GPU case, which also
|
||||
// sets the fD1GProc
|
||||
if (fMVMatrix) {
|
||||
matrix = fMVMatrix;
|
||||
}
|
||||
}
|
||||
|
||||
SkDrawCacheProc glyphCacheProc = paint.getDrawCacheProc();
|
||||
SkAutoGlyphCache autoCache(paint, matrix);
|
||||
|
@ -2459,9 +2445,6 @@ void SkDraw::validate() const {
|
|||
|
||||
br.set(0, 0, fBitmap->width(), fBitmap->height());
|
||||
SkASSERT(cr.isEmpty() || br.contains(cr));
|
||||
|
||||
// assert that both are null, or both are not-null
|
||||
SkASSERT(!fMVMatrix == !fExtMatrix);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -2249,8 +2249,6 @@ static void text_draw_init(const SkPaint& paint,
|
|||
procs.centemPerUnit = 100.0f / SkScalarToFLOAT(paint.getTextSize());
|
||||
|
||||
myDraw.fProcs = &procs;
|
||||
myDraw.fMVMatrix = &SkMatrix::I();
|
||||
myDraw.fExtMatrix = &SkMatrix::I();
|
||||
}
|
||||
|
||||
static bool text_must_be_pathed(const SkPaint& paint, const SkMatrix& matrix) {
|
||||
|
|
|
@ -34,7 +34,7 @@ void GrTextContext::flushGlyphs() {
|
|||
|
||||
GrAssert(GrIsALIGN4(fCurrVertex));
|
||||
GrAssert(fCurrTexture);
|
||||
GrTextureParams params(SkShader::kRepeat_TileMode, !fExtMatrix.isIdentity());
|
||||
GrTextureParams params(SkShader::kRepeat_TileMode, false);
|
||||
drawState->createTextureEffect(kGlyphMaskStage, fCurrTexture, params);
|
||||
|
||||
if (!GrPixelConfigIsAlphaOnly(fCurrTexture->config())) {
|
||||
|
@ -70,21 +70,13 @@ void GrTextContext::flushGlyphs() {
|
|||
fDrawTarget = NULL;
|
||||
}
|
||||
|
||||
GrTextContext::GrTextContext(GrContext* context,
|
||||
const GrPaint& paint,
|
||||
const GrMatrix* extMatrix) : fPaint(paint) {
|
||||
GrTextContext::GrTextContext(GrContext* context, const GrPaint& paint) : fPaint(paint) {
|
||||
fContext = context;
|
||||
fStrike = NULL;
|
||||
|
||||
fCurrTexture = NULL;
|
||||
fCurrVertex = 0;
|
||||
|
||||
if (NULL != extMatrix) {
|
||||
fExtMatrix = *extMatrix;
|
||||
} else {
|
||||
fExtMatrix.reset();
|
||||
}
|
||||
|
||||
const GrClipData* clipData = context->getClip();
|
||||
|
||||
GrRect devConservativeBound;
|
||||
|
@ -95,19 +87,12 @@ GrTextContext::GrTextContext(GrContext* context,
|
|||
context->getRenderTarget()->height(),
|
||||
&devConservativeBound);
|
||||
|
||||
if (!fExtMatrix.isIdentity()) {
|
||||
GrMatrix inverse;
|
||||
if (fExtMatrix.invert(&inverse)) {
|
||||
inverse.mapRect(&devConservativeBound);
|
||||
}
|
||||
}
|
||||
|
||||
devConservativeBound.roundOut(&fClipRect);
|
||||
|
||||
// save the context's original matrix off and restore in destructor
|
||||
// this must be done before getTextTarget.
|
||||
fOrigViewMatrix = fContext->getMatrix();
|
||||
fContext->setMatrix(fExtMatrix);
|
||||
fContext->setIdentityMatrix();
|
||||
|
||||
/*
|
||||
We need to call preConcatMatrix with our viewmatrix's inverse, for each
|
||||
|
|
|
@ -1857,7 +1857,7 @@ void SkGpuDevice::drawText(const SkDraw& draw, const void* text,
|
|||
&grPaint)) {
|
||||
return;
|
||||
}
|
||||
GrTextContext context(fContext, grPaint, draw.fExtMatrix);
|
||||
GrTextContext context(fContext, grPaint);
|
||||
myDraw.fProcs = this->initDrawForText(&context);
|
||||
this->INHERITED::drawText(myDraw, text, byteLength, x, y, paint);
|
||||
}
|
||||
|
@ -1885,7 +1885,7 @@ void SkGpuDevice::drawPosText(const SkDraw& draw, const void* text,
|
|||
&grPaint)) {
|
||||
return;
|
||||
}
|
||||
GrTextContext context(fContext, grPaint, draw.fExtMatrix);
|
||||
GrTextContext context(fContext, grPaint);
|
||||
myDraw.fProcs = this->initDrawForText(&context);
|
||||
this->INHERITED::drawPosText(myDraw, text, byteLength, pos, constY,
|
||||
scalarsPerPos, paint);
|
||||
|
|
|
@ -319,7 +319,6 @@ SIMPLE_TEST_STEP(DrawTextOnPath, drawTextOnPath(kTestText.c_str(),
|
|||
kTestText.size(), kTestPath, NULL, kTestPaint));
|
||||
SIMPLE_TEST_STEP(DrawTextOnPathMatrix, drawTextOnPath(kTestText.c_str(),
|
||||
kTestText.size(), kTestPath, &kTestMatrix, kTestPaint));
|
||||
SIMPLE_TEST_STEP(SetExternalMatrix, setExternalMatrix(&kTestMatrix));
|
||||
SIMPLE_TEST_STEP(DrawData, drawData(kTestText.c_str(), kTestText.size()));
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Загрузка…
Ссылка в новой задаче