| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkBitmapDevice.h" | 8 #include "SkBitmapDevice.h" |
| 9 #include "SkConfig8888.h" | 9 #include "SkConfig8888.h" |
| 10 #include "SkDraw.h" | 10 #include "SkDraw.h" |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 // We can go faster by just calling drawBitmap, which will concat the | 374 // We can go faster by just calling drawBitmap, which will concat the |
| 375 // matrix with the CTM, and try to call drawSprite if it can. If not, | 375 // matrix with the CTM, and try to call drawSprite if it can. If not, |
| 376 // it will make a shader and call drawRect, as we do below. | 376 // it will make a shader and call drawRect, as we do below. |
| 377 this->drawBitmap(draw, *bitmapPtr, matrix, paint); | 377 this->drawBitmap(draw, *bitmapPtr, matrix, paint); |
| 378 return; | 378 return; |
| 379 } | 379 } |
| 380 | 380 |
| 381 // construct a shader, so we can call drawRect with the dst | 381 // construct a shader, so we can call drawRect with the dst |
| 382 SkShader* s = SkShader::CreateBitmapShader(*bitmapPtr, | 382 SkShader* s = SkShader::CreateBitmapShader(*bitmapPtr, |
| 383 SkShader::kClamp_TileMode, | 383 SkShader::kClamp_TileMode, |
| 384 SkShader::kClamp_TileMode); | 384 SkShader::kClamp_TileMode, |
| 385 &matrix); |
| 385 if (NULL == s) { | 386 if (NULL == s) { |
| 386 return; | 387 return; |
| 387 } | 388 } |
| 388 s->setLocalMatrix(matrix); | |
| 389 | 389 |
| 390 SkPaint paintWithShader(paint); | 390 SkPaint paintWithShader(paint); |
| 391 paintWithShader.setStyle(SkPaint::kFill_Style); | 391 paintWithShader.setStyle(SkPaint::kFill_Style); |
| 392 paintWithShader.setShader(s)->unref(); | 392 paintWithShader.setShader(s)->unref(); |
| 393 | 393 |
| 394 // Call ourself, in case the subclass wanted to share this setup code | 394 // Call ourself, in case the subclass wanted to share this setup code |
| 395 // but handle the drawRect code themselves. | 395 // but handle the drawRect code themselves. |
| 396 this->drawRect(draw, *dstPtr, paintWithShader); | 396 this->drawRect(draw, *dstPtr, paintWithShader); |
| 397 } | 397 } |
| 398 | 398 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 paint.getStyle() != SkPaint::kFill_Style || | 464 paint.getStyle() != SkPaint::kFill_Style || |
| 465 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) { | 465 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) { |
| 466 // turn off lcd | 466 // turn off lcd |
| 467 flags->fFlags = paint.getFlags() & ~SkPaint::kLCDRenderText_Flag; | 467 flags->fFlags = paint.getFlags() & ~SkPaint::kLCDRenderText_Flag; |
| 468 flags->fHinting = paint.getHinting(); | 468 flags->fHinting = paint.getHinting(); |
| 469 return true; | 469 return true; |
| 470 } | 470 } |
| 471 // we're cool with the paint as is | 471 // we're cool with the paint as is |
| 472 return false; | 472 return false; |
| 473 } | 473 } |
| OLD | NEW |