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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 | 211 |
212 void SkBitmapDevice::drawPath(const SkDraw& draw, const SkPath& path, | 212 void SkBitmapDevice::drawPath(const SkDraw& draw, const SkPath& path, |
213 const SkPaint& paint, const SkMatrix* prePathMatri
x, | 213 const SkPaint& paint, const SkMatrix* prePathMatri
x, |
214 bool pathIsMutable) { | 214 bool pathIsMutable) { |
215 CHECK_FOR_ANNOTATION(paint); | 215 CHECK_FOR_ANNOTATION(paint); |
216 draw.drawPath(path, paint, prePathMatrix, pathIsMutable); | 216 draw.drawPath(path, paint, prePathMatrix, pathIsMutable); |
217 } | 217 } |
218 | 218 |
219 void SkBitmapDevice::drawBitmap(const SkDraw& draw, const SkBitmap& bitmap, | 219 void SkBitmapDevice::drawBitmap(const SkDraw& draw, const SkBitmap& bitmap, |
220 const SkMatrix& matrix, const SkPaint& paint) { | 220 const SkMatrix& matrix, const SkPaint& paint) { |
221 draw.drawBitmap(bitmap, matrix, paint); | 221 draw.drawBitmap(bitmap, matrix, NULL, paint); |
222 } | 222 } |
223 | 223 |
224 void SkBitmapDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap, | 224 void SkBitmapDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap, |
225 const SkRect* src, const SkRect& dst, | 225 const SkRect* src, const SkRect& dst, |
226 const SkPaint& paint, | 226 const SkPaint& paint, |
227 SkCanvas::DrawBitmapRectFlags flags) { | 227 SkCanvas::DrawBitmapRectFlags flags) { |
228 SkMatrix matrix; | 228 SkMatrix matrix; |
229 SkRect bitmapBounds, tmpSrc, tmpDst; | 229 SkRect bitmapBounds, tmpSrc, tmpDst; |
230 SkBitmap tmpBitmap; | 230 SkBitmap tmpBitmap; |
231 | 231 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 extractedBitmapBounds.isetWH(bitmapPtr->width(), bitmapPtr->height()); | 284 extractedBitmapBounds.isetWH(bitmapPtr->width(), bitmapPtr->height()); |
285 if (extractedBitmapBounds == tmpSrc) { | 285 if (extractedBitmapBounds == tmpSrc) { |
286 // no fractional part in src, we can just call drawBitmap | 286 // no fractional part in src, we can just call drawBitmap |
287 goto USE_DRAWBITMAP; | 287 goto USE_DRAWBITMAP; |
288 } | 288 } |
289 } else { | 289 } else { |
290 USE_DRAWBITMAP: | 290 USE_DRAWBITMAP: |
291 // We can go faster by just calling drawBitmap, which will concat the | 291 // We can go faster by just calling drawBitmap, which will concat the |
292 // matrix with the CTM, and try to call drawSprite if it can. If not, | 292 // matrix with the CTM, and try to call drawSprite if it can. If not, |
293 // it will make a shader and call drawRect, as we do below. | 293 // it will make a shader and call drawRect, as we do below. |
294 this->drawBitmap(draw, *bitmapPtr, matrix, paint); | 294 draw.drawBitmap(*bitmapPtr, matrix, dstPtr, paint); |
295 return; | 295 return; |
296 } | 296 } |
297 | 297 |
298 // construct a shader, so we can call drawRect with the dst | 298 // construct a shader, so we can call drawRect with the dst |
299 SkShader* s = SkShader::CreateBitmapShader(*bitmapPtr, | 299 SkShader* s = SkShader::CreateBitmapShader(*bitmapPtr, |
300 SkShader::kClamp_TileMode, | 300 SkShader::kClamp_TileMode, |
301 SkShader::kClamp_TileMode, | 301 SkShader::kClamp_TileMode, |
302 &matrix); | 302 &matrix); |
303 if (NULL == s) { | 303 if (NULL == s) { |
304 return; | 304 return; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 paint.getRasterizer() || | 383 paint.getRasterizer() || |
384 paint.getPathEffect() || | 384 paint.getPathEffect() || |
385 paint.isFakeBoldText() || | 385 paint.isFakeBoldText() || |
386 paint.getStyle() != SkPaint::kFill_Style || | 386 paint.getStyle() != SkPaint::kFill_Style || |
387 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) | 387 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) |
388 { | 388 { |
389 return true; | 389 return true; |
390 } | 390 } |
391 return false; | 391 return false; |
392 } | 392 } |
OLD | NEW |