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 | 9 |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 remove(filename); | 37 remove(filename); |
38 | 38 |
39 if (!SkImageEncoder::EncodeFile(filename, bm, SkImageEncoder::kPNG_Type, 100
)) { | 39 if (!SkImageEncoder::EncodeFile(filename, bm, SkImageEncoder::kPNG_Type, 100
)) { |
40 SkDebugf("------ failed to encode %s\n", filename); | 40 SkDebugf("------ failed to encode %s\n", filename); |
41 remove(filename); // remove any partial file | 41 remove(filename); // remove any partial file |
42 return false; | 42 return false; |
43 } | 43 } |
44 | 44 |
45 return true; | 45 return true; |
46 } | 46 } |
| 47 |
| 48 bool GrSurface::hasPendingRead() const { |
| 49 const GrTexture* thisTex = this->asTexture(); |
| 50 if (thisTex && thisTex->internalHasPendingRead()) { |
| 51 return true; |
| 52 } |
| 53 const GrRenderTarget* thisRT = this->asRenderTarget(); |
| 54 if (thisRT && thisRT->internalHasPendingRead()) { |
| 55 return true; |
| 56 } |
| 57 return false; |
| 58 } |
| 59 |
| 60 bool GrSurface::hasPendingWrite() const { |
| 61 const GrTexture* thisTex = this->asTexture(); |
| 62 if (thisTex && thisTex->internalHasPendingWrite()) { |
| 63 return true; |
| 64 } |
| 65 const GrRenderTarget* thisRT = this->asRenderTarget(); |
| 66 if (thisRT && thisRT->internalHasPendingWrite()) { |
| 67 return true; |
| 68 } |
| 69 return false; |
| 70 } |
| 71 |
| 72 bool GrSurface::hasPendingIO() const { |
| 73 const GrTexture* thisTex = this->asTexture(); |
| 74 if (thisTex && thisTex->internalHasPendingIO()) { |
| 75 return true; |
| 76 } |
| 77 const GrRenderTarget* thisRT = this->asRenderTarget(); |
| 78 if (thisRT && thisRT->internalHasPendingIO()) { |
| 79 return true; |
| 80 } |
| 81 return false; |
| 82 } |
OLD | NEW |