Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Side by Side Diff: include/gpu/GrSurface.h

Issue 695813003: Add class GrGLTextureRenderTarget for GL texture/rendertarget objects (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: cleanup Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 8
9 #ifndef GrSurface_DEFINED 9 #ifndef GrSurface_DEFINED
10 #define GrSurface_DEFINED 10 #define GrSurface_DEFINED
11 11
12 #include "GrTypes.h" 12 #include "GrTypes.h"
13 #include "GrGpuResource.h" 13 #include "GrGpuResource.h"
14 #include "SkImageInfo.h" 14 #include "SkImageInfo.h"
15 #include "SkRect.h" 15 #include "SkRect.h"
16 16
17 class GrRenderTarget; 17 class GrRenderTarget;
18 class GrSurfacePriv; 18 class GrSurfacePriv;
19 class GrTexture; 19 class GrTexture;
20 20
21 class GrSurface : public GrGpuResource { 21 class GrSurface : public GrGpuResource {
22 public: 22 public:
23 SK_DECLARE_INST_COUNT(GrSurface); 23 SK_DECLARE_INST_COUNT(GrSurface);
24 24
25 /** 25 /**
26 * Retrieves the width of the surface. 26 * Retrieves the width of the surface.
27 *
28 * @return the width in texels
29 */ 27 */
30 int width() const { return fDesc.fWidth; } 28 int width() const { return fDesc.fWidth; }
31 29
32 /** 30 /**
33 * Retrieves the height of the surface. 31 * Retrieves the height of the surface.
34 *
35 * @return the height in texels
36 */ 32 */
37 int height() const { return fDesc.fHeight; } 33 int height() const { return fDesc.fHeight; }
38 34
39 /** 35 /**
40 * Helper that gets the width and height of the surface as a bounding rectan gle. 36 * Helper that gets the width and height of the surface as a bounding rectan gle.
41 */ 37 */
42 void getBoundsRect(SkRect* rect) const { rect->setWH(SkIntToScalar(this->wid th()), 38 void getBoundsRect(SkRect* rect) const { rect->setWH(SkIntToScalar(this->wid th()),
43 SkIntToScalar(this->hei ght())); } 39 SkIntToScalar(this->hei ght())); }
44 40
45 GrSurfaceOrigin origin() const { 41 GrSurfaceOrigin origin() const {
(...skipping 10 matching lines...) Expand all
56 GrPixelConfig config() const { return fDesc.fConfig; } 52 GrPixelConfig config() const { return fDesc.fConfig; }
57 53
58 /** 54 /**
59 * Return the descriptor describing the surface 55 * Return the descriptor describing the surface
60 */ 56 */
61 const GrSurfaceDesc& desc() const { return fDesc; } 57 const GrSurfaceDesc& desc() const { return fDesc; }
62 58
63 /** 59 /**
64 * @return the texture associated with the surface, may be NULL. 60 * @return the texture associated with the surface, may be NULL.
65 */ 61 */
66 virtual GrTexture* asTexture() = 0; 62 virtual GrTexture* asTexture() { return NULL; }
67 virtual const GrTexture* asTexture() const = 0; 63 virtual const GrTexture* asTexture() const { return NULL; }
68 64
69 /** 65 /**
70 * @return the render target underlying this surface, may be NULL. 66 * @return the render target underlying this surface, may be NULL.
71 */ 67 */
72 virtual GrRenderTarget* asRenderTarget() = 0; 68 virtual GrRenderTarget* asRenderTarget() { return NULL; }
73 virtual const GrRenderTarget* asRenderTarget() const = 0; 69 virtual const GrRenderTarget* asRenderTarget() const { return NULL; }
74 70
75 /** 71 /**
76 * Reads a rectangle of pixels from the surface. 72 * Reads a rectangle of pixels from the surface.
77 * @param left left edge of the rectangle to read (inclusive) 73 * @param left left edge of the rectangle to read (inclusive)
78 * @param top top edge of the rectangle to read (inclusive) 74 * @param top top edge of the rectangle to read (inclusive)
79 * @param width width of rectangle to read in pixels. 75 * @param width width of rectangle to read in pixels.
80 * @param height height of rectangle to read in pixels. 76 * @param height height of rectangle to read in pixels.
81 * @param config the pixel config of the destination buffer 77 * @param config the pixel config of the destination buffer
82 * @param buffer memory to read the rectangle into. 78 * @param buffer memory to read the rectangle into.
83 * @param rowBytes number of bytes between consecutive rows. Zero means rows are tightly 79 * @param rowBytes number of bytes between consecutive rows. Zero means rows are tightly
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 , fDesc(desc) { 137 , fDesc(desc) {
142 } 138 }
143 139
144 GrSurfaceDesc fDesc; 140 GrSurfaceDesc fDesc;
145 141
146 private: 142 private:
147 typedef GrGpuResource INHERITED; 143 typedef GrGpuResource INHERITED;
148 }; 144 };
149 145
150 #endif 146 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698