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 #ifndef UNICODE | 8 #ifndef UNICODE |
9 #define UNICODE | 9 #define UNICODE |
10 #endif | 10 #endif |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 | 469 |
470 static XPS_SPREAD_METHOD xps_spread_method(SkShader::TileMode tileMode) { | 470 static XPS_SPREAD_METHOD xps_spread_method(SkShader::TileMode tileMode) { |
471 switch (tileMode) { | 471 switch (tileMode) { |
472 case SkShader::kClamp_TileMode: | 472 case SkShader::kClamp_TileMode: |
473 return XPS_SPREAD_METHOD_PAD; | 473 return XPS_SPREAD_METHOD_PAD; |
474 case SkShader::kRepeat_TileMode: | 474 case SkShader::kRepeat_TileMode: |
475 return XPS_SPREAD_METHOD_REPEAT; | 475 return XPS_SPREAD_METHOD_REPEAT; |
476 case SkShader::kMirror_TileMode: | 476 case SkShader::kMirror_TileMode: |
477 return XPS_SPREAD_METHOD_REFLECT; | 477 return XPS_SPREAD_METHOD_REFLECT; |
478 default: | 478 default: |
479 SkASSERT(!"Unknown tile mode."); | 479 SkDEBUGFAIL("Unknown tile mode."); |
480 } | 480 } |
481 return XPS_SPREAD_METHOD_PAD; | 481 return XPS_SPREAD_METHOD_PAD; |
482 } | 482 } |
483 | 483 |
484 static void transform_offsets(SkScalar* stopOffsets, const int numOffsets, | 484 static void transform_offsets(SkScalar* stopOffsets, const int numOffsets, |
485 const SkPoint& start, const SkPoint& end, | 485 const SkPoint& start, const SkPoint& end, |
486 const SkMatrix& transform) { | 486 const SkMatrix& transform) { |
487 SkPoint startTransformed; | 487 SkPoint startTransformed; |
488 transform.mapXY(start.fX, start.fY, &startTransformed); | 488 transform.mapXY(start.fX, start.fY, &startTransformed); |
489 SkPoint endTransformed; | 489 SkPoint endTransformed; |
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1363 segmentData.push(SkScalarToFLOAT(points[2].fX)); | 1363 segmentData.push(SkScalarToFLOAT(points[2].fX)); |
1364 segmentData.push(SkScalarToFLOAT(points[2].fY)); | 1364 segmentData.push(SkScalarToFLOAT(points[2].fY)); |
1365 segmentData.push(SkScalarToFLOAT(points[3].fX)); | 1365 segmentData.push(SkScalarToFLOAT(points[3].fX)); |
1366 segmentData.push(SkScalarToFLOAT(points[3].fY)); | 1366 segmentData.push(SkScalarToFLOAT(points[3].fY)); |
1367 break; | 1367 break; |
1368 case SkPath::kClose_Verb: | 1368 case SkPath::kClose_Verb: |
1369 // we ignore these, and just get the whole segment from | 1369 // we ignore these, and just get the whole segment from |
1370 // the corresponding line/quad/cubic verbs | 1370 // the corresponding line/quad/cubic verbs |
1371 break; | 1371 break; |
1372 default: | 1372 default: |
1373 SkASSERT(!"unexpected verb"); | 1373 SkDEBUGFAIL("unexpected verb"); |
1374 break; | 1374 break; |
1375 } | 1375 } |
1376 } | 1376 } |
1377 if (NULL != xpsFigure.get()) { | 1377 if (NULL != xpsFigure.get()) { |
1378 HR(close_figure(segmentTypes, segmentStrokes, segmentData, | 1378 HR(close_figure(segmentTypes, segmentStrokes, segmentData, |
1379 stroke, fill, | 1379 stroke, fill, |
1380 xpsFigure.get(), xpsFigures)); | 1380 xpsFigure.get(), xpsFigures)); |
1381 } | 1381 } |
1382 return S_OK; | 1382 return S_OK; |
1383 } | 1383 } |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1872 this->fCurrentCanvasSize.fHeight); | 1872 this->fCurrentCanvasSize.fHeight); |
1873 SkTScopedComPtr<IXpsOMGeometryFigure> addOneFigure; | 1873 SkTScopedComPtr<IXpsOMGeometryFigure> addOneFigure; |
1874 HRV(this->createXpsRect(universe, FALSE, TRUE, &addOneFigure)); | 1874 HRV(this->createXpsRect(universe, FALSE, TRUE, &addOneFigure)); |
1875 HRVM(shadedFigures->Append(addOneFigure.get()), | 1875 HRVM(shadedFigures->Append(addOneFigure.get()), |
1876 "Could not add even-odd flip figure to shaded path."); | 1876 "Could not add even-odd flip figure to shaded path."); |
1877 xpsTransformsPath = false; | 1877 xpsTransformsPath = false; |
1878 xpsFillRule = XPS_FILL_RULE_EVENODD; | 1878 xpsFillRule = XPS_FILL_RULE_EVENODD; |
1879 break; | 1879 break; |
1880 } | 1880 } |
1881 default: | 1881 default: |
1882 SkASSERT(!"Unknown SkPath::FillType."); | 1882 SkDEBUGFAIL("Unknown SkPath::FillType."); |
1883 } | 1883 } |
1884 HRVM(shadedGeometry->SetFillRule(xpsFillRule), | 1884 HRVM(shadedGeometry->SetFillRule(xpsFillRule), |
1885 "Could not set fill rule for shaded path."); | 1885 "Could not set fill rule for shaded path."); |
1886 | 1886 |
1887 //Create the XPS transform, if possible. | 1887 //Create the XPS transform, if possible. |
1888 if (xpsTransformsPath) { | 1888 if (xpsTransformsPath) { |
1889 SkTScopedComPtr<IXpsOMMatrixTransform> xpsTransform; | 1889 SkTScopedComPtr<IXpsOMMatrixTransform> xpsTransform; |
1890 HRV(this->createXpsTransform(matrix, &xpsTransform)); | 1890 HRV(this->createXpsTransform(matrix, &xpsTransform)); |
1891 | 1891 |
1892 if (xpsTransform.get()) { | 1892 if (xpsTransform.get()) { |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2118 origin->y += SkScalarToFLOAT(transform.getTranslateY()); | 2118 origin->y += SkScalarToFLOAT(transform.getTranslateY()); |
2119 useCanvasForClip = false; | 2119 useCanvasForClip = false; |
2120 } else { | 2120 } else { |
2121 SkTScopedComPtr<IXpsOMMatrixTransform> xpsMatrixToUse; | 2121 SkTScopedComPtr<IXpsOMMatrixTransform> xpsMatrixToUse; |
2122 HR(this->createXpsTransform(transform, &xpsMatrixToUse)); | 2122 HR(this->createXpsTransform(transform, &xpsMatrixToUse)); |
2123 if (xpsMatrixToUse.get()) { | 2123 if (xpsMatrixToUse.get()) { |
2124 HRM(glyphs->SetTransformLocal(xpsMatrixToUse.get()), | 2124 HRM(glyphs->SetTransformLocal(xpsMatrixToUse.get()), |
2125 "Could not set transform matrix."); | 2125 "Could not set transform matrix."); |
2126 useCanvasForClip = true; | 2126 useCanvasForClip = true; |
2127 } else { | 2127 } else { |
2128 SkASSERT(!"Attempt to add glyphs in perspective."); | 2128 SkDEBUGFAIL("Attempt to add glyphs in perspective."); |
2129 useCanvasForClip = false; | 2129 useCanvasForClip = false; |
2130 } | 2130 } |
2131 } | 2131 } |
2132 | 2132 |
2133 SkTScopedComPtr<IXpsOMGlyphsEditor> glyphsEditor; | 2133 SkTScopedComPtr<IXpsOMGlyphsEditor> glyphsEditor; |
2134 HRM(glyphs->GetGlyphsEditor(&glyphsEditor), "Could not get glyph editor."); | 2134 HRM(glyphs->GetGlyphsEditor(&glyphsEditor), "Could not get glyph editor."); |
2135 | 2135 |
2136 if (NULL != text) { | 2136 if (NULL != text) { |
2137 HRM(glyphsEditor->SetUnicodeString(text), | 2137 HRM(glyphsEditor->SetUnicodeString(text), |
2138 "Could not set unicode string."); | 2138 "Could not set unicode string."); |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2435 IID_PPV_ARGS(&this->fXpsFactory)), | 2435 IID_PPV_ARGS(&this->fXpsFactory)), |
2436 "Could not create factory for layer."); | 2436 "Could not create factory for layer."); |
2437 | 2437 |
2438 HRVM(this->fXpsFactory->CreateCanvas(&this->fCurrentXpsCanvas), | 2438 HRVM(this->fXpsFactory->CreateCanvas(&this->fCurrentXpsCanvas), |
2439 "Could not create canvas for layer."); | 2439 "Could not create canvas for layer."); |
2440 } | 2440 } |
2441 | 2441 |
2442 bool SkXPSDevice::allowImageFilter(SkImageFilter*) { | 2442 bool SkXPSDevice::allowImageFilter(SkImageFilter*) { |
2443 return false; | 2443 return false; |
2444 } | 2444 } |
OLD | NEW |