OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2008 The Android Open Source Project | 2 * Copyright 2008 The Android Open Source Project |
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 | 8 |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkBitmapDevice.h" | 10 #include "SkBitmapDevice.h" |
(...skipping 2245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2256 | 2256 |
2257 while (iter.next()) { | 2257 while (iter.next()) { |
2258 iter.fDevice->drawVertices(iter, vmode, vertexCount, verts, texs, | 2258 iter.fDevice->drawVertices(iter, vmode, vertexCount, verts, texs, |
2259 colors, xmode, indices, indexCount, | 2259 colors, xmode, indices, indexCount, |
2260 looper.paint()); | 2260 looper.paint()); |
2261 } | 2261 } |
2262 | 2262 |
2263 LOOPER_END | 2263 LOOPER_END |
2264 } | 2264 } |
2265 | 2265 |
| 2266 void SkCanvas::drawPatch(const SkPatch& patch, const SkPaint& paint) { |
| 2267 |
| 2268 // Since a patch is always within the convex hull of the control points, we
discard it when its |
| 2269 // bounding rectangle is completely outside the current clip. |
| 2270 SkRect bounds; |
| 2271 bounds.set(patch.getControlPoints(), 12); |
| 2272 if (this->quickReject(bounds)) { |
| 2273 return; |
| 2274 } |
| 2275 |
| 2276 LOOPER_BEGIN(paint, SkDrawFilter::kPath_Type, NULL) |
| 2277 |
| 2278 while (iter.next()) { |
| 2279 iter.fDevice->drawPatch(iter, patch, paint); |
| 2280 } |
| 2281 |
| 2282 LOOPER_END |
| 2283 } |
| 2284 |
2266 ////////////////////////////////////////////////////////////////////////////// | 2285 ////////////////////////////////////////////////////////////////////////////// |
2267 // These methods are NOT virtual, and therefore must call back into virtual | 2286 // These methods are NOT virtual, and therefore must call back into virtual |
2268 // methods, rather than actually drawing themselves. | 2287 // methods, rather than actually drawing themselves. |
2269 ////////////////////////////////////////////////////////////////////////////// | 2288 ////////////////////////////////////////////////////////////////////////////// |
2270 | 2289 |
2271 void SkCanvas::drawARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b, | 2290 void SkCanvas::drawARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b, |
2272 SkXfermode::Mode mode) { | 2291 SkXfermode::Mode mode) { |
2273 SkPaint paint; | 2292 SkPaint paint; |
2274 | 2293 |
2275 paint.setARGB(a, r, g, b); | 2294 paint.setARGB(a, r, g, b); |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2495 if (!supported_for_raster_canvas(info)) { | 2514 if (!supported_for_raster_canvas(info)) { |
2496 return NULL; | 2515 return NULL; |
2497 } | 2516 } |
2498 | 2517 |
2499 SkBitmap bitmap; | 2518 SkBitmap bitmap; |
2500 if (!bitmap.installPixels(info, pixels, rowBytes)) { | 2519 if (!bitmap.installPixels(info, pixels, rowBytes)) { |
2501 return NULL; | 2520 return NULL; |
2502 } | 2521 } |
2503 return SkNEW_ARGS(SkCanvas, (bitmap)); | 2522 return SkNEW_ARGS(SkCanvas, (bitmap)); |
2504 } | 2523 } |
OLD | NEW |