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

Side by Side Diff: samplecode/SampleText.cpp

Issue 621403002: remove unused TextBufferDirection enum (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « 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 2011 Google Inc. 2 * Copyright 2011 Google Inc.
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 "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkView.h" 9 #include "SkView.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 19 matching lines...) Expand all
30 static void test_breakText() { 30 static void test_breakText() {
31 SkPaint paint; 31 SkPaint paint;
32 const char* text = "sdfkljAKLDFJKEWkldfjlk#$%&sdfs.dsj"; 32 const char* text = "sdfkljAKLDFJKEWkldfjlk#$%&sdfs.dsj";
33 size_t length = strlen(text); 33 size_t length = strlen(text);
34 SkScalar width = paint.measureText(text, length); 34 SkScalar width = paint.measureText(text, length);
35 35
36 SkScalar mm = 0; 36 SkScalar mm = 0;
37 SkScalar nn = 0; 37 SkScalar nn = 0;
38 for (SkScalar w = 0; w <= width; w += SK_Scalar1) { 38 for (SkScalar w = 0; w <= width; w += SK_Scalar1) {
39 SkScalar m; 39 SkScalar m;
40 size_t n = paint.breakText(text, length, w, &m, 40 size_t n = paint.breakText(text, length, w, &m);
41 SkPaint::kBackward_TextBufferDirection);
42 41
43 SkASSERT(n <= length); 42 SkASSERT(n <= length);
44 SkASSERT(m <= width); 43 SkASSERT(m <= width);
45 44
46 if (n == 0) { 45 if (n == 0) {
47 SkASSERT(m == 0); 46 SkASSERT(m == 0);
48 } else { 47 } else {
49 // now assert that we're monotonic 48 // now assert that we're monotonic
50 if (n == nn) { 49 if (n == nn) {
51 SkASSERT(m == mm); 50 SkASSERT(m == mm);
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 int fHints; 200 int fHints;
202 SkScalar fClickX; 201 SkScalar fClickX;
203 202
204 typedef SampleView INHERITED; 203 typedef SampleView INHERITED;
205 }; 204 };
206 205
207 ////////////////////////////////////////////////////////////////////////////// 206 //////////////////////////////////////////////////////////////////////////////
208 207
209 static SkView* MyFactory() { return new TextSpeedView; } 208 static SkView* MyFactory() { return new TextSpeedView; }
210 static SkViewRegister reg(MyFactory); 209 static SkViewRegister reg(MyFactory);
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