OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkDraw.h" | 8 #include "SkDraw.h" |
9 #include "SkBlitter.h" | 9 #include "SkBlitter.h" |
10 #include "SkBounder.h" | 10 #include "SkBounder.h" |
(...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1049 origPaint.getRasterizer()) { | 1049 origPaint.getRasterizer()) { |
1050 SkPath* result = pathPtr; | 1050 SkPath* result = pathPtr; |
1051 | 1051 |
1052 if (!pathIsMutable) { | 1052 if (!pathIsMutable) { |
1053 result = &tmpPath; | 1053 result = &tmpPath; |
1054 pathIsMutable = true; | 1054 pathIsMutable = true; |
1055 } | 1055 } |
1056 pathPtr->transform(*prePathMatrix, result); | 1056 pathPtr->transform(*prePathMatrix, result); |
1057 pathPtr = result; | 1057 pathPtr = result; |
1058 } else { | 1058 } else { |
1059 if (!tmpMatrix.setConcat(*matrix, *prePathMatrix)) { | 1059 tmpMatrix.setConcat(*matrix, *prePathMatrix); |
1060 // overflow | |
1061 return; | |
1062 } | |
1063 matrix = &tmpMatrix; | 1060 matrix = &tmpMatrix; |
1064 } | 1061 } |
1065 } | 1062 } |
1066 // at this point we're done with prePathMatrix | 1063 // at this point we're done with prePathMatrix |
1067 SkDEBUGCODE(prePathMatrix = (const SkMatrix*)0x50FF8001;) | 1064 SkDEBUGCODE(prePathMatrix = (const SkMatrix*)0x50FF8001;) |
1068 | 1065 |
1069 SkTCopyOnFirstWrite<SkPaint> paint(origPaint); | 1066 SkTCopyOnFirstWrite<SkPaint> paint(origPaint); |
1070 | 1067 |
1071 { | 1068 { |
1072 SkScalar coverage; | 1069 SkScalar coverage; |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1272 if (fRC->isEmpty() || | 1269 if (fRC->isEmpty() || |
1273 bitmap.width() == 0 || bitmap.height() == 0 || | 1270 bitmap.width() == 0 || bitmap.height() == 0 || |
1274 bitmap.colorType() == kUnknown_SkColorType) { | 1271 bitmap.colorType() == kUnknown_SkColorType) { |
1275 return; | 1272 return; |
1276 } | 1273 } |
1277 | 1274 |
1278 SkPaint paint(origPaint); | 1275 SkPaint paint(origPaint); |
1279 paint.setStyle(SkPaint::kFill_Style); | 1276 paint.setStyle(SkPaint::kFill_Style); |
1280 | 1277 |
1281 SkMatrix matrix; | 1278 SkMatrix matrix; |
1282 if (!matrix.setConcat(*fMatrix, prematrix)) { | 1279 matrix.setConcat(*fMatrix, prematrix); |
1283 return; | |
1284 } | |
1285 | 1280 |
1286 if (clipped_out(matrix, *fRC, bitmap.width(), bitmap.height())) { | 1281 if (clipped_out(matrix, *fRC, bitmap.width(), bitmap.height())) { |
1287 return; | 1282 return; |
1288 } | 1283 } |
1289 | 1284 |
1290 if (fBounder && just_translate(matrix, bitmap)) { | 1285 if (fBounder && just_translate(matrix, bitmap)) { |
1291 SkIRect ir; | 1286 SkIRect ir; |
1292 int32_t ix = SkScalarRoundToInt(matrix.getTranslateX()); | 1287 int32_t ix = SkScalarRoundToInt(matrix.getTranslateX()); |
1293 int32_t iy = SkScalarRoundToInt(matrix.getTranslateY()); | 1288 int32_t iy = SkScalarRoundToInt(matrix.getTranslateY()); |
1294 ir.set(ix, iy, ix + bitmap.width(), iy + bitmap.height()); | 1289 ir.set(ix, iy, ix + bitmap.width(), iy + bitmap.height()); |
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2387 m.reset(); | 2382 m.reset(); |
2388 m.set(0, pts[index1].fX - pts[index0].fX); | 2383 m.set(0, pts[index1].fX - pts[index0].fX); |
2389 m.set(1, pts[index2].fX - pts[index0].fX); | 2384 m.set(1, pts[index2].fX - pts[index0].fX); |
2390 m.set(2, pts[index0].fX); | 2385 m.set(2, pts[index0].fX); |
2391 m.set(3, pts[index1].fY - pts[index0].fY); | 2386 m.set(3, pts[index1].fY - pts[index0].fY); |
2392 m.set(4, pts[index2].fY - pts[index0].fY); | 2387 m.set(4, pts[index2].fY - pts[index0].fY); |
2393 m.set(5, pts[index0].fY); | 2388 m.set(5, pts[index0].fY); |
2394 if (!m.invert(&im)) { | 2389 if (!m.invert(&im)) { |
2395 return false; | 2390 return false; |
2396 } | 2391 } |
2397 return fDstToUnit.setConcat(im, this->getTotalInverse()); | 2392 fDstToUnit.setConcat(im, this->getTotalInverse()); |
| 2393 return true; |
2398 } | 2394 } |
2399 | 2395 |
2400 #include "SkColorPriv.h" | 2396 #include "SkColorPriv.h" |
2401 #include "SkComposeShader.h" | 2397 #include "SkComposeShader.h" |
2402 | 2398 |
2403 static int ScalarTo256(SkScalar v) { | 2399 static int ScalarTo256(SkScalar v) { |
2404 int scale = SkScalarToFixed(v) >> 8; | 2400 int scale = SkScalarToFixed(v) >> 8; |
2405 if (scale < 0) { | 2401 if (scale < 0) { |
2406 scale = 0; | 2402 scale = 0; |
2407 } | 2403 } |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2805 mask->fImage = SkMask::AllocImage(size); | 2801 mask->fImage = SkMask::AllocImage(size); |
2806 memset(mask->fImage, 0, mask->computeImageSize()); | 2802 memset(mask->fImage, 0, mask->computeImageSize()); |
2807 } | 2803 } |
2808 | 2804 |
2809 if (SkMask::kJustComputeBounds_CreateMode != mode) { | 2805 if (SkMask::kJustComputeBounds_CreateMode != mode) { |
2810 draw_into_mask(*mask, devPath, style); | 2806 draw_into_mask(*mask, devPath, style); |
2811 } | 2807 } |
2812 | 2808 |
2813 return true; | 2809 return true; |
2814 } | 2810 } |
OLD | NEW |