| 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 | |
| 57 bool GrSurface::hasPendingRead() const { | 51 bool GrSurface::hasPendingRead() const { |
| 58 const GrTexture* thisTex = this->asTexture(); | 52 const GrTexture* thisTex = this->asTexture(); |
| 59 if (thisTex && thisTex->internalHasPendingRead()) { | 53 if (thisTex && thisTex->internalHasPendingRead()) { |
| 60 return true; | 54 return true; |
| 61 } | 55 } |
| 62 const GrRenderTarget* thisRT = this->asRenderTarget(); | 56 const GrRenderTarget* thisRT = this->asRenderTarget(); |
| 63 if (thisRT && thisRT->internalHasPendingRead()) { | 57 if (thisRT && thisRT->internalHasPendingRead()) { |
| 64 return true; | 58 return true; |
| 65 } | 59 } |
| 66 return false; | 60 return false; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 93 bool GrSurface::isSameAs(const GrSurface* other) const { | 87 bool GrSurface::isSameAs(const GrSurface* other) const { |
| 94 const GrRenderTarget* thisRT = this->asRenderTarget(); | 88 const GrRenderTarget* thisRT = this->asRenderTarget(); |
| 95 if (thisRT) { | 89 if (thisRT) { |
| 96 return thisRT == other->asRenderTarget(); | 90 return thisRT == other->asRenderTarget(); |
| 97 } else { | 91 } else { |
| 98 const GrTexture* thisTex = this->asTexture(); | 92 const GrTexture* thisTex = this->asTexture(); |
| 99 SkASSERT(thisTex); // We must be one or the other | 93 SkASSERT(thisTex); // We must be one or the other |
| 100 return thisTex == other->asTexture(); | 94 return thisTex == other->asTexture(); |
| 101 } | 95 } |
| 102 } | 96 } |
| OLD | NEW |