OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "SkPDFShader.h" | 10 #include "SkPDFShader.h" |
(...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 tileModes[0] = fState.get()->fImageTileModes[0]; | 981 tileModes[0] = fState.get()->fImageTileModes[0]; |
982 tileModes[1] = fState.get()->fImageTileModes[1]; | 982 tileModes[1] = fState.get()->fImageTileModes[1]; |
983 if (tileModes[0] != SkShader::kClamp_TileMode || | 983 if (tileModes[0] != SkShader::kClamp_TileMode || |
984 tileModes[1] != SkShader::kClamp_TileMode) { | 984 tileModes[1] != SkShader::kClamp_TileMode) { |
985 deviceBounds.join(bitmapBounds); | 985 deviceBounds.join(bitmapBounds); |
986 } | 986 } |
987 | 987 |
988 SkMatrix unflip; | 988 SkMatrix unflip; |
989 unflip.setTranslate(0, SkScalarRoundToScalar(deviceBounds.height())); | 989 unflip.setTranslate(0, SkScalarRoundToScalar(deviceBounds.height())); |
990 unflip.preScale(SK_Scalar1, -SK_Scalar1); | 990 unflip.preScale(SK_Scalar1, -SK_Scalar1); |
991 SkISize size = SkISize::Make(SkScalarRound(deviceBounds.width()), | 991 SkISize size = SkISize::Make(SkScalarRoundToInt(deviceBounds.width()), |
992 SkScalarRound(deviceBounds.height())); | 992 SkScalarRoundToInt(deviceBounds.height())); |
993 // TODO(edisonn): should we pass here the DCT encoder of the destination dev
ice? | 993 // TODO(edisonn): should we pass here the DCT encoder of the destination dev
ice? |
994 // TODO(edisonn): NYI Perspective, use SkPDFDeviceFlattener. | 994 // TODO(edisonn): NYI Perspective, use SkPDFDeviceFlattener. |
995 SkPDFDevice pattern(size, size, unflip); | 995 SkPDFDevice pattern(size, size, unflip); |
996 SkCanvas canvas(&pattern); | 996 SkCanvas canvas(&pattern); |
997 | 997 |
998 SkRect patternBBox; | 998 SkRect patternBBox; |
999 image->getBounds(&patternBBox); | 999 image->getBounds(&patternBBox); |
1000 | 1000 |
1001 // Translate the canvas so that the bitmap origin is at (0, 0). | 1001 // Translate the canvas so that the bitmap origin is at (0, 0). |
1002 canvas.translate(-deviceBounds.left(), -deviceBounds.top()); | 1002 canvas.translate(-deviceBounds.left(), -deviceBounds.top()); |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1339 return false; | 1339 return false; |
1340 } | 1340 } |
1341 | 1341 |
1342 void SkPDFShader::State::AllocateGradientInfoStorage() { | 1342 void SkPDFShader::State::AllocateGradientInfoStorage() { |
1343 fColorData.set(sk_malloc_throw( | 1343 fColorData.set(sk_malloc_throw( |
1344 fInfo.fColorCount * (sizeof(SkColor) + sizeof(SkScalar)))); | 1344 fInfo.fColorCount * (sizeof(SkColor) + sizeof(SkScalar)))); |
1345 fInfo.fColors = reinterpret_cast<SkColor*>(fColorData.get()); | 1345 fInfo.fColors = reinterpret_cast<SkColor*>(fColorData.get()); |
1346 fInfo.fColorOffsets = | 1346 fInfo.fColorOffsets = |
1347 reinterpret_cast<SkScalar*>(fInfo.fColors + fInfo.fColorCount); | 1347 reinterpret_cast<SkScalar*>(fInfo.fColors + fInfo.fColorCount); |
1348 } | 1348 } |
OLD | NEW |