| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkColorPriv.h" | 8 #include "SkColorPriv.h" |
| 9 #include "SkConfig8888.h" | 9 #include "SkConfig8888.h" |
| 10 #include "SkData.h" | 10 #include "SkData.h" |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 if (dst.width() == this->width() && dst.height() == this->height()) { | 252 if (dst.width() == this->width() && dst.height() == this->height()) { |
| 253 return this->readPixels(dst); | 253 return this->readPixels(dst); |
| 254 } | 254 } |
| 255 | 255 |
| 256 SkBitmap bitmap; | 256 SkBitmap bitmap; |
| 257 if (!bitmap.installPixels(*this)) { | 257 if (!bitmap.installPixels(*this)) { |
| 258 return false; | 258 return false; |
| 259 } | 259 } |
| 260 bitmap.setIsVolatile(true); // so we don't try to cache it | 260 bitmap.setIsVolatile(true); // so we don't try to cache it |
| 261 | 261 |
| 262 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterDirect(dst.info(), dst.w
ritable_addr(), | 262 auto surface(SkSurface::MakeRasterDirect(dst.info(), dst.writable_addr(), ds
t.rowBytes())); |
| 263 dst.rowBytes())); | |
| 264 if (!surface) { | 263 if (!surface) { |
| 265 return false; | 264 return false; |
| 266 } | 265 } |
| 267 | 266 |
| 268 SkPaint paint; | 267 SkPaint paint; |
| 269 paint.setFilterQuality(quality); | 268 paint.setFilterQuality(quality); |
| 270 paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 269 paint.setXfermodeMode(SkXfermode::kSrc_Mode); |
| 271 surface->getCanvas()->drawBitmapRect(bitmap, SkRect::MakeIWH(dst.width(), ds
t.height()), | 270 surface->getCanvas()->drawBitmapRect(bitmap, SkRect::MakeIWH(dst.width(), ds
t.height()), |
| 272 &paint); | 271 &paint); |
| 273 return true; | 272 return true; |
| 274 } | 273 } |
| 275 | 274 |
| 276 ////////////////////////////////////////////////////////////////////////////////
////////////////// | 275 ////////////////////////////////////////////////////////////////////////////////
////////////////// |
| 277 | 276 |
| OLD | NEW |