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

Side by Side Diff: src/gpu/GrSurfacePriv.h

Issue 596053002: Make "priv" classes for GrTexure and GrSurface. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 2 months 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
(Empty)
1 /*
2 * Copyright 2014 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #ifndef GrSurfacePriv_DEFINED
9 #define GrSurfacePriv_DEFINED
10
11 #include "GrSurface.h"
12 #include "SkRefCnt.h"
13
14 /** Class that adds methods to GrSurface that are only intended for use internal to Skia. */
robertphillips 2014/09/29 13:34:27 // It should never get additional member variables
bsalomon 2014/09/29 18:42:10 Done.
15 class GrSurfacePriv : SkNoncopyable {
16 public:
17 /**
18 * Derive a SkImageInfo from the surface's descriptor. This is lossy as Imag eInfo has fields not
19 * known to GrSurface (e.g. alphaType).
20 */
21 SkImageInfo info() const { return fSurface->info(); }
22
23 /**
24 * Checks whether this GrSurface refers to the same GPU object as other. Thi s
25 * catches the case where a GrTexture and GrRenderTarget refer to the same
26 * GPU memory.
27 */
28 bool isSameAs(const GrSurface* other) const { return fSurface->isSameAs(othe r); }
29
robertphillips 2014/09/29 13:34:28 Should this be DEVELOPER only ?
bsalomon 2014/09/29 18:42:10 Maybe, let's leave that to a future CL. Added a co
30 /**
31 * Write the contents of the surface to a PNG. Returns true if successful.
32 * @param filename Full path to desired file
33 */
34 bool savePixels(const char* filename) { return fSurface->savePixels(filename ); }
35
36 bool hasPendingRead() const { return fSurface->hasPendingRead(); }
37 bool hasPendingWrite() const { return fSurface->hasPendingWrite(); }
38 bool hasPendingIO() const { return fSurface->hasPendingIO(); }
39
40 private:
41 GrSurfacePriv(GrSurface* surface) : fSurface(surface) { }
42
43 // No taking addresses of this type.
44 const GrSurfacePriv* operator&() const;
45 GrSurfacePriv* operator&();
46
47 GrSurface* fSurface;
48
robertphillips 2014/09/29 13:34:27 // For access to ctor. ?
bsalomon 2014/09/29 18:42:10 Done.
49 friend class GrSurface;
50 };
51
52 inline GrSurfacePriv GrSurface::surfacePriv() { return GrSurfacePriv(this); }
53
54 inline const GrSurfacePriv GrSurface::surfacePriv() const {
55 return GrSurfacePriv(const_cast<GrSurface*>(this));
56 }
57
58 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698