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

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

Issue 605533002: Fix SkTextBlob offset semantics. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: default run positioning fix Created 6 years, 2 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 | « src/core/SkBitmapDevice.cpp ('k') | src/core/SkDevice.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 2008 The Android Open Source Project 2 * Copyright 2008 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 #include "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkCanvasPriv.h" 9 #include "SkCanvasPriv.h"
10 #include "SkBitmapDevice.h" 10 #include "SkBitmapDevice.h"
(...skipping 2122 matching lines...) Expand 10 before | Expand all | Expand 10 after
2133 iter.fDevice->drawText(iter, text, byteLength, x, y, dfp.paint()); 2133 iter.fDevice->drawText(iter, text, byteLength, x, y, dfp.paint());
2134 DrawTextDecorations(iter, dfp.paint(), 2134 DrawTextDecorations(iter, dfp.paint(),
2135 static_cast<const char*>(text), byteLength, x, y); 2135 static_cast<const char*>(text), byteLength, x, y);
2136 } 2136 }
2137 2137
2138 LOOPER_END 2138 LOOPER_END
2139 } 2139 }
2140 2140
2141 void SkCanvas::onDrawPosText(const void* text, size_t byteLength, const SkPoint pos[], 2141 void SkCanvas::onDrawPosText(const void* text, size_t byteLength, const SkPoint pos[],
2142 const SkPaint& paint) { 2142 const SkPaint& paint) {
2143 SkPoint textOffset = SkPoint::Make(0, 0);
2144
2143 LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, NULL) 2145 LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, NULL)
2144 2146
2145 while (iter.next()) { 2147 while (iter.next()) {
2146 SkDeviceFilteredPaint dfp(iter.fDevice, looper.paint()); 2148 SkDeviceFilteredPaint dfp(iter.fDevice, looper.paint());
2147 iter.fDevice->drawPosText(iter, text, byteLength, &pos->fX, 0, 2, 2149 iter.fDevice->drawPosText(iter, text, byteLength, &pos->fX, 2, textOffse t,
2148 dfp.paint()); 2150 dfp.paint());
2149 } 2151 }
2150 2152
2151 LOOPER_END 2153 LOOPER_END
2152 } 2154 }
2153 2155
2154 void SkCanvas::onDrawPosTextH(const void* text, size_t byteLength, const SkScala r xpos[], 2156 void SkCanvas::onDrawPosTextH(const void* text, size_t byteLength, const SkScala r xpos[],
2155 SkScalar constY, const SkPaint& paint) { 2157 SkScalar constY, const SkPaint& paint) {
2158
2159 SkPoint textOffset = SkPoint::Make(0, constY);
2160
2156 LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, NULL) 2161 LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, NULL)
2157 2162
2158 while (iter.next()) { 2163 while (iter.next()) {
2159 SkDeviceFilteredPaint dfp(iter.fDevice, looper.paint()); 2164 SkDeviceFilteredPaint dfp(iter.fDevice, looper.paint());
2160 iter.fDevice->drawPosText(iter, text, byteLength, xpos, constY, 1, 2165 iter.fDevice->drawPosText(iter, text, byteLength, xpos, 1, textOffset,
2161 dfp.paint()); 2166 dfp.paint());
2162 } 2167 }
2163 2168
2164 LOOPER_END 2169 LOOPER_END
2165 } 2170 }
2166 2171
2167 void SkCanvas::onDrawTextOnPath(const void* text, size_t byteLength, const SkPat h& path, 2172 void SkCanvas::onDrawTextOnPath(const void* text, size_t byteLength, const SkPat h& path,
2168 const SkMatrix* matrix, const SkPaint& paint) { 2173 const SkMatrix* matrix, const SkPaint& paint) {
2169 LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, NULL) 2174 LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, NULL)
2170 2175
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
2536 } 2541 }
2537 2542
2538 if (matrix) { 2543 if (matrix) {
2539 canvas->concat(*matrix); 2544 canvas->concat(*matrix);
2540 } 2545 }
2541 } 2546 }
2542 2547
2543 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 2548 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
2544 fCanvas->restoreToCount(fSaveCount); 2549 fCanvas->restoreToCount(fSaveCount);
2545 } 2550 }
OLDNEW
« no previous file with comments | « src/core/SkBitmapDevice.cpp ('k') | src/core/SkDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698