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 #define __STDC_LIMIT_MACROS | 7 #define __STDC_LIMIT_MACROS |
8 | 8 |
9 #include "SkDraw.h" | 9 #include "SkDraw.h" |
10 #include "SkBlitter.h" | 10 #include "SkBlitter.h" |
(...skipping 1562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1573 return; | 1573 return; |
1574 } | 1574 } |
1575 | 1575 |
1576 // SkScalarRec doesn't currently have a way of representing hairline stroke
and | 1576 // SkScalarRec doesn't currently have a way of representing hairline stroke
and |
1577 // will fill if its frame-width is 0. | 1577 // will fill if its frame-width is 0. |
1578 if (ShouldDrawTextAsPaths(paint, *fMatrix)) { | 1578 if (ShouldDrawTextAsPaths(paint, *fMatrix)) { |
1579 this->drawText_asPaths(text, byteLength, x, y, paint); | 1579 this->drawText_asPaths(text, byteLength, x, y, paint); |
1580 return; | 1580 return; |
1581 } | 1581 } |
1582 | 1582 |
1583 SkDrawCacheProc glyphCacheProc = paint.getDrawCacheProc(); | |
1584 SkAutoGlyphCache autoCache(paint, &fDevice->surfaceProps(), fMatrix); | 1583 SkAutoGlyphCache autoCache(paint, &fDevice->surfaceProps(), fMatrix); |
1585 SkGlyphCache* cache = autoCache.getCache(); | 1584 SkGlyphCache* cache = autoCache.getCache(); |
1586 | 1585 |
1587 SkAAClipBlitter aaBlitter; | 1586 SkAAClipBlitter aaBlitter; |
1588 SkAutoBlitterChoose blitterChooser; | 1587 SkAutoBlitterChoose blitterChooser; |
1589 SkBlitter* blitter = nullptr; | 1588 SkBlitter* blitter = nullptr; |
1590 if (needsRasterTextBlit(*this)) { | 1589 if (needsRasterTextBlit(*this)) { |
1591 blitterChooser.choose(fDst, *fMatrix, paint); | 1590 blitterChooser.choose(fDst, *fMatrix, paint); |
1592 blitter = blitterChooser.get(); | 1591 blitter = blitterChooser.get(); |
1593 if (fRC->isAA()) { | 1592 if (fRC->isAA()) { |
1594 aaBlitter.init(blitter, &fRC->aaRgn()); | 1593 aaBlitter.init(blitter, &fRC->aaRgn()); |
1595 blitter = &aaBlitter; | 1594 blitter = &aaBlitter; |
1596 } | 1595 } |
1597 } | 1596 } |
1598 | 1597 |
1599 SkDraw1Glyph d1g; | 1598 SkDraw1Glyph d1g; |
1600 SkDraw1Glyph::Proc proc = d1g.init(this, blitter, cache, paint); | 1599 SkDraw1Glyph::Proc proc = d1g.init(this, blitter, cache, paint); |
1601 | 1600 |
1602 SkFindAndPlaceGlyph::ProcessText( | 1601 SkFindAndPlaceGlyph::ProcessText( |
1603 text, byteLength, {x, y}, *fMatrix, paint.getTextAlign(), glyphCacheProc
, cache, | 1602 paint.getTextEncoding(), text, byteLength, |
| 1603 {x, y}, *fMatrix, paint.getTextAlign(), cache, |
1604 [&](const SkGlyph& glyph, SkPoint position, SkPoint rounding) { | 1604 [&](const SkGlyph& glyph, SkPoint position, SkPoint rounding) { |
1605 position += rounding; | 1605 position += rounding; |
1606 proc(d1g, SkScalarTo48Dot16(position.fX), SkScalarTo48Dot16(position
.fY), glyph); | 1606 proc(d1g, SkScalarTo48Dot16(position.fX), SkScalarTo48Dot16(position
.fY), glyph); |
1607 } | 1607 } |
1608 ); | 1608 ); |
1609 } | 1609 } |
1610 | 1610 |
1611 ////////////////////////////////////////////////////////////////////////////// | 1611 ////////////////////////////////////////////////////////////////////////////// |
1612 | 1612 |
1613 void SkDraw::drawPosText_asPaths(const char text[], size_t byteLength, | 1613 void SkDraw::drawPosText_asPaths(const char text[], size_t byteLength, |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1688 wrapper.init(*fRC, blitter); | 1688 wrapper.init(*fRC, blitter); |
1689 blitter = wrapper.getBlitter(); | 1689 blitter = wrapper.getBlitter(); |
1690 } | 1690 } |
1691 } | 1691 } |
1692 | 1692 |
1693 SkAutoGlyphCache autoCache(paint, &fDevice->surfaceProps(), fMatrix); | 1693 SkAutoGlyphCache autoCache(paint, &fDevice->surfaceProps(), fMatrix); |
1694 SkGlyphCache* cache = autoCache.getCache(); | 1694 SkGlyphCache* cache = autoCache.getCache(); |
1695 SkDraw1Glyph d1g; | 1695 SkDraw1Glyph d1g; |
1696 SkDraw1Glyph::Proc proc = d1g.init(this, blitter, cache, paint); | 1696 SkDraw1Glyph::Proc proc = d1g.init(this, blitter, cache, paint); |
1697 SkPaint::Align textAlignment = paint.getTextAlign(); | 1697 SkPaint::Align textAlignment = paint.getTextAlign(); |
1698 SkDrawCacheProc glyphCacheProc = paint.getDrawCacheProc(); | |
1699 | 1698 |
1700 SkFindAndPlaceGlyph::ProcessPosText( | 1699 SkFindAndPlaceGlyph::ProcessPosText( |
1701 text, byteLength, offset, *fMatrix, pos, scalarsPerPosition, | 1700 paint.getTextEncoding(), text, byteLength, |
1702 textAlignment, glyphCacheProc, cache, | 1701 offset, *fMatrix, pos, scalarsPerPosition, textAlignment, cache, |
1703 [&](const SkGlyph& glyph, SkPoint position, SkPoint rounding) { | 1702 [&](const SkGlyph& glyph, SkPoint position, SkPoint rounding) { |
1704 position += rounding; | 1703 position += rounding; |
1705 proc(d1g, SkScalarTo48Dot16(position.fX), SkScalarTo48Dot16(position
.fY), glyph); | 1704 proc(d1g, SkScalarTo48Dot16(position.fX), SkScalarTo48Dot16(position
.fY), glyph); |
1706 } | 1705 } |
1707 ); | 1706 ); |
1708 } | 1707 } |
1709 | 1708 |
1710 #if defined _WIN32 && _MSC_VER >= 1300 | 1709 #if defined _WIN32 && _MSC_VER >= 1300 |
1711 #pragma warning ( pop ) | 1710 #pragma warning ( pop ) |
1712 #endif | 1711 #endif |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2100 mask->fImage = SkMask::AllocImage(size); | 2099 mask->fImage = SkMask::AllocImage(size); |
2101 memset(mask->fImage, 0, mask->computeImageSize()); | 2100 memset(mask->fImage, 0, mask->computeImageSize()); |
2102 } | 2101 } |
2103 | 2102 |
2104 if (SkMask::kJustComputeBounds_CreateMode != mode) { | 2103 if (SkMask::kJustComputeBounds_CreateMode != mode) { |
2105 draw_into_mask(*mask, devPath, style); | 2104 draw_into_mask(*mask, devPath, style); |
2106 } | 2105 } |
2107 | 2106 |
2108 return true; | 2107 return true; |
2109 } | 2108 } |
OLD | NEW |