Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(816)

Side by Side Diff: src/image/SkImage.cpp

Issue 453613003: mark all SkImage methods const, so we can make it thread-safe (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/core/SkImage.h ('k') | src/image/SkImage_Base.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « include/core/SkImage.h ('k') | src/image/SkImage_Base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698