Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: src/core/SkDraw.cpp

Issue 1424173005: Replace glyph find and position with common code for the gpu bitmap case. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: keep blitter choose alive Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/core/SkFindAndPlaceGlyph.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1730 matching lines...) Expand 10 before | Expand all | Expand 10 after
1741 // nothing to draw 1741 // nothing to draw
1742 if (text == nullptr || byteLength == 0 || fRC->isEmpty()) { 1742 if (text == nullptr || byteLength == 0 || fRC->isEmpty()) {
1743 return; 1743 return;
1744 } 1744 }
1745 1745
1746 if (ShouldDrawTextAsPaths(paint, *fMatrix)) { 1746 if (ShouldDrawTextAsPaths(paint, *fMatrix)) {
1747 this->drawPosText_asPaths(text, byteLength, pos, scalarsPerPosition, off set, paint); 1747 this->drawPosText_asPaths(text, byteLength, pos, scalarsPerPosition, off set, paint);
1748 return; 1748 return;
1749 } 1749 }
1750 1750
1751 SkDrawCacheProc glyphCacheProc = paint.getDrawCacheProc(); 1751 // The Blitter Choose needs to be live while using the blitter below.
1752 SkAutoGlyphCache autoCache(paint, &fDevice->surfaceProps(), fMatrix); 1752 SkAutoBlitterChoose blitterChooser;
1753 SkGlyphCache* cache = autoCache.getCache();
1754
1755 SkAAClipBlitterWrapper wrapper; 1753 SkAAClipBlitterWrapper wrapper;
1756 SkAutoBlitterChoose blitterChooser; 1754 SkBlitter* blitter = nullptr;
1757 SkBlitter* blitter = nullptr;
1758 if (needsRasterTextBlit(*this)) { 1755 if (needsRasterTextBlit(*this)) {
1759 blitterChooser.choose(fDst, *fMatrix, paint); 1756 blitterChooser.choose(fDst, *fMatrix, paint);
1760 blitter = blitterChooser.get(); 1757 blitter = blitterChooser.get();
1761 if (fRC->isAA()) { 1758 if (fRC->isAA()) {
1762 wrapper.init(*fRC, blitter); 1759 wrapper.init(*fRC, blitter);
1763 blitter = wrapper.getBlitter(); 1760 blitter = wrapper.getBlitter();
1764 } 1761 }
1765 } 1762 }
1766 1763
1764 SkAutoGlyphCache autoCache(paint, &fDevice->surfaceProps(), fMatrix);
1765 SkGlyphCache* cache = autoCache.getCache();
1767 SkDraw1Glyph d1g; 1766 SkDraw1Glyph d1g;
1768 SkDraw1Glyph::Proc proc = d1g.init(this, blitter, cache, paint); 1767 SkDraw1Glyph::Proc proc = d1g.init(this, blitter, cache, paint);
1768 SkPaint::Align textAlignment = paint.getTextAlign();
1769 SkDrawCacheProc glyphCacheProc = paint.getDrawCacheProc();
1769 1770
1770 auto processOneGlyph = 1771 SkFindAndPlaceGlyph::ProcessPosText(
1772 text, byteLength, offset, *fMatrix, pos, scalarsPerPosition,
1773 textAlignment, glyphCacheProc, cache,
1771 [&](const SkGlyph& glyph, SkPoint position, SkPoint rounding) { 1774 [&](const SkGlyph& glyph, SkPoint position, SkPoint rounding) {
1772 position += rounding; 1775 position += rounding;
1773 proc(d1g, SkScalarToFixed(position.fX), SkScalarToFixed(position.fY) , glyph); 1776 proc(d1g, SkScalarToFixed(position.fX), SkScalarToFixed(position.fY) , glyph);
1774 }; 1777 }
1775 1778 );
1776 SkPaint::Align textAlignment = paint.getTextAlign();
1777 if (!SkFindAndPlaceGlyph::SpecializedProcessPosText(
1778 text, byteLength, offset, *fMatrix, pos, scalarsPerPosition,
1779 textAlignment, glyphCacheProc, cache, processOneGlyph)) {
1780 SkFindAndPlaceGlyph::ProcessPosText(
1781 text, byteLength, offset, *fMatrix, pos, scalarsPerPosition,
1782 textAlignment, glyphCacheProc, cache, processOneGlyph);
1783 }
1784 } 1779 }
1785 1780
1786 #if defined _WIN32 && _MSC_VER >= 1300 1781 #if defined _WIN32 && _MSC_VER >= 1300
1787 #pragma warning ( pop ) 1782 #pragma warning ( pop )
1788 #endif 1783 #endif
1789 1784
1790 /////////////////////////////////////////////////////////////////////////////// 1785 ///////////////////////////////////////////////////////////////////////////////
1791 1786
1792 static SkScan::HairRCProc ChooseHairProc(bool doAntiAlias) { 1787 static SkScan::HairRCProc ChooseHairProc(bool doAntiAlias) {
1793 return doAntiAlias ? SkScan::AntiHairLine : SkScan::HairLine; 1788 return doAntiAlias ? SkScan::AntiHairLine : SkScan::HairLine;
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
2176 mask->fImage = SkMask::AllocImage(size); 2171 mask->fImage = SkMask::AllocImage(size);
2177 memset(mask->fImage, 0, mask->computeImageSize()); 2172 memset(mask->fImage, 0, mask->computeImageSize());
2178 } 2173 }
2179 2174
2180 if (SkMask::kJustComputeBounds_CreateMode != mode) { 2175 if (SkMask::kJustComputeBounds_CreateMode != mode) {
2181 draw_into_mask(*mask, devPath, style); 2176 draw_into_mask(*mask, devPath, style);
2182 } 2177 }
2183 2178
2184 return true; 2179 return true;
2185 } 2180 }
OLDNEW
« no previous file with comments | « no previous file | src/core/SkFindAndPlaceGlyph.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698