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 11 matching lines...) Expand all Loading... |
22 static int32_t gUniqueID; | 22 static int32_t gUniqueID; |
23 | 23 |
24 // never return 0; | 24 // never return 0; |
25 uint32_t id; | 25 uint32_t id; |
26 do { | 26 do { |
27 id = sk_atomic_inc(&gUniqueID) + 1; | 27 id = sk_atomic_inc(&gUniqueID) + 1; |
28 } while (0 == id); | 28 } while (0 == id); |
29 return id; | 29 return id; |
30 } | 30 } |
31 | 31 |
32 void SkImage::draw(SkCanvas* canvas, SkScalar x, SkScalar y, | 32 void SkImage::draw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* pain
t) const { |
33 const SkPaint* paint) { | |
34 as_IB(this)->onDraw(canvas, x, y, paint); | 33 as_IB(this)->onDraw(canvas, x, y, paint); |
35 } | 34 } |
36 | 35 |
37 void SkImage::draw(SkCanvas* canvas, const SkRect* src, const SkRect& dst, | 36 void SkImage::draw(SkCanvas* canvas, const SkRect* src, const SkRect& dst, |
38 const SkPaint* paint) { | 37 const SkPaint* paint) const { |
39 as_IB(this)->onDrawRectToRect(canvas, src, dst, paint); | 38 as_IB(this)->onDrawRectToRect(canvas, src, dst, paint); |
40 } | 39 } |
41 | 40 |
42 const void* SkImage::peekPixels(SkImageInfo* info, size_t* rowBytes) const { | 41 const void* SkImage::peekPixels(SkImageInfo* info, size_t* rowBytes) const { |
43 SkImageInfo infoStorage; | 42 SkImageInfo infoStorage; |
44 size_t rowBytesStorage; | 43 size_t rowBytesStorage; |
45 if (NULL == info) { | 44 if (NULL == info) { |
46 info = &infoStorage; | 45 info = &infoStorage; |
47 } | 46 } |
48 if (NULL == rowBytes) { | 47 if (NULL == rowBytes) { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 132 |
134 SkCanvas canvas(*bitmap); | 133 SkCanvas canvas(*bitmap); |
135 | 134 |
136 SkPaint paint; | 135 SkPaint paint; |
137 paint.setXfermodeMode(SkXfermode::kClear_Mode); | 136 paint.setXfermodeMode(SkXfermode::kClear_Mode); |
138 canvas.drawRect(dstR, paint); | 137 canvas.drawRect(dstR, paint); |
139 | 138 |
140 const_cast<SkImage_Base*>(this)->onDrawRectToRect(&canvas, &srcR, dstR, NULL
); | 139 const_cast<SkImage_Base*>(this)->onDrawRectToRect(&canvas, &srcR, dstR, NULL
); |
141 return true; | 140 return true; |
142 } | 141 } |
OLD | NEW |