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

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

Issue 1880873002: Revert "Revert of Pass effects directly to fontcache (patchset #8 id:140001 of https://codereview.c… (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/ports/SkFontHost_mac.cpp ('k') | src/ports/SkScalerContext_win_dw.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 "SkTypes.h" 8 #include "SkTypes.h"
9 #if defined(SK_BUILD_FOR_WIN32) 9 #if defined(SK_BUILD_FOR_WIN32)
10 10
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 static LogFontTypeface* Create(const LOGFONT& lf) { 250 static LogFontTypeface* Create(const LOGFONT& lf) {
251 return new LogFontTypeface(get_style(lf), lf, false); 251 return new LogFontTypeface(get_style(lf), lf, false);
252 } 252 }
253 253
254 static void EnsureAccessible(const SkTypeface* face) { 254 static void EnsureAccessible(const SkTypeface* face) {
255 call_ensure_accessible(static_cast<const LogFontTypeface*>(face)->fLogFo nt); 255 call_ensure_accessible(static_cast<const LogFontTypeface*>(face)->fLogFo nt);
256 } 256 }
257 257
258 protected: 258 protected:
259 SkStreamAsset* onOpenStream(int* ttcIndex) const override; 259 SkStreamAsset* onOpenStream(int* ttcIndex) const override;
260 SkScalerContext* onCreateScalerContext(const SkDescriptor*) const override; 260 SkScalerContext* onCreateScalerContext(const SkScalerContextEffects&,
261 const SkDescriptor*) const override;
261 void onFilterRec(SkScalerContextRec*) const override; 262 void onFilterRec(SkScalerContextRec*) const override;
262 SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics( 263 SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics(
263 PerGlyphInfo, const uint32_t*, uint32_t) const o verride; 264 PerGlyphInfo, const uint32_t*, uint32_t) const o verride;
264 void onGetFontDescriptor(SkFontDescriptor*, bool*) const override; 265 void onGetFontDescriptor(SkFontDescriptor*, bool*) const override;
265 virtual int onCharsToGlyphs(const void* chars, Encoding encoding, 266 virtual int onCharsToGlyphs(const void* chars, Encoding encoding,
266 uint16_t glyphs[], int glyphCount) const overrid e; 267 uint16_t glyphs[], int glyphCount) const overrid e;
267 int onCountGlyphs() const override; 268 int onCountGlyphs() const override;
268 int onGetUPEM() const override; 269 int onGetUPEM() const override;
269 void onGetFamilyName(SkString* familyName) const override; 270 void onGetFamilyName(SkString* familyName) const override;
270 SkTypeface::LocalizedStrings* onCreateFamilyNameIterator() const override; 271 SkTypeface::LocalizedStrings* onCreateFamilyNameIterator() const override;
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 *srcRBPtr = srcRB; 527 *srcRBPtr = srcRB;
527 // offset to the start of the image 528 // offset to the start of the image
528 return (const char*)fBits + (fHeight - glyph.fHeight) * srcRB; 529 return (const char*)fBits + (fHeight - glyph.fHeight) * srcRB;
529 } 530 }
530 531
531 ////////////////////////////////////////////////////////////////////////////// 532 //////////////////////////////////////////////////////////////////////////////
532 #define BUFFERSIZE (1 << 13) 533 #define BUFFERSIZE (1 << 13)
533 534
534 class SkScalerContext_GDI : public SkScalerContext { 535 class SkScalerContext_GDI : public SkScalerContext {
535 public: 536 public:
536 SkScalerContext_GDI(SkTypeface*, const SkDescriptor* desc); 537 SkScalerContext_GDI(SkTypeface*, const SkScalerContextEffects&, const SkDesc riptor* desc);
537 virtual ~SkScalerContext_GDI(); 538 virtual ~SkScalerContext_GDI();
538 539
539 // Returns true if the constructor was able to complete all of its 540 // Returns true if the constructor was able to complete all of its
540 // initializations (which may include calling GDI). 541 // initializations (which may include calling GDI).
541 bool isValid() const; 542 bool isValid() const;
542 543
543 protected: 544 protected:
544 unsigned generateGlyphCount() override; 545 unsigned generateGlyphCount() override;
545 uint16_t generateCharToGlyph(SkUnichar uni) override; 546 uint16_t generateCharToGlyph(SkUnichar uni) override;
546 void generateAdvance(SkGlyph* glyph) override; 547 void generateAdvance(SkGlyph* glyph) override;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 default: 598 default:
598 if (rec.fFlags & SkScalerContext::kGenA8FromLCD_Flag) { 599 if (rec.fFlags & SkScalerContext::kGenA8FromLCD_Flag) {
599 return CLEARTYPE_QUALITY; 600 return CLEARTYPE_QUALITY;
600 } else { 601 } else {
601 return ANTIALIASED_QUALITY; 602 return ANTIALIASED_QUALITY;
602 } 603 }
603 } 604 }
604 } 605 }
605 606
606 SkScalerContext_GDI::SkScalerContext_GDI(SkTypeface* rawTypeface, 607 SkScalerContext_GDI::SkScalerContext_GDI(SkTypeface* rawTypeface,
607 const SkDescriptor* desc) 608 const SkScalerContextEffects& effects,
608 : SkScalerContext(rawTypeface, desc) 609 const SkDescriptor* desc)
610 : SkScalerContext(rawTypeface, effects, desc)
609 , fDDC(0) 611 , fDDC(0)
610 , fSavefont(0) 612 , fSavefont(0)
611 , fFont(0) 613 , fFont(0)
612 , fSC(0) 614 , fSC(0)
613 , fGlyphCount(-1) 615 , fGlyphCount(-1)
614 { 616 {
615 LogFontTypeface* typeface = reinterpret_cast<LogFontTypeface*>(rawTypeface); 617 LogFontTypeface* typeface = reinterpret_cast<LogFontTypeface*>(rawTypeface);
616 618
617 fDDC = ::CreateCompatibleDC(nullptr); 619 fDDC = ::CreateCompatibleDC(nullptr);
618 if (!fDDC) { 620 if (!fDDC) {
(...skipping 1659 matching lines...) Expand 10 before | Expand all | Expand 10 after
2278 bufferSize = GetFontData(hdc, tag, (DWORD) offset, data, (DWORD) length) ; 2280 bufferSize = GetFontData(hdc, tag, (DWORD) offset, data, (DWORD) length) ;
2279 } 2281 }
2280 2282
2281 SelectObject(hdc, savefont); 2283 SelectObject(hdc, savefont);
2282 DeleteObject(font); 2284 DeleteObject(font);
2283 DeleteDC(hdc); 2285 DeleteDC(hdc);
2284 2286
2285 return bufferSize == GDI_ERROR ? 0 : bufferSize; 2287 return bufferSize == GDI_ERROR ? 0 : bufferSize;
2286 } 2288 }
2287 2289
2288 SkScalerContext* LogFontTypeface::onCreateScalerContext(const SkDescriptor* desc ) const { 2290 SkScalerContext* LogFontTypeface::onCreateScalerContext(const SkScalerContextEff ects& effects,
2289 SkScalerContext_GDI* ctx = new SkScalerContext_GDI(const_cast<LogFontTypefac e*>(this), desc); 2291 const SkDescriptor* desc ) const {
2292 SkScalerContext_GDI* ctx = new SkScalerContext_GDI(const_cast<LogFontTypefac e*>(this),
2293 effects, desc);
2290 if (!ctx->isValid()) { 2294 if (!ctx->isValid()) {
2291 delete ctx; 2295 delete ctx;
2292 ctx = nullptr; 2296 ctx = nullptr;
2293 } 2297 }
2294 return ctx; 2298 return ctx;
2295 } 2299 }
2296 2300
2297 void LogFontTypeface::onFilterRec(SkScalerContextRec* rec) const { 2301 void LogFontTypeface::onFilterRec(SkScalerContextRec* rec) const {
2298 if (rec->fFlags & SkScalerContext::kLCD_BGROrder_Flag || 2302 if (rec->fFlags & SkScalerContext::kLCD_BGROrder_Flag ||
2299 rec->fFlags & SkScalerContext::kLCD_Vertical_Flag) 2303 rec->fFlags & SkScalerContext::kLCD_Vertical_Flag)
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
2514 2518
2515 private: 2519 private:
2516 SkTDArray<ENUMLOGFONTEX> fLogFontArray; 2520 SkTDArray<ENUMLOGFONTEX> fLogFontArray;
2517 }; 2521 };
2518 2522
2519 /////////////////////////////////////////////////////////////////////////////// 2523 ///////////////////////////////////////////////////////////////////////////////
2520 2524
2521 SkFontMgr* SkFontMgr_New_GDI() { return new SkFontMgrGDI; } 2525 SkFontMgr* SkFontMgr_New_GDI() { return new SkFontMgrGDI; }
2522 2526
2523 #endif//defined(SK_BUILD_FOR_WIN32) 2527 #endif//defined(SK_BUILD_FOR_WIN32)
OLDNEW
« no previous file with comments | « src/ports/SkFontHost_mac.cpp ('k') | src/ports/SkScalerContext_win_dw.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698