aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkDraw.cpp
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-12-13 22:16:30 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-12-13 22:16:30 +0000
commita641f3f18e5319773989812a888f3fad49e4f2ad (patch)
treed090e4695e6f7970db27bdac351b3dfcccb02ec2 /src/core/SkDraw.cpp
parentcbcef708914f3b5e9bb63ad3d87261378026e29b (diff)
reland 6798 w/ fix for bitmap-as-mask pixel-locking
git-svn-id: http://skia.googlecode.com/svn/trunk@6806 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkDraw.cpp')
-rw-r--r--src/core/SkDraw.cpp24
1 files changed, 9 insertions, 15 deletions
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index 3035afe1ef..2f748d9930 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -1098,6 +1098,11 @@ void SkDraw::drawBitmapAsMask(const SkBitmap& bitmap,
int ix = SkScalarRound(fMatrix->getTranslateX());
int iy = SkScalarRound(fMatrix->getTranslateY());
+ SkAutoLockPixels alp(bitmap);
+ if (!bitmap.readyToDraw()) {
+ return;
+ }
+
SkMask mask;
mask.fBounds.set(ix, iy, ix + bitmap.width(), iy + bitmap.height());
mask.fFormat = SkMask::kA8_Format;
@@ -1228,13 +1233,6 @@ void SkDraw::drawBitmap(const SkBitmap& bitmap, const SkMatrix& prematrix,
}
}
- // only lock the pixels if we passed the clip and bounder tests
- SkAutoLockPixels alp(bitmap);
- // after the lock, check if we are valid
- if (!bitmap.readyToDraw()) {
- return;
- }
-
if (bitmap.getConfig() != SkBitmap::kA8_Config &&
just_translate(matrix, bitmap)) {
int ix = SkScalarRound(matrix.getTranslateX());
@@ -2279,7 +2277,7 @@ public:
bool setup(const SkPoint pts[], const SkColor colors[], int, int, int);
- virtual void shadeSpan(int x, int y, SkPMColor dstC[], int count);
+ virtual void shadeSpan(int x, int y, SkPMColor dstC[], int count) SK_OVERRIDE;
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTriColorShader)
@@ -2406,7 +2404,7 @@ void SkDraw::drawVertices(SkCanvas::VertexMode vmode, int count,
if (NULL != colors) {
if (NULL == textures) {
// just colors (no texture)
- p.setShader(&triShader);
+ shader = p.setShader(&triShader);
} else {
// colors * texture
SkASSERT(shader);
@@ -2421,6 +2419,7 @@ void SkDraw::drawVertices(SkCanvas::VertexMode vmode, int count,
if (releaseMode) {
xmode->unref();
}
+ shader = compose;
}
}
@@ -2436,18 +2435,13 @@ void SkDraw::drawVertices(SkCanvas::VertexMode vmode, int count,
savedLocalM = shader->getLocalMatrix();
}
- if (NULL != colors) {
- if (!triShader.setContext(*fBitmap, p, *fMatrix)) {
- colors = NULL;
- }
- }
-
while (vertProc(&state)) {
if (NULL != textures) {
if (texture_to_matrix(state, vertices, textures, &tempM)) {
tempM.postConcat(savedLocalM);
shader->setLocalMatrix(tempM);
// need to recal setContext since we changed the local matrix
+ shader->endContext();
if (!shader->setContext(*fBitmap, p, *fMatrix)) {
continue;
}