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

Side by Side Diff: src/core/SkScalerContext.cpp

Issue 1853383002: Revert of Delete SkFlattenable::Type (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/core/SkReadBuffer.cpp ('k') | src/core/SkValidatingReadBuffer.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 8
9 #include "SkScalerContext.h" 9 #include "SkScalerContext.h"
10 #include "SkAutoPixmapStorage.h" 10 #include "SkAutoPixmapStorage.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 fRsbDelta = 0; 55 fRsbDelta = 0;
56 fLsbDelta = 0; 56 fLsbDelta = 0;
57 } 57 }
58 58
59 /////////////////////////////////////////////////////////////////////////////// 59 ///////////////////////////////////////////////////////////////////////////////
60 60
61 #ifdef SK_DEBUG 61 #ifdef SK_DEBUG
62 #define DUMP_RECx 62 #define DUMP_RECx
63 #endif 63 #endif
64 64
65 static SkFlattenable* load_flattenable(const SkDescriptor* desc, uint32_t tag) { 65 static SkFlattenable* load_flattenable(const SkDescriptor* desc, uint32_t tag,
66 SkFlattenable::Type ft) {
66 SkFlattenable* obj = nullptr; 67 SkFlattenable* obj = nullptr;
67 uint32_t len; 68 uint32_t len;
68 const void* data = desc->findEntry(tag, &len); 69 const void* data = desc->findEntry(tag, &len);
69 70
70 if (data) { 71 if (data) {
71 SkReadBuffer buffer(data, len); 72 SkReadBuffer buffer(data, len);
72 obj = buffer.readFlattenable(); 73 obj = buffer.readFlattenable(ft);
73 SkASSERT(buffer.offset() == buffer.size()); 74 SkASSERT(buffer.offset() == buffer.size());
74 } 75 }
75 return obj; 76 return obj;
76 } 77 }
77 78
78 SkScalerContext::SkScalerContext(SkTypeface* typeface, const SkDescriptor* desc) 79 SkScalerContext::SkScalerContext(SkTypeface* typeface, const SkDescriptor* desc)
79 : fRec(*static_cast<const Rec*>(desc->findEntry(kRec_SkDescriptorTag, nullpt r))) 80 : fRec(*static_cast<const Rec*>(desc->findEntry(kRec_SkDescriptorTag, nullpt r)))
80 81
81 , fTypeface(SkRef(typeface)) 82 , fTypeface(SkRef(typeface))
82 , fPathEffect(static_cast<SkPathEffect*>(load_flattenable(desc, kPathEffect_ SkDescriptorTag))) 83 , fPathEffect(static_cast<SkPathEffect*>(load_flattenable(desc, kPathEffect_ SkDescriptorTag,
83 , fMaskFilter(static_cast<SkMaskFilter*>(load_flattenable(desc, kMaskFilter_ SkDescriptorTag))) 84 SkFlattenable::kSkPathEffect_Type)) )
84 , fRasterizer(static_cast<SkRasterizer*>(load_flattenable(desc, kRasterizer_ SkDescriptorTag))) 85 , fMaskFilter(static_cast<SkMaskFilter*>(load_flattenable(desc, kMaskFilter_ SkDescriptorTag,
86 SkFlattenable::kSkMaskFilter_Type)) )
87 , fRasterizer(static_cast<SkRasterizer*>(load_flattenable(desc, kRasterizer_ SkDescriptorTag,
88 SkFlattenable::kSkRasterizer_Type)) )
85 // Initialize based on our settings. Subclasses can also force this. 89 // Initialize based on our settings. Subclasses can also force this.
86 , fGenerateImageFromPath(fRec.fFrameWidth > 0 || fPathEffect != nullptr || f Rasterizer != nullptr) 90 , fGenerateImageFromPath(fRec.fFrameWidth > 0 || fPathEffect != nullptr || f Rasterizer != nullptr)
87 91
88 , fPreBlend(fMaskFilter ? SkMaskGamma::PreBlend() : SkScalerContext::GetMask PreBlend(fRec)) 92 , fPreBlend(fMaskFilter ? SkMaskGamma::PreBlend() : SkScalerContext::GetMask PreBlend(fRec))
89 , fPreBlendForFilter(fMaskFilter ? SkScalerContext::GetMaskPreBlend(fRec) 93 , fPreBlendForFilter(fMaskFilter ? SkScalerContext::GetMaskPreBlend(fRec)
90 : SkMaskGamma::PreBlend()) 94 : SkMaskGamma::PreBlend())
91 { 95 {
92 #ifdef DUMP_REC 96 #ifdef DUMP_REC
93 desc->assertChecksum(); 97 desc->assertChecksum();
94 SkDebugf("SkScalerContext checksum %x count %d length %d\n", 98 SkDebugf("SkScalerContext checksum %x count %d length %d\n",
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 880
877 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc, 881 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc,
878 bool allowFailure) const { 882 bool allowFailure) const {
879 SkScalerContext* c = this->onCreateScalerContext(desc); 883 SkScalerContext* c = this->onCreateScalerContext(desc);
880 884
881 if (!c && !allowFailure) { 885 if (!c && !allowFailure) {
882 c = new SkScalerContext_Empty(const_cast<SkTypeface*>(this), desc); 886 c = new SkScalerContext_Empty(const_cast<SkTypeface*>(this), desc);
883 } 887 }
884 return c; 888 return c;
885 } 889 }
OLDNEW
« no previous file with comments | « src/core/SkReadBuffer.cpp ('k') | src/core/SkValidatingReadBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698