OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. |
3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1037 | 1037 |
1038 void GraphicsContext::drawImageBuffer(ImageBuffer* image, const FloatRect& dest, | 1038 void GraphicsContext::drawImageBuffer(ImageBuffer* image, const FloatRect& dest, |
1039 const FloatRect* src, CompositeOperator op) | 1039 const FloatRect* src, CompositeOperator op) |
1040 { | 1040 { |
1041 if (contextDisabled() || !image) | 1041 if (contextDisabled() || !image) |
1042 return; | 1042 return; |
1043 | 1043 |
1044 image->draw(this, dest, src, op); | 1044 image->draw(this, dest, src, op); |
1045 } | 1045 } |
1046 | 1046 |
| 1047 void GraphicsContext::drawPicture(PassRefPtr<SkPicture> picture, const FloatRect
& dest, const FloatRect& src, CompositeOperator op, WebBlendMode blendMode) |
| 1048 { |
| 1049 if (contextDisabled() || !picture) |
| 1050 return; |
| 1051 |
| 1052 SkPaint picturePaint; |
| 1053 picturePaint.setXfermode(WebCoreCompositeToSkiaComposite(op, blendMode).get(
)); |
| 1054 SkRect skBounds = WebCoreFloatRectToSKRect(dest); |
| 1055 saveLayer(&skBounds, &picturePaint); |
| 1056 SkMatrix pictureTransform; |
| 1057 pictureTransform.setRectToRect(WebCoreFloatRectToSKRect(src), skBounds, SkMa
trix::kFill_ScaleToFit); |
| 1058 m_canvas->concat(pictureTransform); |
| 1059 picture->draw(m_canvas); |
| 1060 restoreLayer(); |
| 1061 } |
| 1062 |
1047 void GraphicsContext::writePixels(const SkImageInfo& info, const void* pixels, s
ize_t rowBytes, int x, int y) | 1063 void GraphicsContext::writePixels(const SkImageInfo& info, const void* pixels, s
ize_t rowBytes, int x, int y) |
1048 { | 1064 { |
1049 if (contextDisabled()) | 1065 if (contextDisabled()) |
1050 return; | 1066 return; |
1051 | 1067 |
1052 m_canvas->writePixels(info, pixels, rowBytes, x, y); | 1068 m_canvas->writePixels(info, pixels, rowBytes, x, y); |
1053 | 1069 |
1054 if (m_trackOpaqueRegion) { | 1070 if (m_trackOpaqueRegion) { |
1055 SkRect rect = SkRect::MakeXYWH(x, y, info.width(), info.height()); | 1071 SkRect rect = SkRect::MakeXYWH(x, y, info.width(), info.height()); |
1056 SkPaint paint; | 1072 SkPaint paint; |
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1826 | 1842 |
1827 void GraphicsContext::didDrawTextInRect(const SkRect& textRect) | 1843 void GraphicsContext::didDrawTextInRect(const SkRect& textRect) |
1828 { | 1844 { |
1829 if (m_trackTextRegion) { | 1845 if (m_trackTextRegion) { |
1830 TRACE_EVENT0("skia", "GraphicsContext::didDrawTextInRect"); | 1846 TRACE_EVENT0("skia", "GraphicsContext::didDrawTextInRect"); |
1831 m_textRegion.join(textRect); | 1847 m_textRegion.join(textRect); |
1832 } | 1848 } |
1833 } | 1849 } |
1834 | 1850 |
1835 } | 1851 } |
OLD | NEW |