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

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