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

Unified Diff: src/core/SkDraw.cpp

Issue 263293005: add local-matrix to shader::context (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase, up smallallocator size for extra context storage Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: src/core/SkDraw.cpp
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index 9347efe475b4c9ade919e40a0864f1a5ce1e8867..df599b4706fdf779000ef56794d1e8ab13a9e351 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -2403,7 +2403,11 @@ bool SkTriColorShader::TriColorShaderContext::setup(const SkPoint pts[], const S
if (!m.invert(&im)) {
return false;
}
- fDstToUnit.setConcat(im, this->getTotalInverse());
+ SkMatrix ctmInv;
+ if (!this->getCTM().invert(&ctmInv)) {
scroggo 2014/05/06 15:40:30 So if I understand correctly, the reason this does
reed1 2014/05/06 17:04:50 Yes. Added a comment to explain that.
+ return false;
+ }
+ fDstToUnit.setConcat(im, ctmInv);
return true;
}
@@ -2556,18 +2560,13 @@ void SkDraw::drawVertices(SkCanvas::VertexMode vmode, int count,
VertState::Proc vertProc = state.chooseProc(vmode);
if (NULL != textures || NULL != colors) {
- SkMatrix tempM;
- SkMatrix savedLocalM;
- if (shader) {
- savedLocalM = shader->getLocalMatrix();
- }
-
while (vertProc(&state)) {
if (NULL != textures) {
+ SkMatrix tempM;
if (texture_to_matrix(state, vertices, textures, &tempM)) {
- tempM.postConcat(savedLocalM);
- shader->setLocalMatrix(tempM);
- if (!blitter->resetShaderContext(*fBitmap, p, *fMatrix)) {
+ SkShader::ContextRec rec(*fBitmap, p, *fMatrix);
+ rec.fLocalMatrix = &tempM;
scroggo 2014/05/06 15:40:30 Why not set this in the constructor?
reed1 2014/05/06 17:04:50 half dozen. At some point I find arguments harder
+ if (!blitter->resetShaderContext(rec)) {
continue;
}
}
@@ -2603,11 +2602,6 @@ void SkDraw::drawVertices(SkCanvas::VertexMode vmode, int count,
};
SkScan::FillTriangle(tmp, *fRC, blitter.get());
}
-
- // now restore the shader's original local matrix
- if (NULL != shader) {
- shader->setLocalMatrix(savedLocalM);
- }
} else {
// no colors[] and no texture
HairProc hairProc = ChooseHairProc(paint.isAntiAlias());

Powered by Google App Engine
This is Rietveld 408576698