OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
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 "SkTypes.h" | 8 #include "SkTypes.h" |
9 | 9 |
10 #ifndef UNICODE | 10 #ifndef UNICODE |
(...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1037 | 1037 |
1038 if (SkShader::kRadial_GradientType == gradientType) { | 1038 if (SkShader::kRadial_GradientType == gradientType) { |
1039 HR(this->createXpsRadialGradient(info, | 1039 HR(this->createXpsRadialGradient(info, |
1040 skPaint.getAlpha(), | 1040 skPaint.getAlpha(), |
1041 localMatrix, | 1041 localMatrix, |
1042 xpsMatrixToUse.get(), | 1042 xpsMatrixToUse.get(), |
1043 brush)); | 1043 brush)); |
1044 return S_OK; | 1044 return S_OK; |
1045 } | 1045 } |
1046 | 1046 |
1047 if (SkShader::kRadial2_GradientType == gradientType || | 1047 if (SkShader::kConical_GradientType == gradientType) { |
1048 SkShader::kConical_GradientType == gradientType) { | |
1049 //simple if affine and one is 0, otherwise will have to fake | 1048 //simple if affine and one is 0, otherwise will have to fake |
1050 } | 1049 } |
1051 | 1050 |
1052 if (SkShader::kSweep_GradientType == gradientType) { | 1051 if (SkShader::kSweep_GradientType == gradientType) { |
1053 //have to fake | 1052 //have to fake |
1054 } | 1053 } |
1055 } | 1054 } |
1056 | 1055 |
1057 SkBitmap outTexture; | 1056 SkBitmap outTexture; |
1058 SkMatrix outMatrix; | 1057 SkMatrix outMatrix; |
1059 SkShader::TileMode xy[2]; | 1058 SkShader::TileMode xy[2]; |
1060 SkShader::BitmapType bitmapType = shader->asABitmap(&outTexture, | 1059 SkShader::BitmapType bitmapType = shader->asABitmap(&outTexture, |
1061 &outMatrix, | 1060 &outMatrix, |
1062 xy); | 1061 xy); |
1063 switch (bitmapType) { | 1062 switch (bitmapType) { |
1064 case SkShader::kNone_BitmapType: | |
1065 break; | |
1066 case SkShader::kDefault_BitmapType: { | 1063 case SkShader::kDefault_BitmapType: { |
1067 //TODO: outMatrix?? | 1064 //TODO: outMatrix?? |
1068 SkMatrix localMatrix = shader->getLocalMatrix(); | 1065 SkMatrix localMatrix = shader->getLocalMatrix(); |
1069 if (parentTransform) { | 1066 if (parentTransform) { |
1070 localMatrix.preConcat(*parentTransform); | 1067 localMatrix.preConcat(*parentTransform); |
1071 } | 1068 } |
1072 | 1069 |
1073 SkTScopedComPtr<IXpsOMTileBrush> tileBrush; | 1070 SkTScopedComPtr<IXpsOMTileBrush> tileBrush; |
1074 HR(this->createXpsImageBrush(outTexture, | 1071 HR(this->createXpsImageBrush(outTexture, |
1075 localMatrix, | 1072 localMatrix, |
1076 xy, | 1073 xy, |
1077 skPaint.getAlpha(), | 1074 skPaint.getAlpha(), |
1078 &tileBrush)); | 1075 &tileBrush)); |
1079 | 1076 |
1080 HRM(tileBrush->QueryInterface<IXpsOMBrush>(brush), "QI failed."); | 1077 HRM(tileBrush->QueryInterface<IXpsOMBrush>(brush), "QI failed."); |
1081 | 1078 |
1082 return S_OK; | 1079 return S_OK; |
1083 } | 1080 } |
1084 case SkShader::kRadial_BitmapType: | |
1085 case SkShader::kSweep_BitmapType: | |
1086 case SkShader::kTwoPointRadial_BitmapType: | |
1087 default: | 1081 default: |
1088 break; | 1082 break; |
1089 } | 1083 } |
1090 | 1084 |
1091 HR(this->createXpsSolidColorBrush(skPaint.getColor(), 0xFF, brush)); | 1085 HR(this->createXpsSolidColorBrush(skPaint.getColor(), 0xFF, brush)); |
1092 return S_OK; | 1086 return S_OK; |
1093 } | 1087 } |
1094 | 1088 |
1095 static bool rect_must_be_pathed(const SkPaint& paint, const SkMatrix& matrix) { | 1089 static bool rect_must_be_pathed(const SkPaint& paint, const SkMatrix& matrix) { |
1096 const bool zeroWidth = (0 == paint.getStrokeWidth()); | 1090 const bool zeroWidth = (0 == paint.getStrokeWidth()); |
(...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2275 CLSID_XpsOMObjectFactory, | 2269 CLSID_XpsOMObjectFactory, |
2276 NULL, | 2270 NULL, |
2277 CLSCTX_INPROC_SERVER, | 2271 CLSCTX_INPROC_SERVER, |
2278 IID_PPV_ARGS(&this->fXpsFactory)), | 2272 IID_PPV_ARGS(&this->fXpsFactory)), |
2279 "Could not create factory for layer."); | 2273 "Could not create factory for layer."); |
2280 | 2274 |
2281 HRVM(this->fXpsFactory->CreateCanvas(&this->fCurrentXpsCanvas), | 2275 HRVM(this->fXpsFactory->CreateCanvas(&this->fCurrentXpsCanvas), |
2282 "Could not create canvas for layer."); | 2276 "Could not create canvas for layer."); |
2283 } | 2277 } |
2284 | 2278 |
OLD | NEW |