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

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: Removed GPU headers from GM 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
« no previous file with comments | « src/core/SkBBoxRecord.cpp ('k') | src/core/SkDevice.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "SkBitmapDevice.h" 11 #include "SkBitmapDevice.h"
12 #include "SkDeviceImageFilterProxy.h" 12 #include "SkDeviceImageFilterProxy.h"
13 #include "SkDraw.h" 13 #include "SkDraw.h"
14 #include "SkDrawFilter.h" 14 #include "SkDrawFilter.h"
15 #include "SkDrawLooper.h" 15 #include "SkDrawLooper.h"
16 #include "SkMetaData.h" 16 #include "SkMetaData.h"
17 #include "SkPathOps.h" 17 #include "SkPathOps.h"
18 #include "SkPatchUtils.h"
18 #include "SkPicture.h" 19 #include "SkPicture.h"
19 #include "SkRasterClip.h" 20 #include "SkRasterClip.h"
20 #include "SkRRect.h" 21 #include "SkRRect.h"
21 #include "SkSmallAllocator.h" 22 #include "SkSmallAllocator.h"
22 #include "SkSurface_Base.h" 23 #include "SkSurface_Base.h"
23 #include "SkTemplates.h" 24 #include "SkTemplates.h"
24 #include "SkTextFormatParams.h" 25 #include "SkTextFormatParams.h"
25 #include "SkTLazy.h" 26 #include "SkTLazy.h"
26 #include "SkUtils.h" 27 #include "SkUtils.h"
27 28
(...skipping 2219 matching lines...) Expand 10 before | Expand all | Expand 10 after
2247 2248
2248 while (iter.next()) { 2249 while (iter.next()) {
2249 iter.fDevice->drawVertices(iter, vmode, vertexCount, verts, texs, 2250 iter.fDevice->drawVertices(iter, vmode, vertexCount, verts, texs,
2250 colors, xmode, indices, indexCount, 2251 colors, xmode, indices, indexCount,
2251 looper.paint()); 2252 looper.paint());
2252 } 2253 }
2253 2254
2254 LOOPER_END 2255 LOOPER_END
2255 } 2256 }
2256 2257
2257 void SkCanvas::drawPatch(const SkPatch& patch, const SkPaint& paint) { 2258 void SkCanvas::drawPatch(const SkPoint cubics[12], const SkColor colors[4],
2259 const SkPoint texCoords[4], SkXfermode* xmode, const Sk Paint& paint) {
2260 if (NULL == cubics) {
2261 return;
2262 }
2258 2263
2259 // Since a patch is always within the convex hull of the control points, we discard it when its 2264 // 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. 2265 // bounding rectangle is completely outside the current clip.
2261 SkRect bounds; 2266 SkRect bounds;
2262 bounds.set(patch.getControlPoints(), SkPatch::kNumCtrlPts); 2267 bounds.set(cubics, SkPatchUtils::kNumCtrlPts);
2263 if (this->quickReject(bounds)) { 2268 if (this->quickReject(bounds)) {
2264 return; 2269 return;
2265 } 2270 }
2266 2271
2272 this->onDrawPatch(cubics, colors, texCoords, xmode, paint);
2273 }
2274
2275 void SkCanvas::onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
2276 const SkPoint texCoords[4], SkXfermode* xmode, const SkPaint& paint) {
2277
2267 LOOPER_BEGIN(paint, SkDrawFilter::kPath_Type, NULL) 2278 LOOPER_BEGIN(paint, SkDrawFilter::kPath_Type, NULL)
2268 2279
2269 while (iter.next()) { 2280 while (iter.next()) {
2270 iter.fDevice->drawPatch(iter, patch, paint); 2281 iter.fDevice->drawPatch(iter, cubics, colors, texCoords, xmode, paint);
2271 } 2282 }
2272 2283
2273 LOOPER_END 2284 LOOPER_END
2274 } 2285 }
2275 2286
2276 ////////////////////////////////////////////////////////////////////////////// 2287 //////////////////////////////////////////////////////////////////////////////
2277 // These methods are NOT virtual, and therefore must call back into virtual 2288 // These methods are NOT virtual, and therefore must call back into virtual
2278 // methods, rather than actually drawing themselves. 2289 // methods, rather than actually drawing themselves.
2279 ////////////////////////////////////////////////////////////////////////////// 2290 //////////////////////////////////////////////////////////////////////////////
2280 2291
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
2541 } 2552 }
2542 2553
2543 if (NULL != matrix) { 2554 if (NULL != matrix) {
2544 canvas->concat(*matrix); 2555 canvas->concat(*matrix);
2545 } 2556 }
2546 } 2557 }
2547 2558
2548 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 2559 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
2549 fCanvas->restoreToCount(fSaveCount); 2560 fCanvas->restoreToCount(fSaveCount);
2550 } 2561 }
OLDNEW
« no previous file with comments | « src/core/SkBBoxRecord.cpp ('k') | src/core/SkDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698