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 #ifndef SkSurface_Base_DEFINED | 8 #ifndef SkSurface_Base_DEFINED |
9 #define SkSurface_Base_DEFINED | 9 #define SkSurface_Base_DEFINED |
10 | 10 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 void aboutToDraw(ContentChangeMode mode); | 72 void aboutToDraw(ContentChangeMode mode); |
73 friend class SkCanvas; | 73 friend class SkCanvas; |
74 friend class SkSurface; | 74 friend class SkSurface; |
75 | 75 |
76 typedef SkSurface INHERITED; | 76 typedef SkSurface INHERITED; |
77 }; | 77 }; |
78 | 78 |
79 SkCanvas* SkSurface_Base::getCachedCanvas() { | 79 SkCanvas* SkSurface_Base::getCachedCanvas() { |
80 if (NULL == fCachedCanvas) { | 80 if (NULL == fCachedCanvas) { |
81 fCachedCanvas = this->onNewCanvas(); | 81 fCachedCanvas = this->onNewCanvas(); |
82 if (NULL != fCachedCanvas) { | 82 if (fCachedCanvas) { |
83 fCachedCanvas->setSurfaceBase(this); | 83 fCachedCanvas->setSurfaceBase(this); |
84 } | 84 } |
85 } | 85 } |
86 return fCachedCanvas; | 86 return fCachedCanvas; |
87 } | 87 } |
88 | 88 |
89 SkImage* SkSurface_Base::getCachedImage() { | 89 SkImage* SkSurface_Base::getCachedImage() { |
90 if (NULL == fCachedImage) { | 90 if (NULL == fCachedImage) { |
91 fCachedImage = this->onNewImageSnapshot(); | 91 fCachedImage = this->onNewImageSnapshot(); |
92 SkASSERT(!fCachedCanvas || fCachedCanvas->getSurfaceBase() == this); | 92 SkASSERT(!fCachedCanvas || fCachedCanvas->getSurfaceBase() == this); |
93 } | 93 } |
94 return fCachedImage; | 94 return fCachedImage; |
95 } | 95 } |
96 | 96 |
97 #endif | 97 #endif |
OLD | NEW |