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" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 bool SkImage::readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dst
RowBytes, | 49 bool SkImage::readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dst
RowBytes, |
50 int srcX, int srcY) const { | 50 int srcX, int srcY) const { |
51 SkReadPixelsRec rec(dstInfo, dstPixels, dstRowBytes, srcX, srcY); | 51 SkReadPixelsRec rec(dstInfo, dstPixels, dstRowBytes, srcX, srcY); |
52 if (!rec.trim(this->width(), this->height())) { | 52 if (!rec.trim(this->width(), this->height())) { |
53 return false; | 53 return false; |
54 } | 54 } |
55 return as_IB(this)->onReadPixels(rec.fInfo, rec.fPixels, rec.fRowBytes, rec.
fX, rec.fY); | 55 return as_IB(this)->onReadPixels(rec.fInfo, rec.fPixels, rec.fRowBytes, rec.
fX, rec.fY); |
56 } | 56 } |
57 | 57 |
58 GrTexture* SkImage::getTexture() { | 58 GrTexture* SkImage::getTexture() const { |
59 return as_IB(this)->onGetTexture(); | 59 return as_IB(this)->onGetTexture(); |
60 } | 60 } |
61 | 61 |
62 SkShader* SkImage::newShader(SkShader::TileMode tileX, | 62 SkShader* SkImage::newShader(SkShader::TileMode tileX, |
63 SkShader::TileMode tileY, | 63 SkShader::TileMode tileY, |
64 const SkMatrix* localMatrix) const { | 64 const SkMatrix* localMatrix) const { |
65 return as_IB(this)->onNewShader(tileX, tileY, localMatrix); | 65 return as_IB(this)->onNewShader(tileX, tileY, localMatrix); |
66 } | 66 } |
67 | 67 |
68 SkData* SkImage::encode(SkImageEncoder::Type type, int quality) const { | 68 SkData* SkImage::encode(SkImageEncoder::Type type, int quality) const { |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 surface->getCanvas()->translate(-src.x(), -src.y()); | 176 surface->getCanvas()->translate(-src.x(), -src.y()); |
177 | 177 |
178 SkPaint paint; | 178 SkPaint paint; |
179 paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 179 paint.setXfermodeMode(SkXfermode::kSrc_Mode); |
180 paint.setFilterQuality(quality); | 180 paint.setFilterQuality(quality); |
181 surface->getCanvas()->drawImage(this, 0, 0, &paint); | 181 surface->getCanvas()->drawImage(this, 0, 0, &paint); |
182 return surface->newImageSnapshot(); | 182 return surface->newImageSnapshot(); |
183 } | 183 } |
184 | 184 |
185 | 185 |
OLD | NEW |