Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(417)

Side by Side Diff: src/core/SkCanvas.cpp

Issue 463493002: SkCanvas::drawPatch param SkPoint[12] (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Virtual call onDrawPatch Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "SkCanvasPriv.h" 10 #include "SkCanvasPriv.h"
(...skipping 2236 matching lines...) Expand 10 before | Expand all | Expand 10 after
2247 2247
2248 while (iter.next()) { 2248 while (iter.next()) {
2249 iter.fDevice->drawVertices(iter, vmode, vertexCount, verts, texs, 2249 iter.fDevice->drawVertices(iter, vmode, vertexCount, verts, texs,
2250 colors, xmode, indices, indexCount, 2250 colors, xmode, indices, indexCount,
2251 looper.paint()); 2251 looper.paint());
2252 } 2252 }
2253 2253
2254 LOOPER_END 2254 LOOPER_END
2255 } 2255 }
2256 2256
2257 void SkCanvas::drawPatch(const SkPatch& patch, const SkPaint& paint) { 2257 void SkCanvas::drawPatch(const SkPoint cubics[12], const SkColor colors[4],
2258 const SkPoint texCoords[4], SkXfermode* xmode, const Sk Paint& paint) {
2259 this->onDrawPatch(cubics, colors, texCoords, xmode, paint);
2260 }
2261
2262 void SkCanvas::onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
2263 const SkPoint texCoords[4], SkXfermode* xmode, const SkPaint& paint) {
2264 if (NULL == cubics) {
2265 return;
2266 }
2258 2267
2259 // Since a patch is always within the convex hull of the control points, we discard it when its 2268 // Since a patch is always within the convex hull of the control points, we discard it when its
2260 // bounding rectangle is completely outside the current clip. 2269 // bounding rectangle is completely outside the current clip.
2261 SkRect bounds; 2270 SkRect bounds;
2262 bounds.set(patch.getControlPoints(), SkPatch::kNumCtrlPts); 2271 bounds.set(cubics, SkPatch::kNumCtrlPts);
2263 if (this->quickReject(bounds)) { 2272 if (this->quickReject(bounds)) {
2264 return; 2273 return;
2265 } 2274 }
2266 2275
2267 LOOPER_BEGIN(paint, SkDrawFilter::kPath_Type, NULL) 2276 LOOPER_BEGIN(paint, SkDrawFilter::kPath_Type, NULL)
2268 2277
2269 while (iter.next()) { 2278 while (iter.next()) {
2270 iter.fDevice->drawPatch(iter, patch, paint); 2279 iter.fDevice->drawPatch(iter, cubics, colors, texCoords, xmode, paint);
2271 } 2280 }
2272 2281
2273 LOOPER_END 2282 LOOPER_END
2274 } 2283 }
2275 2284
2276 ////////////////////////////////////////////////////////////////////////////// 2285 //////////////////////////////////////////////////////////////////////////////
2277 // 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
2278 // methods, rather than actually drawing themselves. 2287 // methods, rather than actually drawing themselves.
2279 ////////////////////////////////////////////////////////////////////////////// 2288 //////////////////////////////////////////////////////////////////////////////
2280 2289
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
2541 } 2550 }
2542 2551
2543 if (NULL != matrix) { 2552 if (NULL != matrix) {
2544 canvas->concat(*matrix); 2553 canvas->concat(*matrix);
2545 } 2554 }
2546 } 2555 }
2547 2556
2548 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 2557 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
2549 fCanvas->restoreToCount(fSaveCount); 2558 fCanvas->restoreToCount(fSaveCount);
2550 } 2559 }
OLDNEW
« include/core/SkPatch.h ('K') | « src/core/SkBBoxRecord.cpp ('k') | src/core/SkDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698