| 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 2235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2246 | 2246 |
| 2247 while (iter.next()) { | 2247 while (iter.next()) { |
| 2248 iter.fDevice->drawVertices(iter, vmode, vertexCount, verts, texs, | 2248 iter.fDevice->drawVertices(iter, vmode, vertexCount, verts, texs, |
| 2249 colors, xmode, indices, indexCount, | 2249 colors, xmode, indices, indexCount, |
| 2250 looper.paint()); | 2250 looper.paint()); |
| 2251 } | 2251 } |
| 2252 | 2252 |
| 2253 LOOPER_END | 2253 LOOPER_END |
| 2254 } | 2254 } |
| 2255 | 2255 |
| 2256 void SkCanvas::drawPatch(const SkPatch& patch, const SkPaint& paint) { |
| 2257 |
| 2258 // Since a patch is always within the convex hull of the control points, we
discard it when its |
| 2259 // bounding rectangle is completely outside the current clip. |
| 2260 SkRect bounds; |
| 2261 bounds.set(patch.getControlPoints(), 12); |
| 2262 if (this->quickReject(bounds)) { |
| 2263 return; |
| 2264 } |
| 2265 |
| 2266 LOOPER_BEGIN(paint, SkDrawFilter::kPath_Type, NULL) |
| 2267 |
| 2268 while (iter.next()) { |
| 2269 iter.fDevice->drawPatch(iter, patch, paint); |
| 2270 } |
| 2271 |
| 2272 LOOPER_END |
| 2273 } |
| 2274 |
| 2256 ////////////////////////////////////////////////////////////////////////////// | 2275 ////////////////////////////////////////////////////////////////////////////// |
| 2257 // These methods are NOT virtual, and therefore must call back into virtual | 2276 // These methods are NOT virtual, and therefore must call back into virtual |
| 2258 // methods, rather than actually drawing themselves. | 2277 // methods, rather than actually drawing themselves. |
| 2259 ////////////////////////////////////////////////////////////////////////////// | 2278 ////////////////////////////////////////////////////////////////////////////// |
| 2260 | 2279 |
| 2261 void SkCanvas::drawARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b, | 2280 void SkCanvas::drawARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b, |
| 2262 SkXfermode::Mode mode) { | 2281 SkXfermode::Mode mode) { |
| 2263 SkPaint paint; | 2282 SkPaint paint; |
| 2264 | 2283 |
| 2265 paint.setARGB(a, r, g, b); | 2284 paint.setARGB(a, r, g, b); |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2485 if (!supported_for_raster_canvas(info)) { | 2504 if (!supported_for_raster_canvas(info)) { |
| 2486 return NULL; | 2505 return NULL; |
| 2487 } | 2506 } |
| 2488 | 2507 |
| 2489 SkBitmap bitmap; | 2508 SkBitmap bitmap; |
| 2490 if (!bitmap.installPixels(info, pixels, rowBytes)) { | 2509 if (!bitmap.installPixels(info, pixels, rowBytes)) { |
| 2491 return NULL; | 2510 return NULL; |
| 2492 } | 2511 } |
| 2493 return SkNEW_ARGS(SkCanvas, (bitmap)); | 2512 return SkNEW_ARGS(SkCanvas, (bitmap)); |
| 2494 } | 2513 } |
| OLD | NEW |