author Lee Salzman <>
Tue, 09 Feb 2016 13:38:06 -0500
changeset 283658 159e0a5a653f2789e0c9b94f41501a4a44f7cb34
parent 276800 gfx/skia/skia/src/gpu/GrFontScaler.h@aa380501527094672fd84092655f82e62c504482
child 295372 cf560124d28f3737353c105eec79677a7731d2e8
permissions -rw-r--r--
Bug 1246756 - part 3 - update Skia to m49 branch. r=jrmuizel

 * Copyright 2010 Google Inc.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.

#ifndef GrFontScaler_DEFINED
#define GrFontScaler_DEFINED

#include "GrGlyph.h"
#include "GrTypes.h"

#include "SkDescriptor.h"

class SkGlyph;
class SkPath;

 *  Wrapper class to turn a font cache descriptor into a key 
 *  for GrFontScaler-related lookups
class GrFontDescKey : public SkRefCnt {
    explicit GrFontDescKey(const SkDescriptor& desc) : fDesc(desc), fHash(desc.getChecksum()) {}
    uint32_t getHash() const { return fHash; }

    bool operator==(const GrFontDescKey& rh) const {
        return fHash == rh.fHash && fDesc.getDesc()->equals(*rh.fDesc.getDesc());
    SkAutoDescriptor fDesc;
    uint32_t fHash;
    typedef SkRefCnt INHERITED;

 *  This is Gr's interface to the host platform's font scaler.
 *  The client is responsible for instantiating this. The instance is created 
 *  for a specific font+size+matrix.
class GrFontScaler : public SkRefCnt {
    explicit GrFontScaler(SkGlyphCache* strike);
    virtual ~GrFontScaler();
    const GrFontDescKey* getKey();
    GrMaskFormat getMaskFormat() const;
    GrMaskFormat getPackedGlyphMaskFormat(const SkGlyph&) const;
    bool getPackedGlyphBounds(const SkGlyph&, SkIRect* bounds);
    bool getPackedGlyphImage(const SkGlyph&, int width, int height, int rowBytes,
                             GrMaskFormat expectedMaskFormat, void* image);
    bool getPackedGlyphDFBounds(const SkGlyph&, SkIRect* bounds);
    bool getPackedGlyphDFImage(const SkGlyph&, int width, int height, void* image);
    const SkPath* getGlyphPath(const SkGlyph&);
    const SkGlyph& grToSkGlyph(GrGlyph::PackedID);
    SkGlyphCache*  fStrike;
    GrFontDescKey* fKey;
    typedef SkRefCnt INHERITED;