gfx/skia/trunk/include/gpu/SkGr.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/skia/trunk/include/gpu/SkGr.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,99 @@
     1.4 +
     1.5 +/*
     1.6 + * Copyright 2010 Google Inc.
     1.7 + *
     1.8 + * Use of this source code is governed by a BSD-style license that can be
     1.9 + * found in the LICENSE file.
    1.10 + */
    1.11 +
    1.12 +
    1.13 +
    1.14 +#ifndef SkGr_DEFINED
    1.15 +#define SkGr_DEFINED
    1.16 +
    1.17 +#include <stddef.h>
    1.18 +
    1.19 +// Gr headers
    1.20 +#include "GrTypes.h"
    1.21 +#include "GrContext.h"
    1.22 +#include "GrFontScaler.h"
    1.23 +
    1.24 +// skia headers
    1.25 +#include "SkBitmap.h"
    1.26 +#include "SkPath.h"
    1.27 +#include "SkPoint.h"
    1.28 +#include "SkRegion.h"
    1.29 +#include "SkClipStack.h"
    1.30 +
    1.31 +////////////////////////////////////////////////////////////////////////////////
    1.32 +// Sk to Gr Type conversions
    1.33 +
    1.34 +GR_STATIC_ASSERT((int)kZero_GrBlendCoeff == (int)SkXfermode::kZero_Coeff);
    1.35 +GR_STATIC_ASSERT((int)kOne_GrBlendCoeff  == (int)SkXfermode::kOne_Coeff);
    1.36 +GR_STATIC_ASSERT((int)kSC_GrBlendCoeff   == (int)SkXfermode::kSC_Coeff);
    1.37 +GR_STATIC_ASSERT((int)kISC_GrBlendCoeff  == (int)SkXfermode::kISC_Coeff);
    1.38 +GR_STATIC_ASSERT((int)kDC_GrBlendCoeff   == (int)SkXfermode::kDC_Coeff);
    1.39 +GR_STATIC_ASSERT((int)kIDC_GrBlendCoeff  == (int)SkXfermode::kIDC_Coeff);
    1.40 +GR_STATIC_ASSERT((int)kSA_GrBlendCoeff   == (int)SkXfermode::kSA_Coeff);
    1.41 +GR_STATIC_ASSERT((int)kISA_GrBlendCoeff  == (int)SkXfermode::kISA_Coeff);
    1.42 +GR_STATIC_ASSERT((int)kDA_GrBlendCoeff   == (int)SkXfermode::kDA_Coeff);
    1.43 +GR_STATIC_ASSERT((int)kIDA_GrBlendCoeff  == (int)SkXfermode::kIDA_Coeff);
    1.44 +
    1.45 +#define sk_blend_to_grblend(X) ((GrBlendCoeff)(X))
    1.46 +
    1.47 +///////////////////////////////////////////////////////////////////////////////
    1.48 +
    1.49 +#include "SkColorPriv.h"
    1.50 +
    1.51 +/**
    1.52 + *  Convert the SkBitmap::Config to the corresponding PixelConfig, or
    1.53 + *  kUnknown_PixelConfig if the conversion cannot be done.
    1.54 + */
    1.55 +GrPixelConfig SkBitmapConfig2GrPixelConfig(SkBitmap::Config);
    1.56 +GrPixelConfig SkImageInfo2GrPixelConfig(SkColorType, SkAlphaType);
    1.57 +bool GrPixelConfig2ColorType(GrPixelConfig, SkColorType*);
    1.58 +
    1.59 +static inline GrColor SkColor2GrColor(SkColor c) {
    1.60 +    SkPMColor pm = SkPreMultiplyColor(c);
    1.61 +    unsigned r = SkGetPackedR32(pm);
    1.62 +    unsigned g = SkGetPackedG32(pm);
    1.63 +    unsigned b = SkGetPackedB32(pm);
    1.64 +    unsigned a = SkGetPackedA32(pm);
    1.65 +    return GrColorPackRGBA(r, g, b, a);
    1.66 +}
    1.67 +
    1.68 +////////////////////////////////////////////////////////////////////////////////
    1.69 +
    1.70 +bool GrIsBitmapInCache(const GrContext*, const SkBitmap&, const GrTextureParams*);
    1.71 +
    1.72 +GrTexture* GrLockAndRefCachedBitmapTexture(GrContext*, const SkBitmap&, const GrTextureParams*);
    1.73 +
    1.74 +void GrUnlockAndUnrefCachedBitmapTexture(GrTexture*);
    1.75 +
    1.76 +////////////////////////////////////////////////////////////////////////////////
    1.77 +// Classes
    1.78 +
    1.79 +class SkGlyphCache;
    1.80 +
    1.81 +class SkGrFontScaler : public GrFontScaler {
    1.82 +public:
    1.83 +    explicit SkGrFontScaler(SkGlyphCache* strike);
    1.84 +    virtual ~SkGrFontScaler();
    1.85 +
    1.86 +    // overrides
    1.87 +    virtual const GrKey* getKey();
    1.88 +    virtual GrMaskFormat getMaskFormat();
    1.89 +    virtual bool getPackedGlyphBounds(GrGlyph::PackedID, SkIRect* bounds);
    1.90 +    virtual bool getPackedGlyphImage(GrGlyph::PackedID, int width, int height,
    1.91 +                                     int rowBytes, void* image);
    1.92 +    virtual bool getGlyphPath(uint16_t glyphID, SkPath*);
    1.93 +
    1.94 +private:
    1.95 +    SkGlyphCache* fStrike;
    1.96 +    GrKey*  fKey;
    1.97 +//    DECLARE_INSTANCE_COUNTER(SkGrFontScaler);
    1.98 +};
    1.99 +
   1.100 +////////////////////////////////////////////////////////////////////////////////
   1.101 +
   1.102 +#endif

mercurial