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

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

Issue 979943002: Pass blob bounds to the looper, if available (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 5 years, 9 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 | « no previous file | no next file » | 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 #include "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkCanvasPriv.h" 9 #include "SkCanvasPriv.h"
10 #include "SkBitmapDevice.h" 10 #include "SkBitmapDevice.h"
(...skipping 2135 matching lines...) Expand 10 before | Expand all | Expand 10 after
2146 iter.fDevice->drawTextOnPath(iter, text, byteLength, path, 2146 iter.fDevice->drawTextOnPath(iter, text, byteLength, path,
2147 matrix, looper.paint()); 2147 matrix, looper.paint());
2148 } 2148 }
2149 2149
2150 LOOPER_END 2150 LOOPER_END
2151 } 2151 }
2152 2152
2153 void SkCanvas::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, 2153 void SkCanvas::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
2154 const SkPaint& paint) { 2154 const SkPaint& paint) {
2155 2155
2156 SkRect storage;
2157 const SkRect* bounds = NULL;
2156 if (paint.canComputeFastBounds()) { 2158 if (paint.canComputeFastBounds()) {
2157 SkRect storage; 2159 storage = blob->bounds().makeOffset(x, y);
2160 bounds = &paint.computeFastBounds(storage, &storage);
2158 2161
2159 if (this->quickReject(paint.computeFastBounds(blob->bounds().makeOffset( x, y), &storage))) { 2162 if (this->quickReject(*bounds)) {
2160 return; 2163 return;
2161 } 2164 }
2162 } 2165 }
2163 2166
2164 // We cannot filter in the looper as we normally do, because the paint is 2167 // We cannot filter in the looper as we normally do, because the paint is
2165 // incomplete at this point (text-related attributes are embedded within blo b run paints). 2168 // incomplete at this point (text-related attributes are embedded within blo b run paints).
2166 SkDrawFilter* drawFilter = fMCRec->fFilter; 2169 SkDrawFilter* drawFilter = fMCRec->fFilter;
2167 fMCRec->fFilter = NULL; 2170 fMCRec->fFilter = NULL;
2168 2171
2169 LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, NULL) 2172 LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, bounds)
2170 2173
2171 while (iter.next()) { 2174 while (iter.next()) {
2172 SkDeviceFilteredPaint dfp(iter.fDevice, looper.paint()); 2175 SkDeviceFilteredPaint dfp(iter.fDevice, looper.paint());
2173 iter.fDevice->drawTextBlob(iter, blob, x, y, dfp.paint(), drawFilter); 2176 iter.fDevice->drawTextBlob(iter, blob, x, y, dfp.paint(), drawFilter);
2174 } 2177 }
2175 2178
2176 LOOPER_END 2179 LOOPER_END
2177 2180
2178 fMCRec->fFilter = drawFilter; 2181 fMCRec->fFilter = drawFilter;
2179 } 2182 }
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
2520 } 2523 }
2521 2524
2522 if (matrix) { 2525 if (matrix) {
2523 canvas->concat(*matrix); 2526 canvas->concat(*matrix);
2524 } 2527 }
2525 } 2528 }
2526 2529
2527 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 2530 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
2528 fCanvas->restoreToCount(fSaveCount); 2531 fCanvas->restoreToCount(fSaveCount);
2529 } 2532 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698