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

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

Issue 1718423002: Simplify and combine SkDrawCacheProc and SkMeasureCacheProc to SkPaint::GlyphCacheProc. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 4 years, 10 months 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 | « include/core/SkPaint.h ('k') | src/core/SkPaint.cpp » ('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 1588 matching lines...) Expand 10 before | Expand all | Expand 10 after
1599 SkPaint paint(origPaint); 1599 SkPaint paint(origPaint);
1600 SkScalar matrixScale = paint.setupForAsPaths(); 1600 SkScalar matrixScale = paint.setupForAsPaths();
1601 1601
1602 SkMatrix matrix; 1602 SkMatrix matrix;
1603 matrix.setScale(matrixScale, matrixScale); 1603 matrix.setScale(matrixScale, matrixScale);
1604 1604
1605 // Temporarily jam in kFill, so we only ever ask for the raw outline from th e cache. 1605 // Temporarily jam in kFill, so we only ever ask for the raw outline from th e cache.
1606 paint.setStyle(SkPaint::kFill_Style); 1606 paint.setStyle(SkPaint::kFill_Style);
1607 paint.setPathEffect(nullptr); 1607 paint.setPathEffect(nullptr);
1608 1608
1609 SkDrawCacheProc glyphCacheProc = paint.getDrawCacheProc(); 1609 SkPaint::GlyphCacheProc glyphCacheProc = paint.getGlyphCacheProc(true);
1610 SkAutoGlyphCache cache(paint, &fDevice->surfaceProps(), this->fakeGamma() , nullptr); 1610 SkAutoGlyphCache cache(paint, &fDevice->surfaceProps(), this->fakeGam ma(), nullptr);
1611 1611
1612 const char* stop = text + byteLength; 1612 const char* stop = text + byteLength;
1613 SkTextAlignProc alignProc(paint.getTextAlign()); 1613 SkTextAlignProc alignProc(paint.getTextAlign());
1614 SkTextMapStateProc tmsProc(SkMatrix::I(), offset, scalarsPerPosition); 1614 SkTextMapStateProc tmsProc(SkMatrix::I(), offset, scalarsPerPosition);
1615 1615
1616 // Now restore the original settings, so we "draw" with whatever style/strok ing. 1616 // Now restore the original settings, so we "draw" with whatever style/strok ing.
1617 paint.setStyle(origPaint.getStyle()); 1617 paint.setStyle(origPaint.getStyle());
1618 paint.setPathEffect(origPaint.getPathEffect()); 1618 paint.setPathEffect(origPaint.getPathEffect());
1619 1619
1620 while (text < stop) { 1620 while (text < stop) {
1621 const SkGlyph& glyph = glyphCacheProc(cache.get(), &text, 0, 0); 1621 const SkGlyph& glyph = glyphCacheProc(cache.get(), &text);
1622 if (glyph.fWidth) { 1622 if (glyph.fWidth) {
1623 const SkPath* path = cache->findPath(glyph); 1623 const SkPath* path = cache->findPath(glyph);
1624 if (path) { 1624 if (path) {
1625 SkPoint tmsLoc; 1625 SkPoint tmsLoc;
1626 tmsProc(pos, &tmsLoc); 1626 tmsProc(pos, &tmsLoc);
1627 SkPoint loc; 1627 SkPoint loc;
1628 alignProc(tmsLoc, glyph, &loc); 1628 alignProc(tmsLoc, glyph, &loc);
1629 1629
1630 matrix[SkMatrix::kMTransX] = loc.fX; 1630 matrix[SkMatrix::kMTransX] = loc.fX;
1631 matrix[SkMatrix::kMTransY] = loc.fY; 1631 matrix[SkMatrix::kMTransY] = loc.fY;
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
2056 mask->fImage = SkMask::AllocImage(size); 2056 mask->fImage = SkMask::AllocImage(size);
2057 memset(mask->fImage, 0, mask->computeImageSize()); 2057 memset(mask->fImage, 0, mask->computeImageSize());
2058 } 2058 }
2059 2059
2060 if (SkMask::kJustComputeBounds_CreateMode != mode) { 2060 if (SkMask::kJustComputeBounds_CreateMode != mode) {
2061 draw_into_mask(*mask, devPath, style); 2061 draw_into_mask(*mask, devPath, style);
2062 } 2062 }
2063 2063
2064 return true; 2064 return true;
2065 } 2065 }
OLDNEW
« no previous file with comments | « include/core/SkPaint.h ('k') | src/core/SkPaint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698