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

Side by Side Diff: third_party/WebKit/Source/platform/fonts/Font.cpp

Issue 2679213002: Remove cachedTextBlob lookup in Font::getTextIntercepts (Closed)
Patch Set: Created 3 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 | « no previous file | no next file » | 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 (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2006, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2006, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (c) 2007, 2008, 2010 Google Inc. All rights reserved. 6 * Copyright (c) 2007, 2008, 2010 Google Inc. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 } 430 }
431 431
432 void Font::getTextIntercepts(const TextRunPaintInfo& runInfo, 432 void Font::getTextIntercepts(const TextRunPaintInfo& runInfo,
433 float deviceScaleFactor, 433 float deviceScaleFactor,
434 const PaintFlags& paint, 434 const PaintFlags& paint,
435 const std::tuple<float, float>& bounds, 435 const std::tuple<float, float>& bounds,
436 Vector<TextIntercept>& intercepts) const { 436 Vector<TextIntercept>& intercepts) const {
437 if (shouldSkipDrawing()) 437 if (shouldSkipDrawing())
438 return; 438 return;
439 439
440 if (runInfo.cachedTextBlob && runInfo.cachedTextBlob->get()) { 440 DCHECK(!runInfo.cachedTextBlob);
441 SkScalar boundsArray[2] = {std::get<0>(bounds), std::get<1>(bounds)};
442 int numIntervals = paint.getTextBlobIntercepts(
443 runInfo.cachedTextBlob->get(), boundsArray, nullptr);
444 if (!numIntervals)
445 return;
446 DCHECK_EQ(numIntervals % 2, 0);
447 intercepts.resize(numIntervals / 2);
448 paint.getTextBlobIntercepts(runInfo.cachedTextBlob->get(), boundsArray,
449 reinterpret_cast<SkScalar*>(intercepts.data()));
450 return;
451 }
452 441
453 GlyphBuffer glyphBuffer; 442 GlyphBuffer glyphBuffer;
454 // Compute skip-ink exceptions in the GlyphBuffer. 443 // Compute skip-ink exceptions in the GlyphBuffer.
455 // Skip the computation if 8Bit(), no such characters in Latin-1. 444 // Skip the computation if 8Bit(), no such characters in Latin-1.
456 if (!runInfo.run.is8Bit()) 445 if (!runInfo.run.is8Bit())
457 glyphBuffer.saveSkipInkExceptions(); 446 glyphBuffer.saveSkipInkExceptions();
458 buildGlyphBuffer(runInfo, glyphBuffer); 447 buildGlyphBuffer(runInfo, glyphBuffer);
459 448
460 // Get the number of intervals, without copying the actual values by 449 // Get the number of intervals, without copying the actual values by
461 // specifying nullptr for the buffer, following the Skia allocation model for 450 // specifying nullptr for the buffer, following the Skia allocation model for
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 625
637 bool Font::loadingCustomFonts() const { 626 bool Font::loadingCustomFonts() const {
638 return m_fontFallbackList && m_fontFallbackList->loadingCustomFonts(); 627 return m_fontFallbackList && m_fontFallbackList->loadingCustomFonts();
639 } 628 }
640 629
641 bool Font::isFallbackValid() const { 630 bool Font::isFallbackValid() const {
642 return !m_fontFallbackList || m_fontFallbackList->isValid(); 631 return !m_fontFallbackList || m_fontFallbackList->isValid();
643 } 632 }
644 633
645 } // namespace blink 634 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698