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

Side by Side Diff: src/ports/SkFontHost_FreeType.cpp

Issue 1872253004: Revert of Pass effects directly to fontcache (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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/gpu/text/GrTextUtils.cpp ('k') | src/ports/SkFontHost_FreeType_common.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 "SkAdvancedTypefaceMetrics.h" 8 #include "SkAdvancedTypefaceMetrics.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 if (0 == gFTCount) { 174 if (0 == gFTCount) {
175 SkASSERT(nullptr == gFaceRecHead); 175 SkASSERT(nullptr == gFaceRecHead);
176 SkASSERT(nullptr != gFTLibrary); 176 SkASSERT(nullptr != gFTLibrary);
177 delete gFTLibrary; 177 delete gFTLibrary;
178 SkDEBUGCODE(gFTLibrary = nullptr;) 178 SkDEBUGCODE(gFTLibrary = nullptr;)
179 } 179 }
180 } 180 }
181 181
182 class SkScalerContext_FreeType : public SkScalerContext_FreeType_Base { 182 class SkScalerContext_FreeType : public SkScalerContext_FreeType_Base {
183 public: 183 public:
184 SkScalerContext_FreeType(SkTypeface*, const SkScalerContextEffects&, const S kDescriptor* desc); 184 SkScalerContext_FreeType(SkTypeface*, const SkDescriptor* desc);
185 virtual ~SkScalerContext_FreeType(); 185 virtual ~SkScalerContext_FreeType();
186 186
187 bool success() const { 187 bool success() const {
188 return fFTSize != nullptr && fFace != nullptr; 188 return fFTSize != nullptr && fFace != nullptr;
189 } 189 }
190 190
191 protected: 191 protected:
192 unsigned generateGlyphCount() override; 192 unsigned generateGlyphCount() override;
193 uint16_t generateCharToGlyph(SkUnichar uni) override; 193 uint16_t generateCharToGlyph(SkUnichar uni) override;
194 void generateAdvance(SkGlyph* glyph) override; 194 void generateAdvance(SkGlyph* glyph) override;
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 return 0 == a && 0 == b; 656 return 0 == a && 0 == b;
657 } 657 }
658 658
659 // returns false if there is any non-90-rotation or skew 659 // returns false if there is any non-90-rotation or skew
660 static bool isAxisAligned(const SkScalerContext::Rec& rec) { 660 static bool isAxisAligned(const SkScalerContext::Rec& rec) {
661 return 0 == rec.fPreSkewX && 661 return 0 == rec.fPreSkewX &&
662 (bothZero(rec.fPost2x2[0][1], rec.fPost2x2[1][0]) || 662 (bothZero(rec.fPost2x2[0][1], rec.fPost2x2[1][0]) ||
663 bothZero(rec.fPost2x2[0][0], rec.fPost2x2[1][1])); 663 bothZero(rec.fPost2x2[0][0], rec.fPost2x2[1][1]));
664 } 664 }
665 665
666 SkScalerContext* SkTypeface_FreeType::onCreateScalerContext(const SkScalerContex tEffects& effects, 666 SkScalerContext* SkTypeface_FreeType::onCreateScalerContext(
667 const SkDescriptor* desc) const { 667 const SkDescriptor* desc) const {
668 SkScalerContext_FreeType* c = 668 SkScalerContext_FreeType* c =
669 new SkScalerContext_FreeType(const_cast<SkTypeface_FreeType*>(this), effects, desc); 669 new SkScalerContext_FreeType(const_cast<SkTypeface_FreeType*>(this), desc);
670 if (!c->success()) { 670 if (!c->success()) {
671 delete c; 671 delete c;
672 c = nullptr; 672 c = nullptr;
673 } 673 }
674 return c; 674 return c;
675 } 675 }
676 676
677 void SkTypeface_FreeType::onFilterRec(SkScalerContextRec* rec) const { 677 void SkTypeface_FreeType::onFilterRec(SkScalerContextRec* rec) const {
678 //BOGUS: http://code.google.com/p/chromium/issues/detail?id=121119 678 //BOGUS: http://code.google.com/p/chromium/issues/detail?id=121119
679 //Cap the requested size as larger sizes give bogus values. 679 //Cap the requested size as larger sizes give bogus values.
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 FT_Error err = FT_Select_Size(face, chosenStrikeIndex); 783 FT_Error err = FT_Select_Size(face, chosenStrikeIndex);
784 if (err != 0) { 784 if (err != 0) {
785 SkDEBUGF(("FT_Select_Size(%s, %d) returned 0x%x\n", face->family_nam e, 785 SkDEBUGF(("FT_Select_Size(%s, %d) returned 0x%x\n", face->family_nam e,
786 chosenStrikeIndex, err)); 786 chosenStrikeIndex, err));
787 chosenStrikeIndex = -1; 787 chosenStrikeIndex = -1;
788 } 788 }
789 } 789 }
790 return chosenStrikeIndex; 790 return chosenStrikeIndex;
791 } 791 }
792 792
793 SkScalerContext_FreeType::SkScalerContext_FreeType(SkTypeface* typeface, 793 SkScalerContext_FreeType::SkScalerContext_FreeType(SkTypeface* typeface, const S kDescriptor* desc)
794 const SkScalerContextEffects& effects, 794 : SkScalerContext_FreeType_Base(typeface, desc)
795 const SkDescriptor* desc)
796 : SkScalerContext_FreeType_Base(typeface, effects, desc)
797 , fFace(nullptr) 795 , fFace(nullptr)
798 , fFTSize(nullptr) 796 , fFTSize(nullptr)
799 , fStrikeIndex(-1) 797 , fStrikeIndex(-1)
800 { 798 {
801 SkAutoMutexAcquire ac(gFTMutex); 799 SkAutoMutexAcquire ac(gFTMutex);
802 800
803 if (!ref_ft_library()) { 801 if (!ref_ft_library()) {
804 sk_throw(); 802 sk_throw();
805 } 803 }
806 804
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after
1817 SkDEBUGF(("Requested font axis not found: %s '%c%c%c%c'\n", 1815 SkDEBUGF(("Requested font axis not found: %s '%c%c%c%c'\n",
1818 name.c_str(), 1816 name.c_str(),
1819 (skTag >> 24) & 0xFF, 1817 (skTag >> 24) & 0xFF,
1820 (skTag >> 16) & 0xFF, 1818 (skTag >> 16) & 0xFF,
1821 (skTag >> 8) & 0xFF, 1819 (skTag >> 8) & 0xFF,
1822 (skTag) & 0xFF)); 1820 (skTag) & 0xFF));
1823 } 1821 }
1824 } 1822 }
1825 ) 1823 )
1826 } 1824 }
OLDNEW
« no previous file with comments | « src/gpu/text/GrTextUtils.cpp ('k') | src/ports/SkFontHost_FreeType_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698