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

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

Issue 1129843003: Make drawImage a virtual on SkDevice (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 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 | « src/gpu/SkGpuDevice.cpp ('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 "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
37 const void* SkImage::peekPixels(SkImageInfo* info, size_t* rowBytes) const { 28 const void* SkImage::peekPixels(SkImageInfo* info, size_t* rowBytes) const {
38 SkImageInfo infoStorage; 29 SkImageInfo infoStorage;
39 size_t rowBytesStorage; 30 size_t rowBytesStorage;
40 if (NULL == info) { 31 if (NULL == info) {
41 info = &infoStorage; 32 info = &infoStorage;
42 } 33 }
43 if (NULL == rowBytes) { 34 if (NULL == rowBytes) {
44 rowBytes = &rowBytesStorage; 35 rowBytes = &rowBytesStorage;
45 } 36 }
46 return as_IB(this)->onPeekPixels(info, rowBytes); 37 return as_IB(this)->onPeekPixels(info, rowBytes);
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 surface->getCanvas()->translate(-src.x(), -src.y()); 163 surface->getCanvas()->translate(-src.x(), -src.y());
173 164
174 SkPaint paint; 165 SkPaint paint;
175 paint.setXfermodeMode(SkXfermode::kSrc_Mode); 166 paint.setXfermodeMode(SkXfermode::kSrc_Mode);
176 paint.setFilterQuality(quality); 167 paint.setFilterQuality(quality);
177 surface->getCanvas()->drawImage(this, 0, 0, &paint); 168 surface->getCanvas()->drawImage(this, 0, 0, &paint);
178 return surface->newImageSnapshot(); 169 return surface->newImageSnapshot();
179 } 170 }
180 171
181 172
OLDNEW
« no previous file with comments | « src/gpu/SkGpuDevice.cpp ('k') | src/image/SkImage_Base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698