Chromium Code Reviews| 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 SkMatrix mat = this->getTotalMatrix(); | |
| 2277 SkScalar scaleX = mat.getScaleX(), scaleY = mat.getScaleY(); | |
| 2278 | |
| 2279 LOOPER_BEGIN(paint, SkDrawFilter::kPath_Type, NULL) | |
|
bsalomon
2014/07/28 20:56:26
Should we add a new SkDrawFilter::kPatch? Not real
dandov
2014/07/29 18:45:46
Mike said that for now I could just leave it as a
| |
| 2280 | |
| 2281 while (iter.next()) { | |
| 2282 iter.fDevice->drawPatch(iter, patch, paint); | |
| 2283 } | |
| 2284 | |
| 2285 LOOPER_END | |
| 2286 } | |
| 2287 | |
| 2266 ////////////////////////////////////////////////////////////////////////////// | 2288 ////////////////////////////////////////////////////////////////////////////// |
| 2267 // These methods are NOT virtual, and therefore must call back into virtual | 2289 // These methods are NOT virtual, and therefore must call back into virtual |
| 2268 // methods, rather than actually drawing themselves. | 2290 // methods, rather than actually drawing themselves. |
| 2269 ////////////////////////////////////////////////////////////////////////////// | 2291 ////////////////////////////////////////////////////////////////////////////// |
| 2270 | 2292 |
| 2271 void SkCanvas::drawARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b, | 2293 void SkCanvas::drawARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b, |
| 2272 SkXfermode::Mode mode) { | 2294 SkXfermode::Mode mode) { |
| 2273 SkPaint paint; | 2295 SkPaint paint; |
| 2274 | 2296 |
| 2275 paint.setARGB(a, r, g, b); | 2297 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)) { | 2517 if (!supported_for_raster_canvas(info)) { |
| 2496 return NULL; | 2518 return NULL; |
| 2497 } | 2519 } |
| 2498 | 2520 |
| 2499 SkBitmap bitmap; | 2521 SkBitmap bitmap; |
| 2500 if (!bitmap.installPixels(info, pixels, rowBytes)) { | 2522 if (!bitmap.installPixels(info, pixels, rowBytes)) { |
| 2501 return NULL; | 2523 return NULL; |
| 2502 } | 2524 } |
| 2503 return SkNEW_ARGS(SkCanvas, (bitmap)); | 2525 return SkNEW_ARGS(SkCanvas, (bitmap)); |
| 2504 } | 2526 } |
| OLD | NEW |