4212a7d948
This moves the smart pointer use up one more level in preparation for changing SkTypeface::openStream to return unique_ptr as well. Change-Id: Ib8173d59e03de38b06f6e1b4e6776f1961055ae7 Reviewed-on: https://skia-review.googlesource.com/c/195121 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
59 lines
2.2 KiB
C++
59 lines
2.2 KiB
C++
/*
|
|
* Copyright 2015 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#ifndef SkRandomScalerContext_DEFINED
|
|
#define SkRandomScalerContext_DEFINED
|
|
|
|
#include "SkScalerContext.h"
|
|
#include "SkTypeface.h"
|
|
|
|
/*
|
|
* This scaler context is for debug only purposes. It will 'randomly' but deterministically return
|
|
* LCD / A8 / BW / RBGA masks based off of the Glyph ID
|
|
*/
|
|
|
|
class SkRandomTypeface : public SkTypeface {
|
|
public:
|
|
SkRandomTypeface(sk_sp<SkTypeface> proxy, const SkPaint&, bool fakeit);
|
|
|
|
SkTypeface* proxy() const { return fProxy.get(); }
|
|
const SkPaint& paint() const { return fPaint; }
|
|
|
|
protected:
|
|
SkScalerContext* onCreateScalerContext(const SkScalerContextEffects&,
|
|
const SkDescriptor*) const override;
|
|
void onFilterRec(SkScalerContextRec*) const override;
|
|
void getGlyphToUnicodeMap(SkUnichar*) const override;
|
|
std::unique_ptr<SkAdvancedTypefaceMetrics> onGetAdvancedMetrics() const override;
|
|
std::unique_ptr<SkStreamAsset> onOpenStream(int* ttcIndex) const override;
|
|
sk_sp<SkTypeface> onMakeClone(const SkFontArguments& args) const override;
|
|
void onGetFontDescriptor(SkFontDescriptor*, bool* isLocal) const override;
|
|
|
|
int onCharsToGlyphs(const void* chars, Encoding encoding,
|
|
uint16_t glyphs[], int glyphCount) const override;
|
|
int onCountGlyphs() const override;
|
|
int onGetUPEM() const override;
|
|
|
|
void onGetFamilyName(SkString* familyName) const override;
|
|
SkTypeface::LocalizedStrings* onCreateFamilyNameIterator() const override;
|
|
|
|
int onGetVariationDesignPosition(SkFontArguments::VariationPosition::Coordinate coordinates[],
|
|
int coordinateCount) const override;
|
|
int onGetVariationDesignParameters(SkFontParameters::Variation::Axis parameters[],
|
|
int parameterCount) const override;
|
|
int onGetTableTags(SkFontTableTag tags[]) const override;
|
|
size_t onGetTableData(SkFontTableTag, size_t offset,
|
|
size_t length, void* data) const override;
|
|
|
|
private:
|
|
sk_sp<SkTypeface> fProxy;
|
|
SkPaint fPaint;
|
|
bool fFakeIt;
|
|
};
|
|
|
|
#endif
|