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

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: Rebased for SkPictureRecord 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 if (NULL == cubics) {
2260 return;
2261 }
2258 2262
2259 // Since a patch is always within the convex hull of the control points, we discard it when its 2263 // 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. 2264 // bounding rectangle is completely outside the current clip.
2261 SkRect bounds; 2265 SkRect bounds;
2262 bounds.set(patch.getControlPoints(), SkPatch::kNumCtrlPts); 2266 bounds.set(cubics, SkPatchUtils::kNumCtrlPts);
2263 if (this->quickReject(bounds)) { 2267 if (this->quickReject(bounds)) {
2264 return; 2268 return;
2265 } 2269 }
2266 2270
2271 this->onDrawPatch(cubics, colors, texCoords, xmode, paint);
2272 }
2273
2274 void SkCanvas::onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
2275 const SkPoint texCoords[4], SkXfermode* xmode, const SkPaint& paint) {
2276
2267 LOOPER_BEGIN(paint, SkDrawFilter::kPath_Type, NULL) 2277 LOOPER_BEGIN(paint, SkDrawFilter::kPath_Type, NULL)
2268 2278
2269 while (iter.next()) { 2279 while (iter.next()) {
2270 iter.fDevice->drawPatch(iter, patch, paint); 2280 iter.fDevice->drawPatch(iter, cubics, colors, texCoords, xmode, paint);
2271 } 2281 }
2272 2282
2273 LOOPER_END 2283 LOOPER_END
2274 } 2284 }
2275 2285
2276 ////////////////////////////////////////////////////////////////////////////// 2286 //////////////////////////////////////////////////////////////////////////////
2277 // These methods are NOT virtual, and therefore must call back into virtual 2287 // These methods are NOT virtual, and therefore must call back into virtual
2278 // methods, rather than actually drawing themselves. 2288 // methods, rather than actually drawing themselves.
2279 ////////////////////////////////////////////////////////////////////////////// 2289 //////////////////////////////////////////////////////////////////////////////
2280 2290
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
2541 } 2551 }
2542 2552
2543 if (NULL != matrix) { 2553 if (NULL != matrix) {
2544 canvas->concat(*matrix); 2554 canvas->concat(*matrix);
2545 } 2555 }
2546 } 2556 }
2547 2557
2548 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 2558 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
2549 fCanvas->restoreToCount(fSaveCount); 2559 fCanvas->restoreToCount(fSaveCount);
2550 } 2560 }
OLDNEW
« include/core/SkCanvas.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