X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fthird_party%2Fskia%2Finclude%2Fgpu%2FGrCoordTransform.h;h=718bbe774f5f24ad7ef02c6a1119b1ef49dce8da;hb=3545e9f2671f595d2a2f3ee75ca0393b01e35ef6;hp=f266577ec62b8d027f307b594a1ab1e574b59402;hpb=7d210d4c7e9ba36e635eabc5b5780495f8a63292;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/third_party/skia/include/gpu/GrCoordTransform.h b/src/third_party/skia/include/gpu/GrCoordTransform.h index f266577..718bbe7 100644 --- a/src/third_party/skia/include/gpu/GrCoordTransform.h +++ b/src/third_party/skia/include/gpu/GrCoordTransform.h @@ -8,13 +8,13 @@ #ifndef GrCoordTransform_DEFINED #define GrCoordTransform_DEFINED -#include "GrEffect.h" +#include "GrProcessor.h" #include "SkMatrix.h" #include "GrTexture.h" #include "GrTypes.h" /** - * Coordinates available to GrEffect subclasses for requesting transformations. Transformed + * Coordinates available to GrProcessor subclasses for requesting transformations. Transformed * coordinates are made available in the the portion of fragment shader emitted by the effect. */ enum GrCoordSet { @@ -22,21 +22,21 @@ enum GrCoordSet { * The user-space coordinates that map to the fragment being rendered. These coords account for * any change of coordinate system done on the CPU by GrContext before rendering, and also are * correct for draws that take explicit local coords rather than inferring them from the - * primitive's positions (e.g. drawVertices). These are usually the coords a GrEffect wants. + * primitive's positions (e.g. drawVertices). These are usually the coords a GrProcessor wants. */ kLocal_GrCoordSet, /** * The actual vertex position. Note that GrContext may not draw using the original view matrix * specified by the caller, as it may have transformed vertices into another space. These are - * usually not the coordinates a GrEffect wants. + * usually not the coordinates a GrProcessor wants. */ kPosition_GrCoordSet }; /** * A class representing a linear transformation from one of the built-in coordinate sets (local or - * position). GrEffects just define these transformations, and the framework does the rest of the + * position). GrProcessors just define these transformations, and the framework does the rest of the * work to make the transformed coordinates available in their fragment shader. */ class GrCoordTransform : SkNoncopyable { @@ -63,15 +63,15 @@ public: void reset(GrCoordSet sourceCoords, const GrTexture* texture) { SkASSERT(!fInEffect); - SkASSERT(NULL != texture); - this->reset(sourceCoords, GrEffect::MakeDivByTextureWHMatrix(texture), texture); + SkASSERT(texture); + this->reset(sourceCoords, MakeDivByTextureWHMatrix(texture), texture); } void reset(GrCoordSet sourceCoords, const SkMatrix& m, const GrTexture* texture = NULL) { SkASSERT(!fInEffect); fSourceCoords = sourceCoords; fMatrix = m; - fReverseY = NULL != texture && kBottomLeft_GrSurfaceOrigin == texture->origin(); + fReverseY = texture && kBottomLeft_GrSurfaceOrigin == texture->origin(); } GrCoordTransform& operator= (const GrCoordTransform& other) { @@ -101,6 +101,15 @@ public: const SkMatrix& getMatrix() const { return fMatrix; } bool reverseY() const { return fReverseY; } + /** Useful for effects that want to insert a texture matrix that is implied by the texture + dimensions */ + static inline SkMatrix MakeDivByTextureWHMatrix(const GrTexture* texture) { + SkASSERT(texture); + SkMatrix mat; + mat.setIDiv(texture->width(), texture->height()); + return mat; + } + private: GrCoordSet fSourceCoords; SkMatrix fMatrix;