OLD | NEW |
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 #include "GrSurface.h" | 8 #include "GrSurface.h" |
9 #include "GrSurfacePriv.h" | 9 #include "GrSurfacePriv.h" |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 if (!SkImageEncoder::EncodeFile(filename, bm, SkImageEncoder::kPNG_Type, 100
)) { | 42 if (!SkImageEncoder::EncodeFile(filename, bm, SkImageEncoder::kPNG_Type, 100
)) { |
43 SkDebugf("------ failed to encode %s\n", filename); | 43 SkDebugf("------ failed to encode %s\n", filename); |
44 remove(filename); // remove any partial file | 44 remove(filename); // remove any partial file |
45 return false; | 45 return false; |
46 } | 46 } |
47 | 47 |
48 return true; | 48 return true; |
49 } | 49 } |
50 | 50 |
| 51 void GrSurface::flushWrites() { |
| 52 if (!this->wasDestroyed()) { |
| 53 this->getContext()->flushSurfaceWrites(this); |
| 54 } |
| 55 } |
| 56 |
51 bool GrSurface::hasPendingRead() const { | 57 bool GrSurface::hasPendingRead() const { |
52 const GrTexture* thisTex = this->asTexture(); | 58 const GrTexture* thisTex = this->asTexture(); |
53 if (thisTex && thisTex->internalHasPendingRead()) { | 59 if (thisTex && thisTex->internalHasPendingRead()) { |
54 return true; | 60 return true; |
55 } | 61 } |
56 const GrRenderTarget* thisRT = this->asRenderTarget(); | 62 const GrRenderTarget* thisRT = this->asRenderTarget(); |
57 if (thisRT && thisRT->internalHasPendingRead()) { | 63 if (thisRT && thisRT->internalHasPendingRead()) { |
58 return true; | 64 return true; |
59 } | 65 } |
60 return false; | 66 return false; |
(...skipping 26 matching lines...) Expand all Loading... |
87 bool GrSurface::isSameAs(const GrSurface* other) const { | 93 bool GrSurface::isSameAs(const GrSurface* other) const { |
88 const GrRenderTarget* thisRT = this->asRenderTarget(); | 94 const GrRenderTarget* thisRT = this->asRenderTarget(); |
89 if (thisRT) { | 95 if (thisRT) { |
90 return thisRT == other->asRenderTarget(); | 96 return thisRT == other->asRenderTarget(); |
91 } else { | 97 } else { |
92 const GrTexture* thisTex = this->asTexture(); | 98 const GrTexture* thisTex = this->asTexture(); |
93 SkASSERT(thisTex); // We must be one or the other | 99 SkASSERT(thisTex); // We must be one or the other |
94 return thisTex == other->asTexture(); | 100 return thisTex == other->asTexture(); |
95 } | 101 } |
96 } | 102 } |
OLD | NEW |