1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/trunk/src/gpu/GrTextContext.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,56 @@ 1.4 +/* 1.5 + * Copyright 2010 Google Inc. 1.6 + * 1.7 + * Use of this source code is governed by a BSD-style license that can be 1.8 + * found in the LICENSE file. 1.9 + */ 1.10 + 1.11 +#ifndef GrTextContext_DEFINED 1.12 +#define GrTextContext_DEFINED 1.13 + 1.14 +#include "GrPoint.h" 1.15 +#include "GrGlyph.h" 1.16 +#include "GrPaint.h" 1.17 +#include "SkDeviceProperties.h" 1.18 + 1.19 +#include "SkPostConfig.h" 1.20 + 1.21 +class GrContext; 1.22 +class GrDrawTarget; 1.23 +class GrFontScaler; 1.24 + 1.25 +/* 1.26 + * This class wraps the state for a single text render 1.27 + */ 1.28 +class GrTextContext { 1.29 +public: 1.30 + virtual ~GrTextContext() {} 1.31 + virtual void drawText(const GrPaint&, const SkPaint&, const char text[], size_t byteLength, 1.32 + SkScalar x, SkScalar y) = 0; 1.33 + virtual void drawPosText(const GrPaint&, const SkPaint&, 1.34 + const char text[], size_t byteLength, 1.35 + const SkScalar pos[], SkScalar constY, 1.36 + int scalarsPerPosition) = 0; 1.37 + 1.38 + virtual bool canDraw(const SkPaint& paint) = 0; 1.39 + 1.40 +protected: 1.41 + GrTextContext(GrContext*, const SkDeviceProperties&); 1.42 + 1.43 + static GrFontScaler* GetGrFontScaler(SkGlyphCache* cache); 1.44 + static void MeasureText(SkGlyphCache* cache, SkDrawCacheProc glyphCacheProc, 1.45 + const char text[], size_t byteLength, SkVector* stopVector); 1.46 + 1.47 + void init(const GrPaint&, const SkPaint&); 1.48 + void finish() { fDrawTarget = NULL; } 1.49 + 1.50 + GrContext* fContext; 1.51 + SkDeviceProperties fDeviceProperties; 1.52 + 1.53 + GrDrawTarget* fDrawTarget; 1.54 + SkIRect fClipRect; 1.55 + GrPaint fPaint; 1.56 + SkPaint fSkPaint; 1.57 +}; 1.58 + 1.59 +#endif