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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
48 SkAlphaType canonicalAlphaType = info.alphaType(); | 48 SkAlphaType canonicalAlphaType = info.alphaType(); |
49 | 49 |
50 switch (info.colorType()) { | 50 switch (info.colorType()) { |
51 case kAlpha_8_SkColorType: | 51 case kAlpha_8_SkColorType: |
52 break; | 52 break; |
53 case kRGB_565_SkColorType: | 53 case kRGB_565_SkColorType: |
54 canonicalAlphaType = kOpaque_SkAlphaType; | 54 canonicalAlphaType = kOpaque_SkAlphaType; |
55 break; | 55 break; |
56 case kN32_SkColorType: | 56 case kN32_SkColorType: |
57 break; | 57 break; |
58 case kRGBA_F16_SkColorType: | 58 case kRGBA_F16_SkColorType: |
ericrk
2016/02/25 00:22:11
I guess I inadvertently rebased - this is not from
| |
59 break; | 59 break; |
60 default: | 60 default: |
61 return false; | 61 return false; |
62 } | 62 } |
63 | 63 |
64 if (newAlphaType) { | 64 if (newAlphaType) { |
65 *newAlphaType = canonicalAlphaType; | 65 *newAlphaType = canonicalAlphaType; |
66 } | 66 } |
67 return true; | 67 return true; |
68 } | 68 } |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
240 | 240 |
241 void SkBitmapDevice::drawPath(const SkDraw& draw, const SkPath& path, | 241 void SkBitmapDevice::drawPath(const SkDraw& draw, const SkPath& path, |
242 const SkPaint& paint, const SkMatrix* prePathMatri x, | 242 const SkPaint& paint, const SkMatrix* prePathMatri x, |
243 bool pathIsMutable) { | 243 bool pathIsMutable) { |
244 CHECK_FOR_ANNOTATION(paint); | 244 CHECK_FOR_ANNOTATION(paint); |
245 draw.drawPath(path, paint, prePathMatrix, pathIsMutable); | 245 draw.drawPath(path, paint, prePathMatrix, pathIsMutable); |
246 } | 246 } |
247 | 247 |
248 void SkBitmapDevice::drawBitmap(const SkDraw& draw, const SkBitmap& bitmap, | 248 void SkBitmapDevice::drawBitmap(const SkDraw& draw, const SkBitmap& bitmap, |
249 const SkMatrix& matrix, const SkPaint& paint) { | 249 const SkMatrix& matrix, const SkPaint& paint) { |
250 LogDrawScaleFactor(SkMatrix::Concat(*draw.fMatrix, matrix), paint.getFilterQ uality()); | |
250 draw.drawBitmap(bitmap, matrix, nullptr, paint); | 251 draw.drawBitmap(bitmap, matrix, nullptr, paint); |
251 } | 252 } |
252 | 253 |
253 void SkBitmapDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap, | 254 void SkBitmapDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap, |
254 const SkRect* src, const SkRect& dst, | 255 const SkRect* src, const SkRect& dst, |
255 const SkPaint& paint, SkCanvas::SrcRectConst raint constraint) { | 256 const SkPaint& paint, SkCanvas::SrcRectConst raint constraint) { |
256 SkMatrix matrix; | 257 SkMatrix matrix; |
257 SkRect bitmapBounds, tmpSrc, tmpDst; | 258 SkRect bitmapBounds, tmpSrc, tmpDst; |
258 SkBitmap tmpBitmap; | 259 SkBitmap tmpBitmap; |
259 | 260 |
260 bitmapBounds.isetWH(bitmap.width(), bitmap.height()); | 261 bitmapBounds.isetWH(bitmap.width(), bitmap.height()); |
261 | 262 |
262 // Compute matrix from the two rectangles | 263 // Compute matrix from the two rectangles |
263 if (src) { | 264 if (src) { |
264 tmpSrc = *src; | 265 tmpSrc = *src; |
265 } else { | 266 } else { |
266 tmpSrc = bitmapBounds; | 267 tmpSrc = bitmapBounds; |
267 } | 268 } |
268 matrix.setRectToRect(tmpSrc, dst, SkMatrix::kFill_ScaleToFit); | 269 matrix.setRectToRect(tmpSrc, dst, SkMatrix::kFill_ScaleToFit); |
269 | 270 |
271 LogDrawScaleFactor(SkMatrix::Concat(*draw.fMatrix, matrix), paint.getFilterQ uality()); | |
272 | |
270 const SkRect* dstPtr = &dst; | 273 const SkRect* dstPtr = &dst; |
271 const SkBitmap* bitmapPtr = &bitmap; | 274 const SkBitmap* bitmapPtr = &bitmap; |
272 | 275 |
273 // clip the tmpSrc to the bounds of the bitmap, and recompute dstRect if | 276 // clip the tmpSrc to the bounds of the bitmap, and recompute dstRect if |
274 // needed (if the src was clipped). No check needed if src==null. | 277 // needed (if the src was clipped). No check needed if src==null. |
275 if (src) { | 278 if (src) { |
276 if (!bitmapBounds.contains(*src)) { | 279 if (!bitmapBounds.contains(*src)) { |
277 if (!tmpSrc.intersect(bitmapBounds)) { | 280 if (!tmpSrc.intersect(bitmapBounds)) { |
278 return; // nothing to draw | 281 return; // nothing to draw |
279 } | 282 } |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
389 paint.getRasterizer() || | 392 paint.getRasterizer() || |
390 paint.getPathEffect() || | 393 paint.getPathEffect() || |
391 paint.isFakeBoldText() || | 394 paint.isFakeBoldText() || |
392 paint.getStyle() != SkPaint::kFill_Style || | 395 paint.getStyle() != SkPaint::kFill_Style || |
393 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) | 396 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) |
394 { | 397 { |
395 return true; | 398 return true; |
396 } | 399 } |
397 return false; | 400 return false; |
398 } | 401 } |
OLD | NEW |