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

Side by Side Diff: src/utils/SkTextBox.cpp

Issue 1099333004: Update {virtual,override} to follow C++11 style in src/utils. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 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
« no previous file with comments | « src/utils/SkEventTracer.cpp ('k') | src/utils/SkTextureCompressor_Blitter.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 7
8 #include "SkTextBox.h" 8 #include "SkTextBox.h"
9 #include "SkUtils.h" 9 #include "SkUtils.h"
10 10
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 } 237 }
238 return y + metrics.fDescent + metrics.fLeading; 238 return y + metrics.fDescent + metrics.fLeading;
239 } 239 }
240 240
241 /////////////////////////////////////////////////////////////////////////////// 241 ///////////////////////////////////////////////////////////////////////////////
242 242
243 class CanvasVisitor : public SkTextBox::Visitor { 243 class CanvasVisitor : public SkTextBox::Visitor {
244 SkCanvas* fCanvas; 244 SkCanvas* fCanvas;
245 public: 245 public:
246 CanvasVisitor(SkCanvas* canvas) : fCanvas(canvas) {} 246 CanvasVisitor(SkCanvas* canvas) : fCanvas(canvas) {}
247 247
248 virtual void operator()(const char text[], size_t length, SkScalar x, SkScal ar y, 248 void operator()(const char text[], size_t length, SkScalar x, SkScalar y,
249 const SkPaint& paint) override { 249 const SkPaint& paint) override {
250 fCanvas->drawText(text, length, x, y, paint); 250 fCanvas->drawText(text, length, x, y, paint);
251 } 251 }
252 }; 252 };
253 253
254 void SkTextBox::setText(const char text[], size_t len, const SkPaint& paint) { 254 void SkTextBox::setText(const char text[], size_t len, const SkPaint& paint) {
255 fText = text; 255 fText = text;
256 fLen = len; 256 fLen = len;
257 fPaint = &paint; 257 fPaint = &paint;
258 } 258 }
259 259
(...skipping 15 matching lines...) Expand all
275 return this->countLines() * spacing; 275 return this->countLines() * spacing;
276 } 276 }
277 277
278 /////////////////////////////////////////////////////////////////////////////// 278 ///////////////////////////////////////////////////////////////////////////////
279 279
280 #include "SkTextBlob.h" 280 #include "SkTextBlob.h"
281 281
282 class TextBlobVisitor : public SkTextBox::Visitor { 282 class TextBlobVisitor : public SkTextBox::Visitor {
283 public: 283 public:
284 SkTextBlobBuilder fBuilder; 284 SkTextBlobBuilder fBuilder;
285 285
286 virtual void operator()(const char text[], size_t length, SkScalar x, SkScal ar y, 286 void operator()(const char text[], size_t length, SkScalar x, SkScalar y,
287 const SkPaint& paint) override { 287 const SkPaint& paint) override {
288 SkPaint p(paint); 288 SkPaint p(paint);
289 p.setTextEncoding(SkPaint::kGlyphID_TextEncoding); 289 p.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
290 const int count = paint.countText(text, length); 290 const int count = paint.countText(text, length);
291 paint.textToGlyphs(text, length, fBuilder.allocRun(p, count, x, y).glyph s); 291 paint.textToGlyphs(text, length, fBuilder.allocRun(p, count, x, y).glyph s);
292 } 292 }
293 }; 293 };
294 294
295 SkTextBlob* SkTextBox::snapshotTextBlob(SkScalar* computedBottom) const { 295 SkTextBlob* SkTextBox::snapshotTextBlob(SkScalar* computedBottom) const {
296 TextBlobVisitor visitor; 296 TextBlobVisitor visitor;
297 SkScalar newB = this->visit(visitor, fText, fLen, *fPaint); 297 SkScalar newB = this->visit(visitor, fText, fLen, *fPaint);
298 if (computedBottom) { 298 if (computedBottom) {
299 *computedBottom = newB; 299 *computedBottom = newB;
300 } 300 }
301 return (SkTextBlob*)visitor.fBuilder.build(); 301 return (SkTextBlob*)visitor.fBuilder.build();
302 } 302 }
303 303
OLDNEW
« no previous file with comments | « src/utils/SkEventTracer.cpp ('k') | src/utils/SkTextureCompressor_Blitter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698