| Index: include/gpu/GrTexture.h
|
| diff --git a/include/gpu/GrTexture.h b/include/gpu/GrTexture.h
|
| index ddba94065be2600847422bc887b89db46f62f9a0..d565f2f9a7353faf9ec2839fc2e43c0f754ad964 100644
|
| --- a/include/gpu/GrTexture.h
|
| +++ b/include/gpu/GrTexture.h
|
| @@ -70,4 +70,43 @@
|
| typedef GrSurface INHERITED;
|
| };
|
|
|
| +/**
|
| + * Represents a texture that is intended to be accessed in device coords with an offset.
|
| + */
|
| +class GrDeviceCoordTexture {
|
| +public:
|
| + GrDeviceCoordTexture() { fOffset.set(0, 0); }
|
| +
|
| + GrDeviceCoordTexture(const GrDeviceCoordTexture& other) {
|
| + *this = other;
|
| + }
|
| +
|
| + GrDeviceCoordTexture(GrTexture* texture, const SkIPoint& offset)
|
| + : fTexture(SkSafeRef(texture))
|
| + , fOffset(offset) {
|
| + }
|
| +
|
| + GrDeviceCoordTexture& operator=(const GrDeviceCoordTexture& other) {
|
| + fTexture.reset(SkSafeRef(other.fTexture.get()));
|
| + fOffset = other.fOffset;
|
| + return *this;
|
| + }
|
| +
|
| + const SkIPoint& offset() const { return fOffset; }
|
| +
|
| + void setOffset(const SkIPoint& offset) { fOffset = offset; }
|
| + void setOffset(int ox, int oy) { fOffset.set(ox, oy); }
|
| +
|
| + GrTexture* texture() const { return fTexture.get(); }
|
| +
|
| + GrTexture* setTexture(GrTexture* texture) {
|
| + fTexture.reset(SkSafeRef(texture));
|
| + return texture;
|
| + }
|
| +
|
| +private:
|
| + SkAutoTUnref<GrTexture> fTexture;
|
| + SkIPoint fOffset;
|
| +};
|
| +
|
| #endif
|
|
|