OLD | NEW |
---|---|
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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
400 // 2) the glyph buffer is encoded as a single blob, and | 400 // 2) the glyph buffer is encoded as a single blob, and |
401 // 3) the blob is not upright/rotated | 401 // 3) the blob is not upright/rotated |
402 if (runInfo.cachedTextBlob && bloberizer.blobCount() == 1 && | 402 if (runInfo.cachedTextBlob && bloberizer.blobCount() == 1 && |
403 blob.second == NoRotation) { | 403 blob.second == NoRotation) { |
404 ASSERT(!*runInfo.cachedTextBlob); | 404 ASSERT(!*runInfo.cachedTextBlob); |
405 *runInfo.cachedTextBlob = std::move(blob.first); | 405 *runInfo.cachedTextBlob = std::move(blob.first); |
406 ASSERT(*runInfo.cachedTextBlob); | 406 ASSERT(*runInfo.cachedTextBlob); |
407 } | 407 } |
408 } | 408 } |
409 | 409 |
410 int Font::getTextIntercepts(SkCanvas*, | |
411 const TextRunPaintInfo& runInfo, | |
412 float deviceScaleFactor, | |
413 const SkPaint& paint, | |
414 const SkScalar* bounds, | |
415 SkScalar* intervals) const { | |
416 if (shouldSkipDrawing()) | |
417 return false; | |
f(malita)
2016/10/13 18:09:19
false -> 0?
drott
2016/10/14 15:15:34
Removed the return type.
| |
418 | |
419 if (runInfo.cachedTextBlob && runInfo.cachedTextBlob->get()) { | |
420 return paint.getTextBlobIntercepts(runInfo.cachedTextBlob->get(), bounds, | |
421 intervals); | |
422 } | |
423 | |
424 GlyphBuffer glyphBuffer; | |
425 buildGlyphBuffer(runInfo, glyphBuffer); | |
426 | |
427 GlyphBufferBloberizer bloberizer(glyphBuffer, this, deviceScaleFactor); | |
428 std::pair<sk_sp<SkTextBlob>, BlobRotation> blob; | |
429 | |
430 int numIntervals = 0; | |
431 while (!bloberizer.done()) { | |
432 blob = bloberizer.next(); | |
433 DCHECK(blob.first); | |
434 | |
435 // GlyphBufferBloberizer splits for a new blob rotation, but does not split | |
436 // for a change in font. A TextBlob can contain runs with differing fonts | |
437 // and the getTextBlobIntercepts method handles multiple fonts for us. For | |
438 // upright in vertical blobs we currently have to bail, see crbug.com/655154 | |
439 if (blob.second == BlobRotation::CCWRotation) | |
440 continue; | |
441 | |
442 SkScalar* offsetIntervals = nullptr; | |
443 if (intervals) { | |
444 // Continue writing the results for the n-th blob after the previous few. | |
445 offsetIntervals = &intervals[numIntervals]; | |
446 } | |
447 numIntervals += | |
448 paint.getTextBlobIntercepts(blob.first.get(), bounds, offsetIntervals); | |
449 } | |
450 | |
451 return numIntervals; | |
452 } | |
453 | |
410 static inline FloatRect pixelSnappedSelectionRect(FloatRect rect) { | 454 static inline FloatRect pixelSnappedSelectionRect(FloatRect rect) { |
411 // Using roundf() rather than ceilf() for the right edge as a compromise to | 455 // Using roundf() rather than ceilf() for the right edge as a compromise to |
412 // ensure correct caret positioning. | 456 // ensure correct caret positioning. |
413 float roundedX = roundf(rect.x()); | 457 float roundedX = roundf(rect.x()); |
414 return FloatRect(roundedX, rect.y(), roundf(rect.maxX() - roundedX), | 458 return FloatRect(roundedX, rect.y(), roundf(rect.maxX() - roundedX), |
415 rect.height()); | 459 rect.height()); |
416 } | 460 } |
417 | 461 |
418 FloatRect Font::selectionRectForText(const TextRun& run, | 462 FloatRect Font::selectionRectForText(const TextRun& run, |
419 const FloatPoint& point, | 463 const FloatPoint& point, |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
938 | 982 |
939 bool Font::loadingCustomFonts() const { | 983 bool Font::loadingCustomFonts() const { |
940 return m_fontFallbackList && m_fontFallbackList->loadingCustomFonts(); | 984 return m_fontFallbackList && m_fontFallbackList->loadingCustomFonts(); |
941 } | 985 } |
942 | 986 |
943 bool Font::isFallbackValid() const { | 987 bool Font::isFallbackValid() const { |
944 return !m_fontFallbackList || m_fontFallbackList->isValid(); | 988 return !m_fontFallbackList || m_fontFallbackList->isValid(); |
945 } | 989 } |
946 | 990 |
947 } // namespace blink | 991 } // namespace blink |
OLD | NEW |