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 "SkDeviceProperties.h" | 10 #include "SkDeviceProperties.h" |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 // Call ourself, in case the subclass wanted to share this setup code | 322 // Call ourself, in case the subclass wanted to share this setup code |
323 // but handle the drawRect code themselves. | 323 // but handle the drawRect code themselves. |
324 this->drawRect(draw, *dstPtr, paintWithShader); | 324 this->drawRect(draw, *dstPtr, paintWithShader); |
325 } | 325 } |
326 | 326 |
327 void SkBitmapDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap, | 327 void SkBitmapDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap, |
328 int x, int y, const SkPaint& paint) { | 328 int x, int y, const SkPaint& paint) { |
329 draw.drawSprite(bitmap, x, y, paint); | 329 draw.drawSprite(bitmap, x, y, paint); |
330 } | 330 } |
331 | 331 |
| 332 void SkBitmapDevice::drawSprite(const SkDraw& draw, const SkImage& image, |
| 333 int x, int y, const SkPaint& paint) { |
| 334 SkBitmap bitmap; |
| 335 if (!as_IB(&image)->getROPixels(&bitmap)) { |
| 336 return; |
| 337 } |
| 338 draw.drawSprite(bitmap, x, y, paint); |
| 339 } |
| 340 |
332 void SkBitmapDevice::drawText(const SkDraw& draw, const void* text, size_t len, | 341 void SkBitmapDevice::drawText(const SkDraw& draw, const void* text, size_t len, |
333 SkScalar x, SkScalar y, const SkPaint& paint) { | 342 SkScalar x, SkScalar y, const SkPaint& paint) { |
334 draw.drawText((const char*)text, len, x, y, paint); | 343 draw.drawText((const char*)text, len, x, y, paint); |
335 } | 344 } |
336 | 345 |
337 void SkBitmapDevice::drawPosText(const SkDraw& draw, const void* text, size_t le
n, | 346 void SkBitmapDevice::drawPosText(const SkDraw& draw, const void* text, size_t le
n, |
338 const SkScalar xpos[], int scalarsPerPos, | 347 const SkScalar xpos[], int scalarsPerPos, |
339 const SkPoint& offset, const SkPaint& paint) { | 348 const SkPoint& offset, const SkPaint& paint) { |
340 draw.drawPosText((const char*)text, len, xpos, scalarsPerPos, offset, paint)
; | 349 draw.drawPosText((const char*)text, len, xpos, scalarsPerPos, offset, paint)
; |
341 } | 350 } |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 paint.getRasterizer() || | 424 paint.getRasterizer() || |
416 paint.getPathEffect() || | 425 paint.getPathEffect() || |
417 paint.isFakeBoldText() || | 426 paint.isFakeBoldText() || |
418 paint.getStyle() != SkPaint::kFill_Style || | 427 paint.getStyle() != SkPaint::kFill_Style || |
419 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) | 428 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) |
420 { | 429 { |
421 return true; | 430 return true; |
422 } | 431 } |
423 return false; | 432 return false; |
424 } | 433 } |
OLD | NEW |