| 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 "SkSurface_Base.h" | 8 #include "SkSurface_Base.h" |
| 9 #include "SkImagePriv.h" | 9 #include "SkImagePriv.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 image->draw(canvas, x, y, paint); | 38 image->draw(canvas, x, y, paint); |
| 39 image->unref(); | 39 image->unref(); |
| 40 } | 40 } |
| 41 } | 41 } |
| 42 | 42 |
| 43 void SkSurface_Base::aboutToDraw(ContentChangeMode mode) { | 43 void SkSurface_Base::aboutToDraw(ContentChangeMode mode) { |
| 44 this->dirtyGenerationID(); | 44 this->dirtyGenerationID(); |
| 45 | 45 |
| 46 SkASSERT(!fCachedCanvas || fCachedCanvas->getSurfaceBase() == this); | 46 SkASSERT(!fCachedCanvas || fCachedCanvas->getSurfaceBase() == this); |
| 47 | 47 |
| 48 if (NULL != fCachedImage) { | 48 if (fCachedImage) { |
| 49 // the surface may need to fork its backend, if its sharing it with | 49 // the surface may need to fork its backend, if its sharing it with |
| 50 // the cached image. Note: we only call if there is an outstanding owner | 50 // the cached image. Note: we only call if there is an outstanding owner |
| 51 // on the image (besides us). | 51 // on the image (besides us). |
| 52 if (!fCachedImage->unique()) { | 52 if (!fCachedImage->unique()) { |
| 53 this->onCopyOnWrite(mode); | 53 this->onCopyOnWrite(mode); |
| 54 } | 54 } |
| 55 | 55 |
| 56 // regardless of copy-on-write, we must drop our cached image now, so | 56 // regardless of copy-on-write, we must drop our cached image now, so |
| 57 // that the next request will get our new contents. | 57 // that the next request will get our new contents. |
| 58 fCachedImage->unref(); | 58 fCachedImage->unref(); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 } | 112 } |
| 113 | 113 |
| 114 void SkSurface::draw(SkCanvas* canvas, SkScalar x, SkScalar y, | 114 void SkSurface::draw(SkCanvas* canvas, SkScalar x, SkScalar y, |
| 115 const SkPaint* paint) { | 115 const SkPaint* paint) { |
| 116 return asSB(this)->onDraw(canvas, x, y, paint); | 116 return asSB(this)->onDraw(canvas, x, y, paint); |
| 117 } | 117 } |
| 118 | 118 |
| 119 const void* SkSurface::peekPixels(SkImageInfo* info, size_t* rowBytes) { | 119 const void* SkSurface::peekPixels(SkImageInfo* info, size_t* rowBytes) { |
| 120 return this->getCanvas()->peekPixels(info, rowBytes); | 120 return this->getCanvas()->peekPixels(info, rowBytes); |
| 121 } | 121 } |
| OLD | NEW |