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

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

Issue 2277053002: Add drawRegion() API to SkCanvas (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Added shader to test Created 4 years, 3 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 #include "SkBitmapDevice.h" 8 #include "SkBitmapDevice.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkCanvasPriv.h" 10 #include "SkCanvasPriv.h"
(...skipping 2232 matching lines...) Expand 10 before | Expand all | Expand 10 after
2243 LOOPER_END 2243 LOOPER_END
2244 } else { 2244 } else {
2245 this->predrawNotify(bounds, &paint, false); 2245 this->predrawNotify(bounds, &paint, false);
2246 SkDrawIter iter(this); 2246 SkDrawIter iter(this);
2247 while (iter.next()) { 2247 while (iter.next()) {
2248 iter.fDevice->drawRect(iter, r, paint); 2248 iter.fDevice->drawRect(iter, r, paint);
2249 } 2249 }
2250 } 2250 }
2251 } 2251 }
2252 2252
2253 void SkCanvas::onDrawRegion(const SkRegion& region, const SkPaint& paint) {
2254 SkRect storage;
2255 SkRect regionRect = SkRect::Make(region.getBounds());
2256 const SkRect* bounds = nullptr;
2257 if (paint.canComputeFastBounds()) {
2258 if (this->quickReject(paint.computeFastBounds(regionRect, &storage))) {
2259 return;
2260 }
2261 bounds = &regionRect;
2262 }
2263
2264 LOOPER_BEGIN(paint, SkDrawFilter::kRect_Type, bounds)
2265
2266 while (iter.next()) {
2267 iter.fDevice->drawRegion(iter, region, looper.paint());
2268 }
2269
2270 LOOPER_END
2271 }
2272
2253 void SkCanvas::onDrawOval(const SkRect& oval, const SkPaint& paint) { 2273 void SkCanvas::onDrawOval(const SkRect& oval, const SkPaint& paint) {
2254 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawOval()"); 2274 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawOval()");
2255 SkRect storage; 2275 SkRect storage;
2256 const SkRect* bounds = nullptr; 2276 const SkRect* bounds = nullptr;
2257 if (paint.canComputeFastBounds()) { 2277 if (paint.canComputeFastBounds()) {
2258 if (this->quickReject(paint.computeFastBounds(oval, &storage))) { 2278 if (this->quickReject(paint.computeFastBounds(oval, &storage))) {
2259 return; 2279 return;
2260 } 2280 }
2261 bounds = &oval; 2281 bounds = &oval;
2262 } 2282 }
(...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after
3399 3419
3400 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 3420 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
3401 fCanvas->restoreToCount(fSaveCount); 3421 fCanvas->restoreToCount(fSaveCount);
3402 } 3422 }
3403 3423
3404 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API 3424 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API
3405 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p rops) { 3425 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p rops) {
3406 return this->makeSurface(info, props).release(); 3426 return this->makeSurface(info, props).release();
3407 } 3427 }
3408 #endif 3428 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698