| 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 "SkBitmap.h" | 8 #include "SkBitmap.h" |
| 9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkImagePriv.h" | 10 #include "SkImagePriv.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 id = sk_atomic_inc(&gUniqueID) + 1; | 29 id = sk_atomic_inc(&gUniqueID) + 1; |
| 30 } while (0 == id); | 30 } while (0 == id); |
| 31 return id; | 31 return id; |
| 32 } | 32 } |
| 33 | 33 |
| 34 void SkImage::draw(SkCanvas* canvas, SkScalar x, SkScalar y, | 34 void SkImage::draw(SkCanvas* canvas, SkScalar x, SkScalar y, |
| 35 const SkPaint* paint) { | 35 const SkPaint* paint) { |
| 36 as_IB(this)->onDraw(canvas, x, y, paint); | 36 as_IB(this)->onDraw(canvas, x, y, paint); |
| 37 } | 37 } |
| 38 | 38 |
| 39 void SkImage::draw(SkCanvas* canvas, const SkRect* src, const SkRect& dst, |
| 40 const SkPaint* paint) { |
| 41 as_IB(this)->onDrawRectToRect(canvas, src, dst, paint); |
| 42 } |
| 43 |
| 39 GrTexture* SkImage::getTexture() { | 44 GrTexture* SkImage::getTexture() { |
| 40 return as_IB(this)->onGetTexture(); | 45 return as_IB(this)->onGetTexture(); |
| 41 } | 46 } |
| 42 | 47 |
| 43 SkData* SkImage::encode(SkImageEncoder::Type type, int quality) const { | 48 SkData* SkImage::encode(SkImageEncoder::Type type, int quality) const { |
| 44 SkBitmap bm; | 49 SkBitmap bm; |
| 45 if (as_IB(this)->getROPixels(&bm)) { | 50 if (as_IB(this)->getROPixels(&bm)) { |
| 46 return SkImageEncoder::EncodeData(bm, type, quality); | 51 return SkImageEncoder::EncodeData(bm, type, quality); |
| 47 } | 52 } |
| 48 return NULL; | 53 return NULL; |
| 49 } | 54 } |
| OLD | NEW |