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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 } | 230 } |
231 | 231 |
232 void SkBitmapDevice::drawPath(const SkDraw& draw, const SkPath& path, | 232 void SkBitmapDevice::drawPath(const SkDraw& draw, const SkPath& path, |
233 const SkPaint& paint, const SkMatrix* prePathMatri
x, | 233 const SkPaint& paint, const SkMatrix* prePathMatri
x, |
234 bool pathIsMutable) { | 234 bool pathIsMutable) { |
235 draw.drawPath(path, paint, prePathMatrix, pathIsMutable); | 235 draw.drawPath(path, paint, prePathMatrix, pathIsMutable); |
236 } | 236 } |
237 | 237 |
238 void SkBitmapDevice::drawBitmap(const SkDraw& draw, const SkBitmap& bitmap, | 238 void SkBitmapDevice::drawBitmap(const SkDraw& draw, const SkBitmap& bitmap, |
239 const SkMatrix& matrix, const SkPaint& paint) { | 239 const SkMatrix& matrix, const SkPaint& paint) { |
| 240 LogDrawScaleFactor(SkMatrix::Concat(*draw.fMatrix, matrix), paint.getFilterQ
uality()); |
240 draw.drawBitmap(bitmap, matrix, nullptr, paint); | 241 draw.drawBitmap(bitmap, matrix, nullptr, paint); |
241 } | 242 } |
242 | 243 |
243 void SkBitmapDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap, | 244 void SkBitmapDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap, |
244 const SkRect* src, const SkRect& dst, | 245 const SkRect* src, const SkRect& dst, |
245 const SkPaint& paint, SkCanvas::SrcRectConst
raint constraint) { | 246 const SkPaint& paint, SkCanvas::SrcRectConst
raint constraint) { |
246 SkMatrix matrix; | 247 SkMatrix matrix; |
247 SkRect bitmapBounds, tmpSrc, tmpDst; | 248 SkRect bitmapBounds, tmpSrc, tmpDst; |
248 SkBitmap tmpBitmap; | 249 SkBitmap tmpBitmap; |
249 | 250 |
250 bitmapBounds.isetWH(bitmap.width(), bitmap.height()); | 251 bitmapBounds.isetWH(bitmap.width(), bitmap.height()); |
251 | 252 |
252 // Compute matrix from the two rectangles | 253 // Compute matrix from the two rectangles |
253 if (src) { | 254 if (src) { |
254 tmpSrc = *src; | 255 tmpSrc = *src; |
255 } else { | 256 } else { |
256 tmpSrc = bitmapBounds; | 257 tmpSrc = bitmapBounds; |
257 } | 258 } |
258 matrix.setRectToRect(tmpSrc, dst, SkMatrix::kFill_ScaleToFit); | 259 matrix.setRectToRect(tmpSrc, dst, SkMatrix::kFill_ScaleToFit); |
259 | 260 |
| 261 LogDrawScaleFactor(SkMatrix::Concat(*draw.fMatrix, matrix), paint.getFilterQ
uality()); |
| 262 |
260 const SkRect* dstPtr = &dst; | 263 const SkRect* dstPtr = &dst; |
261 const SkBitmap* bitmapPtr = &bitmap; | 264 const SkBitmap* bitmapPtr = &bitmap; |
262 | 265 |
263 // clip the tmpSrc to the bounds of the bitmap, and recompute dstRect if | 266 // clip the tmpSrc to the bounds of the bitmap, and recompute dstRect if |
264 // needed (if the src was clipped). No check needed if src==null. | 267 // needed (if the src was clipped). No check needed if src==null. |
265 if (src) { | 268 if (src) { |
266 if (!bitmapBounds.contains(*src)) { | 269 if (!bitmapBounds.contains(*src)) { |
267 if (!tmpSrc.intersect(bitmapBounds)) { | 270 if (!tmpSrc.intersect(bitmapBounds)) { |
268 return; // nothing to draw | 271 return; // nothing to draw |
269 } | 272 } |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 paint.getRasterizer() || | 380 paint.getRasterizer() || |
378 paint.getPathEffect() || | 381 paint.getPathEffect() || |
379 paint.isFakeBoldText() || | 382 paint.isFakeBoldText() || |
380 paint.getStyle() != SkPaint::kFill_Style || | 383 paint.getStyle() != SkPaint::kFill_Style || |
381 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) | 384 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) |
382 { | 385 { |
383 return true; | 386 return true; |
384 } | 387 } |
385 return false; | 388 return false; |
386 } | 389 } |
OLD | NEW |