| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #ifndef GrTexture_DEFINED | 9 #ifndef GrTexture_DEFINED |
| 10 #define GrTexture_DEFINED | 10 #define GrTexture_DEFINED |
| 11 | 11 |
| 12 #include "GrSurface.h" | 12 #include "GrSurface.h" |
| 13 #include "GrRenderTarget.h" | 13 #include "GrRenderTarget.h" |
| 14 #include "SkPoint.h" | 14 #include "SkPoint.h" |
| 15 #include "SkRefCnt.h" | 15 #include "SkRefCnt.h" |
| 16 | 16 |
| 17 class GrResourceKey; | 17 class GrResourceKey; |
| 18 class GrTextureParams; | 18 class GrTextureParams; |
| 19 class GrTexturePriv; | 19 class GrTexturePriv; |
| 20 | 20 |
| 21 class GrTexture : public GrSurface { | 21 class GrTexture : public GrSurface { |
| 22 public: | 22 public: |
| 23 /** | 23 /** |
| 24 * Approximate number of bytes used by the texture | 24 * Approximate number of bytes used by the texture |
| 25 */ | 25 */ |
| 26 virtual size_t gpuMemorySize() const SK_OVERRIDE; | 26 virtual size_t gpuMemorySize() const SK_OVERRIDE; |
| 27 | 27 |
| 28 // GrSurface overrides | |
| 29 virtual bool readPixels(int left, int top, int width, int height, | |
| 30 GrPixelConfig config, | |
| 31 void* buffer, | |
| 32 size_t rowBytes = 0, | |
| 33 uint32_t pixelOpsFlags = 0) SK_OVERRIDE; | |
| 34 | |
| 35 virtual void writePixels(int left, int top, int width, int height, | |
| 36 GrPixelConfig config, | |
| 37 const void* buffer, | |
| 38 size_t rowBytes = 0, | |
| 39 uint32_t pixelOpsFlags = 0) SK_OVERRIDE; | |
| 40 | |
| 41 virtual GrTexture* asTexture() SK_OVERRIDE { return this; } | 28 virtual GrTexture* asTexture() SK_OVERRIDE { return this; } |
| 42 virtual const GrTexture* asTexture() const SK_OVERRIDE { return this; } | 29 virtual const GrTexture* asTexture() const SK_OVERRIDE { return this; } |
| 43 virtual GrRenderTarget* asRenderTarget() SK_OVERRIDE { return fRenderTarget.
get(); } | 30 virtual GrRenderTarget* asRenderTarget() SK_OVERRIDE { return fRenderTarget.
get(); } |
| 44 virtual const GrRenderTarget* asRenderTarget() const SK_OVERRIDE { return fR
enderTarget.get(); } | 31 virtual const GrRenderTarget* asRenderTarget() const SK_OVERRIDE { return fR
enderTarget.get(); } |
| 45 | 32 |
| 46 /** | 33 /** |
| 47 * Return the native ID or handle to the texture, depending on the | 34 * Return the native ID or handle to the texture, depending on the |
| 48 * platform. e.g. on OpenGL, return the texture ID. | 35 * platform. e.g. on OpenGL, return the texture ID. |
| 49 */ | 36 */ |
| 50 virtual GrBackendObject getTextureHandle() const = 0; | 37 virtual GrBackendObject getTextureHandle() const = 0; |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 fTexture.reset(SkSafeRef(texture)); | 138 fTexture.reset(SkSafeRef(texture)); |
| 152 return texture; | 139 return texture; |
| 153 } | 140 } |
| 154 | 141 |
| 155 private: | 142 private: |
| 156 SkAutoTUnref<GrTexture> fTexture; | 143 SkAutoTUnref<GrTexture> fTexture; |
| 157 SkIPoint fOffset; | 144 SkIPoint fOffset; |
| 158 }; | 145 }; |
| 159 | 146 |
| 160 #endif | 147 #endif |
| OLD | NEW |