| 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 "SkImageGenerator.h" | 10 #include "SkImageGenerator.h" |
| 11 #include "SkImagePriv.h" | 11 #include "SkImagePriv.h" |
| 12 #include "SkImage_Base.h" | 12 #include "SkImage_Base.h" |
| 13 #include "SkReadPixelsRec.h" | 13 #include "SkReadPixelsRec.h" |
| 14 #include "SkString.h" | 14 #include "SkString.h" |
| 15 #include "SkSurface.h" | 15 #include "SkSurface.h" |
| 16 | 16 |
| 17 uint32_t SkImage::NextUniqueID() { | 17 uint32_t SkImage::NextUniqueID() { |
| 18 static int32_t gUniqueID; | 18 static int32_t gUniqueID; |
| 19 | 19 |
| 20 // never return 0; | 20 // never return 0; |
| 21 uint32_t id; | 21 uint32_t id; |
| 22 do { | 22 do { |
| 23 id = sk_atomic_inc(&gUniqueID) + 1; | 23 id = sk_atomic_inc(&gUniqueID) + 1; |
| 24 } while (0 == id); | 24 } while (0 == id); |
| 25 return id; | 25 return id; |
| 26 } | 26 } |
| 27 | 27 |
| 28 void SkImage::draw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* pain
t) const { |
| 29 as_IB(this)->onDraw(canvas, x, y, paint); |
| 30 } |
| 31 |
| 32 void SkImage::drawRect(SkCanvas* canvas, const SkRect* src, const SkRect& dst, |
| 33 const SkPaint* paint) const { |
| 34 as_IB(this)->onDrawRect(canvas, src, dst, paint); |
| 35 } |
| 36 |
| 28 const void* SkImage::peekPixels(SkImageInfo* info, size_t* rowBytes) const { | 37 const void* SkImage::peekPixels(SkImageInfo* info, size_t* rowBytes) const { |
| 29 SkImageInfo infoStorage; | 38 SkImageInfo infoStorage; |
| 30 size_t rowBytesStorage; | 39 size_t rowBytesStorage; |
| 31 if (NULL == info) { | 40 if (NULL == info) { |
| 32 info = &infoStorage; | 41 info = &infoStorage; |
| 33 } | 42 } |
| 34 if (NULL == rowBytes) { | 43 if (NULL == rowBytes) { |
| 35 rowBytes = &rowBytesStorage; | 44 rowBytes = &rowBytesStorage; |
| 36 } | 45 } |
| 37 return as_IB(this)->onPeekPixels(info, rowBytes); | 46 return as_IB(this)->onPeekPixels(info, rowBytes); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 surface->getCanvas()->translate(-src.x(), -src.y()); | 172 surface->getCanvas()->translate(-src.x(), -src.y()); |
| 164 | 173 |
| 165 SkPaint paint; | 174 SkPaint paint; |
| 166 paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 175 paint.setXfermodeMode(SkXfermode::kSrc_Mode); |
| 167 paint.setFilterQuality(quality); | 176 paint.setFilterQuality(quality); |
| 168 surface->getCanvas()->drawImage(this, 0, 0, &paint); | 177 surface->getCanvas()->drawImage(this, 0, 0, &paint); |
| 169 return surface->newImageSnapshot(); | 178 return surface->newImageSnapshot(); |
| 170 } | 179 } |
| 171 | 180 |
| 172 | 181 |
| OLD | NEW |