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

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

Issue 15064003: Fix vertical text scaling on Mac. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Make vertical text look better. Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « samplecode/SampleApp.cpp ('k') | src/ports/SkFontHost_mac.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 7
8 8
9 #include "SkDraw.h" 9 #include "SkDraw.h"
10 #include "SkBlitter.h" 10 #include "SkBlitter.h"
(...skipping 1409 matching lines...) Expand 10 before | Expand all | Expand 10 after
1420 SkTextToPathIter iter(text, byteLength, paint, true); 1420 SkTextToPathIter iter(text, byteLength, paint, true);
1421 1421
1422 SkMatrix matrix; 1422 SkMatrix matrix;
1423 matrix.setScale(iter.getPathScale(), iter.getPathScale()); 1423 matrix.setScale(iter.getPathScale(), iter.getPathScale());
1424 matrix.postTranslate(x, y); 1424 matrix.postTranslate(x, y);
1425 1425
1426 const SkPath* iterPath; 1426 const SkPath* iterPath;
1427 SkScalar xpos, prevXPos = 0; 1427 SkScalar xpos, prevXPos = 0;
1428 1428
1429 while (iter.next(&iterPath, &xpos)) { 1429 while (iter.next(&iterPath, &xpos)) {
1430 matrix.postTranslate(xpos - prevXPos, 0); 1430 SkScalar delta = xpos - prevXPos;
bungeman-skia 2013/05/10 22:30:36 This is probably a bad solution, it's rather stran
1431 if (paint.isVerticalText()) {
1432 matrix.postTranslate(0, delta);
1433 } else {
1434 matrix.postTranslate(delta, 0);
1435 }
1436
1431 if (iterPath) { 1437 if (iterPath) {
1432 const SkPaint& pnt = iter.getPaint(); 1438 const SkPaint& pnt = iter.getPaint();
1433 if (fDevice) { 1439 if (fDevice) {
1434 fDevice->drawPath(*this, *iterPath, pnt, &matrix, false); 1440 fDevice->drawPath(*this, *iterPath, pnt, &matrix, false);
1435 } else { 1441 } else {
1436 this->drawPath(*iterPath, pnt, &matrix, false); 1442 this->drawPath(*iterPath, pnt, &matrix, false);
1437 } 1443 }
1438 } 1444 }
1439 prevXPos = xpos; 1445 prevXPos = xpos;
1440 } 1446 }
(...skipping 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after
2777 mask->fImage = SkMask::AllocImage(size); 2783 mask->fImage = SkMask::AllocImage(size);
2778 memset(mask->fImage, 0, mask->computeImageSize()); 2784 memset(mask->fImage, 0, mask->computeImageSize());
2779 } 2785 }
2780 2786
2781 if (SkMask::kJustComputeBounds_CreateMode != mode) { 2787 if (SkMask::kJustComputeBounds_CreateMode != mode) {
2782 draw_into_mask(*mask, devPath, style); 2788 draw_into_mask(*mask, devPath, style);
2783 } 2789 }
2784 2790
2785 return true; 2791 return true;
2786 } 2792 }
OLDNEW
« no previous file with comments | « samplecode/SampleApp.cpp ('k') | src/ports/SkFontHost_mac.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698