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

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

Issue 1834303003: Delete SkFlattenable::Type (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase 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) {
67 SkFlattenable* obj = nullptr; 66 SkFlattenable* obj = nullptr;
68 uint32_t len; 67 uint32_t len;
69 const void* data = desc->findEntry(tag, &len); 68 const void* data = desc->findEntry(tag, &len);
70 69
71 if (data) { 70 if (data) {
72 SkReadBuffer buffer(data, len); 71 SkReadBuffer buffer(data, len);
73 obj = buffer.readFlattenable(ft); 72 obj = buffer.readFlattenable();
74 SkASSERT(buffer.offset() == buffer.size()); 73 SkASSERT(buffer.offset() == buffer.size());
75 } 74 }
76 return obj; 75 return obj;
77 } 76 }
78 77
79 SkScalerContext::SkScalerContext(SkTypeface* typeface, const SkDescriptor* desc) 78 SkScalerContext::SkScalerContext(SkTypeface* typeface, const SkDescriptor* desc)
80 : fRec(*static_cast<const Rec*>(desc->findEntry(kRec_SkDescriptorTag, nullpt r))) 79 : fRec(*static_cast<const Rec*>(desc->findEntry(kRec_SkDescriptorTag, nullpt r)))
81 80
82 , fTypeface(SkRef(typeface)) 81 , fTypeface(SkRef(typeface))
83 , fPathEffect(static_cast<SkPathEffect*>(load_flattenable(desc, kPathEffect_ SkDescriptorTag, 82 , fPathEffect(static_cast<SkPathEffect*>(load_flattenable(desc, kPathEffect_ SkDescriptorTag)))
84 SkFlattenable::kSkPathEffect_Type)) ) 83 , fMaskFilter(static_cast<SkMaskFilter*>(load_flattenable(desc, kMaskFilter_ SkDescriptorTag)))
85 , fMaskFilter(static_cast<SkMaskFilter*>(load_flattenable(desc, kMaskFilter_ SkDescriptorTag, 84 , fRasterizer(static_cast<SkRasterizer*>(load_flattenable(desc, kRasterizer_ SkDescriptorTag)))
86 SkFlattenable::kSkMaskFilter_Type)) )
87 , fRasterizer(static_cast<SkRasterizer*>(load_flattenable(desc, kRasterizer_ SkDescriptorTag,
88 SkFlattenable::kSkRasterizer_Type)) )
89 // Initialize based on our settings. Subclasses can also force this. 85 // Initialize based on our settings. Subclasses can also force this.
90 , fGenerateImageFromPath(fRec.fFrameWidth > 0 || fPathEffect != nullptr || f Rasterizer != nullptr) 86 , fGenerateImageFromPath(fRec.fFrameWidth > 0 || fPathEffect != nullptr || f Rasterizer != nullptr)
91 87
92 , fPreBlend(fMaskFilter ? SkMaskGamma::PreBlend() : SkScalerContext::GetMask PreBlend(fRec)) 88 , fPreBlend(fMaskFilter ? SkMaskGamma::PreBlend() : SkScalerContext::GetMask PreBlend(fRec))
93 , fPreBlendForFilter(fMaskFilter ? SkScalerContext::GetMaskPreBlend(fRec) 89 , fPreBlendForFilter(fMaskFilter ? SkScalerContext::GetMaskPreBlend(fRec)
94 : SkMaskGamma::PreBlend()) 90 : SkMaskGamma::PreBlend())
95 { 91 {
96 #ifdef DUMP_REC 92 #ifdef DUMP_REC
97 desc->assertChecksum(); 93 desc->assertChecksum();
98 SkDebugf("SkScalerContext checksum %x count %d length %d\n", 94 SkDebugf("SkScalerContext checksum %x count %d length %d\n",
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 876
881 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc, 877 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc,
882 bool allowFailure) const { 878 bool allowFailure) const {
883 SkScalerContext* c = this->onCreateScalerContext(desc); 879 SkScalerContext* c = this->onCreateScalerContext(desc);
884 880
885 if (!c && !allowFailure) { 881 if (!c && !allowFailure) {
886 c = new SkScalerContext_Empty(const_cast<SkTypeface*>(this), desc); 882 c = new SkScalerContext_Empty(const_cast<SkTypeface*>(this), desc);
887 } 883 }
888 return c; 884 return c;
889 } 885 }
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