Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* |
michael@0 | 2 | * Copyright 2010 Google Inc. |
michael@0 | 3 | * |
michael@0 | 4 | * Use of this source code is governed by a BSD-style license that can be |
michael@0 | 5 | * found in the LICENSE file. |
michael@0 | 6 | */ |
michael@0 | 7 | |
michael@0 | 8 | #ifndef GrTextContext_DEFINED |
michael@0 | 9 | #define GrTextContext_DEFINED |
michael@0 | 10 | |
michael@0 | 11 | #include "GrPoint.h" |
michael@0 | 12 | #include "GrGlyph.h" |
michael@0 | 13 | #include "GrPaint.h" |
michael@0 | 14 | #include "SkDeviceProperties.h" |
michael@0 | 15 | |
michael@0 | 16 | #include "SkPostConfig.h" |
michael@0 | 17 | |
michael@0 | 18 | class GrContext; |
michael@0 | 19 | class GrDrawTarget; |
michael@0 | 20 | class GrFontScaler; |
michael@0 | 21 | |
michael@0 | 22 | /* |
michael@0 | 23 | * This class wraps the state for a single text render |
michael@0 | 24 | */ |
michael@0 | 25 | class GrTextContext { |
michael@0 | 26 | public: |
michael@0 | 27 | virtual ~GrTextContext() {} |
michael@0 | 28 | virtual void drawText(const GrPaint&, const SkPaint&, const char text[], size_t byteLength, |
michael@0 | 29 | SkScalar x, SkScalar y) = 0; |
michael@0 | 30 | virtual void drawPosText(const GrPaint&, const SkPaint&, |
michael@0 | 31 | const char text[], size_t byteLength, |
michael@0 | 32 | const SkScalar pos[], SkScalar constY, |
michael@0 | 33 | int scalarsPerPosition) = 0; |
michael@0 | 34 | |
michael@0 | 35 | virtual bool canDraw(const SkPaint& paint) = 0; |
michael@0 | 36 | |
michael@0 | 37 | protected: |
michael@0 | 38 | GrTextContext(GrContext*, const SkDeviceProperties&); |
michael@0 | 39 | |
michael@0 | 40 | static GrFontScaler* GetGrFontScaler(SkGlyphCache* cache); |
michael@0 | 41 | static void MeasureText(SkGlyphCache* cache, SkDrawCacheProc glyphCacheProc, |
michael@0 | 42 | const char text[], size_t byteLength, SkVector* stopVector); |
michael@0 | 43 | |
michael@0 | 44 | void init(const GrPaint&, const SkPaint&); |
michael@0 | 45 | void finish() { fDrawTarget = NULL; } |
michael@0 | 46 | |
michael@0 | 47 | GrContext* fContext; |
michael@0 | 48 | SkDeviceProperties fDeviceProperties; |
michael@0 | 49 | |
michael@0 | 50 | GrDrawTarget* fDrawTarget; |
michael@0 | 51 | SkIRect fClipRect; |
michael@0 | 52 | GrPaint fPaint; |
michael@0 | 53 | SkPaint fSkPaint; |
michael@0 | 54 | }; |
michael@0 | 55 | |
michael@0 | 56 | #endif |