diff options
author | senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-01-28 16:42:38 +0000 |
---|---|---|
committer | senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-01-28 16:42:38 +0000 |
commit | ef5dbe1cd90fe586f165e54cb6f7608942610793 (patch) | |
tree | d3634e1c6676c96145f8047c17d94fb8b6e5f11f /include | |
parent | 02ddc8b85ace91b15feb329a6a1d5d62b2b846c6 (diff) |
Add an origin flag for backend (external) textures. Some textures in WebKit have a topdown orientation, and skia needs to be notified of this, so that they are not drawn upside-down.
Review URL: https://codereview.appspot.com/7200048
git-svn-id: http://skia.googlecode.com/svn/trunk@7414 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r-- | include/gpu/GrRenderTarget.h | 2 | ||||
-rw-r--r-- | include/gpu/GrSurface.h | 19 | ||||
-rw-r--r-- | include/gpu/GrTexture.h | 2 | ||||
-rw-r--r-- | include/gpu/GrTypes.h | 12 |
4 files changed, 18 insertions, 17 deletions
diff --git a/include/gpu/GrRenderTarget.h b/include/gpu/GrRenderTarget.h index 4e77466b9a..19a37a5d8b 100644 --- a/include/gpu/GrRenderTarget.h +++ b/include/gpu/GrRenderTarget.h @@ -142,7 +142,7 @@ protected: bool isWrapped, GrTexture* texture, const GrTextureDesc& desc, - Origin origin) + GrSurfaceOrigin origin) : INHERITED(gpu, isWrapped, desc, origin) , fStencilBuffer(NULL) , fTexture(texture) { diff --git a/include/gpu/GrSurface.h b/include/gpu/GrSurface.h index 4ef0acb82e..8ccbc9833b 100644 --- a/include/gpu/GrSurface.h +++ b/include/gpu/GrSurface.h @@ -33,19 +33,8 @@ public: */ int height() const { return fDesc.fHeight; } - /** - * Some surfaces will be stored such that the upper and left edges of the content meet at the - * the origin (in texture coord space) and for other surfaces the lower and left edges meet at - * the origin. Render-targets are always consistent with the convention of the underlying - * backend API to make it easier to mix native backend rendering with Skia rendering. Wrapped - * backend surfaces always use the backend's convention as well. - */ - enum Origin { - kTopLeft_Origin, - kBottomLeft_Origin, - }; - Origin origin() const { - GrAssert(kTopLeft_Origin == fOrigin || kBottomLeft_Origin == fOrigin); + GrSurfaceOrigin origin() const { + GrAssert(kTopLeft_SurfaceOrigin == fOrigin || kBottomLeft_SurfaceOrigin == fOrigin); return fOrigin; } @@ -115,7 +104,7 @@ public: uint32_t pixelOpsFlags = 0) = 0; protected: - GrSurface(GrGpu* gpu, bool isWrapped, const GrTextureDesc& desc, Origin origin) + GrSurface(GrGpu* gpu, bool isWrapped, const GrTextureDesc& desc, GrSurfaceOrigin origin) : INHERITED(gpu, isWrapped) , fDesc(desc) , fOrigin(origin) { @@ -124,7 +113,7 @@ protected: GrTextureDesc fDesc; private: - Origin fOrigin; + GrSurfaceOrigin fOrigin; typedef GrResource INHERITED; }; diff --git a/include/gpu/GrTexture.h b/include/gpu/GrTexture.h index 657e6e5078..94d578894b 100644 --- a/include/gpu/GrTexture.h +++ b/include/gpu/GrTexture.h @@ -140,7 +140,7 @@ protected: // base class cons sets to NULL // subclass cons can create and set - GrTexture(GrGpu* gpu, bool isWrapped, const GrTextureDesc& desc, Origin origin) + GrTexture(GrGpu* gpu, bool isWrapped, const GrTextureDesc& desc, GrSurfaceOrigin origin) : INHERITED(gpu, isWrapped, desc, origin) , fRenderTarget(NULL) { diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h index d7241b499c..055750dd11 100644 --- a/include/gpu/GrTypes.h +++ b/include/gpu/GrTypes.h @@ -425,6 +425,17 @@ enum { kGrColorTableSize = 256 * 4 //sizeof(GrColor) }; +/** + * Some textures will be stored such that the upper and left edges of the content meet at the + * the origin (in texture coord space) and for other textures the lower and left edges meet at + * the origin. Render-targets are always consistent with the convention of the underlying + * backend API to make it easier to mix native backend rendering with Skia rendering. + */ + +enum GrSurfaceOrigin { + kBottomLeft_GrSurfaceOrigin, + kTopLeft_GrSurfaceOrigin, +}; /** * Describes a texture to be created. @@ -596,6 +607,7 @@ GR_MAKE_BITFIELD_OPS(GrBackendTextureFlags) struct GrBackendTextureDesc { GrBackendTextureDesc() { memset(this, 0, sizeof(*this)); } GrBackendTextureFlags fFlags; + GrSurfaceOrigin fOrigin; int fWidth; //<! width in pixels int fHeight; //<! height in pixels GrPixelConfig fConfig; //<! color format |