1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/trunk/src/effects/gradients/SkTwoPointRadialGradient.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,55 @@ 1.4 + 1.5 +/* 1.6 + * Copyright 2012 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 + #ifndef SkTwoPointRadialGradient_DEFINED 1.13 + #define SkTwoPointRadialGradient_DEFINED 1.14 + 1.15 + #include "SkGradientShaderPriv.h" 1.16 + 1.17 +class SkTwoPointRadialGradient : public SkGradientShaderBase { 1.18 +public: 1.19 + SkTwoPointRadialGradient(const SkPoint& start, SkScalar startRadius, 1.20 + const SkPoint& end, SkScalar endRadius, 1.21 + const Descriptor&); 1.22 + 1.23 + virtual BitmapType asABitmap(SkBitmap* bitmap, 1.24 + SkMatrix* matrix, 1.25 + TileMode* xy) const SK_OVERRIDE; 1.26 + virtual GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE; 1.27 + virtual GrEffectRef* asNewEffect(GrContext* context, const SkPaint&) const SK_OVERRIDE; 1.28 + 1.29 + virtual void shadeSpan(int x, int y, SkPMColor* dstCParam, 1.30 + int count) SK_OVERRIDE; 1.31 + virtual bool setContext(const SkBitmap& device, 1.32 + const SkPaint& paint, 1.33 + const SkMatrix& matrix) SK_OVERRIDE; 1.34 + 1.35 + SkScalar getCenterX1() const { return fDiff.length(); } 1.36 + SkScalar getStartRadius() const { return fStartRadius; } 1.37 + SkScalar getDiffRadius() const { return fDiffRadius; } 1.38 + 1.39 + SK_TO_STRING_OVERRIDE() 1.40 + SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTwoPointRadialGradient) 1.41 + 1.42 +protected: 1.43 + SkTwoPointRadialGradient(SkReadBuffer& buffer); 1.44 + virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE; 1.45 + 1.46 +private: 1.47 + typedef SkGradientShaderBase INHERITED; 1.48 + const SkPoint fCenter1; 1.49 + const SkPoint fCenter2; 1.50 + const SkScalar fRadius1; 1.51 + const SkScalar fRadius2; 1.52 + SkPoint fDiff; 1.53 + SkScalar fStartRadius, fDiffRadius, fSr2D2, fA, fOneOverTwoA; 1.54 + 1.55 + void init(); 1.56 +}; 1.57 + 1.58 +#endif